Dear list,
I have a trivial question. Hopefully, it has not been answered
already.
In the process trimFastq hereafter, the channel scriptPath is emitted only once while the other the tuple should be emitted several times but it stopped at the first iteration of the process.
From the nextflow documentation, I understood that this can be solved by using value channel but with path channel, I don't know how to make the process run as many times as I have tuples emmitted.
I thank you a lot for your kind help,
Sylvain
Channel
.fromPath(params.fastqDir + '/' +"*.fastq.gz")
.map(path ->
tuple(
(path.getBaseName() =~ /(.+)_S\d+_L00[1-4]_R[1-2]_001/)[0][1]
,path
,(path.getBaseName() =~ /.+_S\d+_(L00[1-4])_R[1-2]_001/)[0][1]
,(path.getBaseName() =~ /.+_S\d+_L00[1-4]_(R[1-2])_001/)[0][1]
)
)
.set{fastq_ch}
Channel.fromPath(params.scriptPath).set{scriptpath_ch}
// WORKFLOW
workflow {
// for seqFF
trimFastq(fastq_ch.dump(),scriptpath_ch)
}
process trimFastq {
label 'env_pysam'
label 'cpusmem_std'
input:
tuple val(sampleName),path(inputFastq),val(lane),val(orientation)
path scriptPath
output:
tuple val(sampleName),path("${sampleName}_${lane}_${orientation}_trim${params.trimLength}.fastq.gz"),val(lane),val(orientation)
script:
"""
python ${scriptPath}/shallow_cnv/trimFastqToLenght.py -z -l ${params.trimLength} \
-i ${inputFastq} -o ${sampleName}_${lane}_${orientation}_trim${params.trimLength}.fastq.gz
"""
}