Search code examples
nextflow

how to flatten the second element of the input tuple in a process in nextflow


...
filter (ch_splitfq)
.set {ch_fq}    // tuple: val(id), path(sample.clean_*.fq.gz)

fqcheck (ch_fq.flatten()???)
.collect()
.set {ch_fqcheck}

ch_fq is like: sample1, [sample1.clean_1.fq.gz, sample1.clean_2.fq.gz] I want to split ch_fq into two channels and give each to fqcheck process. I thought of flatten(), but only flatten the second element and keep the id. the two channels given to fqcheck process should be like: tuple val(sample1), path(clean_1.fq.gz) and tuple val(sample1), path(clean_2.fq.gz), respectively


Solution

  • I don't think you necessarily need two channels here. I think what you want is just one channel that produces the transposition. For this, you can use the transpose operator:

    fqcheck( ch_fq.transpose() )