Nextflow Patterns: https://nextflow-io.github.io/patterns/
This website documents various implementation patterns, mostly around channel operators. It's not very visible and it's out of date. I recommend taking the examples that are still useful and incorporating them into the training, e.g. as a "Dataflow Patterns" side quest.
Feel free to rewrite or throw out anything that doesn't fit. This content is very old
See also: https://docs.seqera.io/nextflow/tutorials/static-types-operators
I went through them a year or two ago and wrote down these recommendations:
-
Channel duplication: Not needed since DSL2 -- remove
-
Sort file pairs by sample name: Use collect and then map with toSorted() to collect and sort a channel of samples
-
Create key to combine channels: looks fine, although better to use a samplesheet
-
Scatter executions: Use channel.fromList() or fromPath to scatter a collection of inputs. Use flatMap to scatter further if needed. Avoid fromFilePairs, use a samplesheet instead
-
Gather results: Use collect to gather a channel into a collection. Use groupBy (>=26.04) or groupTuple to gather a scattered channel into groups (opposite of flatMap)
-
Organize outputs: Use the output block
-
Other: not sure these are worth keeping
-
Advanced patterns: not sure these are worth keeping
Nextflow Patterns: https://nextflow-io.github.io/patterns/
This website documents various implementation patterns, mostly around channel operators. It's not very visible and it's out of date. I recommend taking the examples that are still useful and incorporating them into the training, e.g. as a "Dataflow Patterns" side quest.
Feel free to rewrite or throw out anything that doesn't fit. This content is very old
See also: https://docs.seqera.io/nextflow/tutorials/static-types-operators
I went through them a year or two ago and wrote down these recommendations:
Channel duplication: Not needed since DSL2 -- remove
Sort file pairs by sample name: Use
collectand thenmapwithtoSorted()to collect and sort a channel of samplesCreate key to combine channels: looks fine, although better to use a samplesheet
Scatter executions: Use
channel.fromList()orfromPathto scatter a collection of inputs. UseflatMapto scatter further if needed. AvoidfromFilePairs, use a samplesheet insteadGather results: Use
collectto gather a channel into a collection. UsegroupBy(>=26.04) orgroupTupleto gather a scattered channel into groups (opposite offlatMap)Organize outputs: Use the
outputblockOther: not sure these are worth keeping
Advanced patterns: not sure these are worth keeping