`ch_fastq` channel is reused <here> and <here>. Is...
# methylseq
ö
ch_fastq
channel is reused here and here. Is it safe?
s
Why would it not be?
You can use the same channel as input into multiple processes, that is fine. If you are modifying the channel in between it might not be, but that isn't happening here
ö
Previously a channel could be consumed only once in a process, but it seems it does not apply to DSL2 anymore: https://nextflow-io.github.io/patterns/channel-duplication/
s
Yes, that is true, but DSL2 has been out for some time now
b
In my experience, the only risk there is to change variables "in-place" in a
map
or the like, which can lead to race conditions. From memory, we used to have code that looked like this:
Copy code
rawFastqPairs | trimReads

trimReads.out.fastqs \
	| map {it[0] = "${it[0]}_trimmed"; it} \
	| concat ( rawFastqPairs.map {it[0] = "${it[0]}_raw"; it} ) \
	| runFastQC
This caused a big headache because the string in
it[0]
is only pointed to, and thus changing it in place in the map randomly set it one way or the other depending on which code is executed first, leading to files named something like
sample_trimmed_raw
I think we worked around it by creating a "copy", so that it becomes
Copy code
rawFastqPairs | trimReads

trimReads.out.fastqs \
	| map {[it[0]+"_trimmed", it[1], it[2]]} \
	| concat ( rawFastqPairs.map {[it[0]+"_raw", it[1], it[2]]} ) \
	| runFastQC
(hope that helps someone - took me ages to figure out what was going on there 🙈)