Reputation: 892
Please see below code:
params.outdir = './results'
params.reads = "/Users/user/Downloads/tiny/normal/*_{R1,R2}_xxx.fastq.gz"
println "reads ${params.reads}"
process check {
tag {sample_id}
input:
tuple val(sample_id), path(reads)
output:stdout
script:
"""
echo "hello ${sample_id} \n"
"""
}
workflow {
check().view()
}
It gives following error:
reads /Users/user/Downloads/tiny/normal/*_{R1,R2}_xxx.fastq.gz Process
check
declares 1 input channel but 0 were specified
How do I two channel or one channel? Sorry new to nextflow
Upvotes: 1
Views: 1079
Reputation: 54502
You get that error because you did not call check
with any input channels. It was expecting a single input channel but none were specified. If you require multiple input channels, most of the time what you'll want is one queue channel and one or more value channels. Note that a value channel is implicitly created by a process when it is invoked with a simple value, like a file
object. For example:
params.reads = "/Users/name/Downloads/tiny/normal/*_R{1,2}_xxx.fastq.gz"
params.ref_fasta = "/path/to/GRCh38.fa"
params.outdir = './results'
process check {
tag { sample_id }
publishDir "${params.outdir}/check", mode: 'copy'
debug true
input:
tuple val(sample_id), path(reads)
path fasta
output:
tuple val(sample_id), path("out.txt")
script:
"""
echo "My sample: ${sample_id}:"
ls -1 ${reads}
ls -1 ${fasta}
touch out.txt
"""
}
workflow {
reads = Channel.fromFilePairs( params.reads )
ref_fasta = file( params.ref_fasta )
check(reads, ref_fasta).view()
}
Results:
$ nextflow run main.nf
N E X T F L O W ~ version 23.04.1
Launching `main.nf` [small_feynman] DSL2 - revision: 90fca4d9fd
executor > local (3)
[a1/eab4e5] process > check (foo) [100%] 3 of 3 ✔
[baz, /path/to/work/52/a93d1281daab5db136ffe96c34da2e/out.txt]
My sample: baz:
baz_R1_xxx.fastq.gz
baz_R2_xxx.fastq.gz
GRCh38.fa
[bar, /path/to/work/80/7b6dc52b6c620038368898a4660598/out.txt]
My sample: bar:
bar_R1_xxx.fastq.gz
bar_R2_xxx.fastq.gz
GRCh38.fa
[foo, /path/to/work/a1/eab4e5c20977b36ee71453430c3f0b/out.txt]
My sample: foo:
foo_R1_xxx.fastq.gz
foo_R2_xxx.fastq.gz
GRCh38.fa
Upvotes: 1