-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor/Samplefile channel + functions #2
Conversation
CHANGELOG.md
Outdated
@@ -8,8 +8,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 | |||
Initial release of ferlab/postprocessing, created with the [nf-core](https://nf-co.re/) template. | |||
|
|||
### `Added` | |||
[#2]https://github.com/FelixAntoineLeSieur/Post-processing-Pipeline/pull/2 Added tests and samplefile channel functions |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Je crois qu'il faudra corriger le petit typo ici aussi.
assets/schema_input.json
Outdated
} | ||
}, | ||
"required": ["sample", "fastq_1"] | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Merci :) 🧹 ✨
@@ -77,9 +77,32 @@ workflow PIPELINE_INITIALISATION { | |||
// | |||
validateInputParameters() | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Je crois que ce serait plus propre de mettre la logique de parsing du sample sheet dans un subworfklow séparé et de l'invoquer ici. J'ai vu un example de ça dans SAREK: https://github.com/nf-core/sarek/blob/master/subworkflows/local/utils_nfcore_sarek_pipeline/main.nf#L133
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bien sûr, je crois qu'il faudra aussi épurer un peu ce fichier et enlever ce qu'on n'utilise pas.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oui je crois que je vais enlever tout de suite les fonctions qu'on ne va pas utiliser. Aussi pour SAREK je suis allé voir, je crois qu'ils ont fait leur propre subworkflow parce qu'ils acceptent beaucoup d'extensions/formats différents. Dans notre cas, le parse n'est pas très long à faire donc je ne sais pas si ça vaut la peine d'avoir un subworkflow juste pour ça...
versions = ch_versions | ||
|
||
sampleMeta | view{"Meta: $it"} | ||
sampleFiles | view{"files: $it"} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Les view
c'est pour débugger?
@@ -103,6 +126,7 @@ workflow PIPELINE_INITIALISATION { | |||
emit: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Je préfère en fait ce style pour émettre les channels d'output. Je trouve que c'est plus facilement visible. Mais bon, c'est subjectif.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
J'essayais de suivre le plus possible ce qu'on avait déjà écrit, mais je suis d'accord.
|
||
//Transform a row from the sample file in V1 format from a list structure to a map structure. | ||
def rowMapperV1(columns, sequencingType) { | ||
if ((columns[1] == "WGS") || (columns[1] == "WES")){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
C'est super pour le message. Est-ce que c'est possible cependant que l'équivalent va être fait avec un tool de validation de nf-core?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Je crois que tu pourrais écrire l'expression dans le if de cette façon: ["WGS", "WES"].contains(columns[1])
.
Si on garde l'enum, je crois que ce serait aussi plus clean de s'en servir au lieu d'utiliser des string hard codés. C'est possible de définir une fonction à l'intérieur de l'enum qui fait ça:
enum SequencingType {
WES,
WGS
public static boolean contains(String s) {
for(SequencingType sequencingType in SequencingType.values()){
if(sequencingType.name().equals(s)){
return true
}
}
return false
}
}
Ensuite, tu pourrais remplacer l'expression dans le if
par: SequencingType.contains(columns[1])
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Commentaires similaires applicables à rowMapperV2.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok c'est ajouté
enum SampleFileFormat { | ||
V1, | ||
V2 | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Je me demande si on ne devrait pas utiliser juste des constantes de type string au lieu des enums? C'est bien l'enum mais c'est un concept quand même avancé qui peut peut-être rendre le code plus difficile à comprendre pour des bioinformaticiens. Je crois que ça rendrait le code aussi pas mal plus concis.
Il y a des avantages intéressants avec l'enum, mais ce n'est pas absolument essentiel et peut-être que d'autres outils nf-core couvrent déjà ça.
On peut le faire dans un deuxième temps bien sûr. On a déjà un bon chantier ...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Petit hint pour plus tard, il faudra probablement que tu importes les enum dans le subworkflow qui va exécuter la logique de post processing.
} | ||
return enumInstance.valueOf(paramValue) | ||
} | ||
def getSampleFileFormat() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Je crois que le block if
ici n'est pas nécessaire, car on définit une valeur par défaut dans nextflow.config. Si tu veux tu peux l'enlever. Quand j'ai écrit ce code, je ne savais pas que le fichier nextflow.config est toujours applicable même s'il n'est pas spécifié à la ligne de commande.
Idem pour getSequencingType().
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
J'ai enlevé cette fonction finalement, on a seulement 1 enum (sequencingType) donc pas besoin de réutiliser ce code
--sampleFileFormat V2 as needed") | ||
exit(0) | ||
} | ||
print(columns[1]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
C'est peut-être un artéfact de debugging ça?
|
||
//Transform a row from the sample file in V2 format from a list structure to a map structure | ||
def rowMapperV2(columns) { | ||
def sampleSeqType = columns[1] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Je crois qu'ici tu pourrais utiliser columns[1].toUpperCase()
pour supporter le sequencing type passé en lettres minuscules.
Peut-être que tu voudrais utiliser une logique similaire pour rowMapperV1.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok c'est fait
--sampleFileFormat V1 as needed") | ||
exit(0) | ||
} | ||
if (sampleSeqType != params.sequencingType){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Je ne comprends pas bien pourquoi on fait ça ... Il me semble qu'il n'y a pas d'utilité au format V2 si on est forcé d'utiliser toujours la même valeur que le paramètre sequencingType.
Je crois que c'est peut-être même possible peut-être même sur qlin d'avoir, dans une batch, à la fois WES et WGS.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
J'ai enlevé cette partie dans V2, maintenant on accepte la présence de WGS ou WES, même s'il y a plusieurs types parmis les sample. Je ne sais juste pas encore on va séparer Hard-Filtering vs VQSR de cette façon par contre... à discuter
I also added a few tests to validate the sampleFileFormat and sequencingType
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
review #2
@@ -103,6 +126,7 @@ workflow PIPELINE_INITIALISATION { | |||
emit: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
J'essayais de suivre le plus possible ce qu'on avait déjà écrit, mais je suis d'accord.
|
||
//Transform a row from the sample file in V1 format from a list structure to a map structure. | ||
def rowMapperV1(columns, sequencingType) { | ||
if ((columns[1] == "WGS") || (columns[1] == "WES")){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok c'est ajouté
} | ||
return enumInstance.valueOf(paramValue) | ||
} | ||
def getSampleFileFormat() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
J'ai enlevé cette fonction finalement, on a seulement 1 enum (sequencingType) donc pas besoin de réutiliser ce code
|
||
//Transform a row from the sample file in V2 format from a list structure to a map structure | ||
def rowMapperV2(columns) { | ||
def sampleSeqType = columns[1] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok c'est fait
--sampleFileFormat V1 as needed") | ||
exit(0) | ||
} | ||
if (sampleSeqType != params.sequencingType){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
J'ai enlevé cette partie dans V2, maintenant on accepte la présence de WGS ou WES, même s'il y a plusieurs types parmis les sample. Je ne sais juste pas encore on va séparer Hard-Filtering vs VQSR de cette façon par contre... à discuter
6063676
to
d77de69
Compare
This branch is based on the first PR: InitialSchemas. Only review/merge after that PR is merged.
Adds the first function encountered in the main pipeline cqdg-denovo: sampleChannel, and the required local functions.
This will create the initial input channel required for the rest of the pipeline.
I also added a few tests to verify the consistency of sampleFileFormat and sequencingType.