You need to execute a task over two or more series of files having a common index range.
Use the from method to define the range over which to repeat the task execution, then chain it with the map operator to associate each index with the corresponding input files. Finally, use the resulting channel as input for the process.
process foo {
debug true
tag "$sampleId"
input:
tuple val(sampleId), file(indels), file(snps)
"""
echo foo_command --this $indels --that $snps
"""
}
workflow {
Channel.from(1..23) \
| map { chr -> ["sample${chr}", file("/some/path/foo.${chr}.indels.vcf"), file("/other/path/foo.snvs.${chr}.vcf")] } \
| foo
}
nextflow run nextflow-io/patterns/process-per-file-range.nf