Skip to content

Latest commit

 

History

History
38 lines (29 loc) · 662 Bytes

collect-into-file.md

File metadata and controls

38 lines (29 loc) · 662 Bytes

Problem

You need to concatenate into a single file all output files produced by an upstream process.

Solution

Use the collectFile operator to merge all the output files into a single file.

Code

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
}

Run it

Use the the following command to execute the example:

nextflow run nextflow-io/patterns/collect-into-file.nf