This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Nextflow - using mutiple input channels

Hi, I'm writing a Nextflow module for a CNV caller, and I'm having issues with the input files. It requires 2 input files from other processes which have been ported into channels, but when I try to call the required channels I get the error

Multiple channels are not allowed on 'from' input declaration

Is there a way to combine channels? I have tried joining the channels but it still came back with the error. The full code block is below. This is written in DSL1.

// Calculate Copy Number Variation from RNAseq data
process runRNAseqCNV {

tag { filename + ' - RNAseq CNV Caller' }

publishDir "${params.outDir}/${group}/${filename}/RNAseqCNV", mode: 'copy'

label 'rEnv'

input:
set group,
    sample,
    filename
    file(vcf) from results_GATK
    file("counts.Rdata") from ch_counts

output:
file("cnv_metadata.csv"),
file("config"),
file("estimations_table.tsv"),
file("manual_an_table.tsv"),
file("sampleCounts.csv"),
set group,
    sample,
    filename

script:
"""
${workflow.projectDir}/scripts/nf-cnv_caller.R \
-f ${filename} \
-g ${group} \
-o ${params.outDir}

"""
}
channels nextflow

You are using the old deprecated DSL1 syntax. A recent nextflow will not de-facto accept your code.

2 answers

(not tested) your code is missing some commas to separate multiple input output channels.




// Calculate Copy Number Variation from RNAseq data
process runRNAseqCNV {

tag "${filename}"


input:
tuple group,  sample,  filename,   path(vcf) from results_GATK
path("counts.Rdata") from ch_counts

output:
path("cnv_metadata.csv")
path("config")
path("estimations_table.tsv")
file("manual_an_table.tsv")
path("sampleCounts.csv")
tuple group, sample, filename

script:
"""
${workflow.projectDir}/scripts/nf-cnv_caller.R \
-f ${filename} \
-g ${group} \
-o .
"""
}

Probably not too helpful in this specific instance, but if you are just learning, then why learn NF DSL1 and not DSL2 ? I think DSL2 is cleaner and easier, even if you don't make it hyper-modular using all the modules and multiple containers per pipeline (I don't). AFAIK DSL1 will be deprecated in the future, and most pipelines I see now are DSL2.

You probably know, but there are docs for DSL2 here https://www.nextflow.io/docs/latest/dsl2.html

Just my 2 cents.

Most importantly, you'll get good support for DSL2 as everyone is using that now, while learning deprecation-ware is a waste of time. +1 for dsl2! I see though that many tutorials online are still dsl1 so it is easy to fall into that trap as a beginner. Be sure to learn dsl2 though.

Unfortunately, I'm dealing with an existing workflow that is written in DSL1. I'm adding in some new modules as a short-term solution, but the long-term plan is to rewrite the whole workflow in DSL2. I'm used to working in DSL2 for all my other Nexflow pipelines, which is why this is a bit of a headscratcher for me. I'll try the above suggestion and see how I go.

Log in to answer this question.