Created
December 22, 2022 09:42
-
-
Save dpryan79/1494d5252f72ac4640c732bd1cac7263 to your computer and use it in GitHub Desktop.
Iterative with connected inputs/outputs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rawFastqs = Channel.fromFilePairs(['data/*_{1,2}.fastq.gz', 'data/*_R{1,2}.fastq.gz']) | |
databases = Channel.of(['label1', '/some/path/database'], ['label2', '/some/other/path/database'], ...) | |
/+ | |
The general structure of what I'd like to achieve, just without manually putting in all of the someProcess() calls | |
That won't work for a variety of reasons, among them being that someProcess() would need an alias each time | |
*/ | |
workflow { | |
someProcess(rawFastqs, databases.first()) | |
someProcess(someProcess.out.fastq, databases[2]) | |
... | |
someProcess(someProcess.out.fastq, databases.last()) | |
} | |
process someProcess { | |
input: | |
tuple val(sampleName), path(reads) | |
tuple val(label), path(database) | |
output: | |
path "*.processed.fastq.gz", emit: fastq | |
""" | |
some script processing reads through the database, noting the label for eventual reporting | |
""" | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rawFastqs = Channel.fromFilePairs(['data/*_{1,2}.fastq.gz', 'data/*_R{1,2}.fastq.gz']) | |
//N.B., this is a tuple of tuples | |
databases = Channel.of([['label1', '/some/path/database'], ['label2', '/some/other/path/database'], ...]) | |
workflow { | |
someProcess(rawFastqs, databases) | |
} | |
process someProcess { | |
input: | |
tuple val(sampleName), path(reads) | |
val(tuple(val(label), path(database))) // This doesn't work, there's a "no such variable: label" error | |
output: | |
path "*.processed.fastq.gz", emit: fastq | |
shell: | |
""" | |
Some script that iterates over the databases array | |
""" | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment