You need to concatenate into a single file all output files produced by an upstream process.
Use the collectFile operator to merge all the output files into a single file.
process foo {
input:
path x
output:
path 'file.fq'
script:
"""
< $x zcat > file.fq
"""
}
workflow {
Channel.fromPath("$baseDir/data/reads/*_1.fq.gz", checkIfExists: true) \
| foo \
| collectFile \
| view
}
Use the the following command to execute the example:
nextflow run nextflow-io/patterns/collect-into-file.nf