xihh
xihh

Reputation: 309

How do I send a process output to multiple channels in Nextflow?

I'm implementing a Nextflow workflow where each process can give multiple outputs that may be needed downstream on different processes.

process multiple_outputs {
   input:
   tuple id, input from previous_process

   output:
   tuple id, input_for_a, input_for_b, input_for_a_b into downstream
}

Nextflow documentation states that operator into can use multiple channels and promotes channel duplication as a pattern.

However none of these options seems to work inside the process primitive and multiple channel output is not documented:

Which is the right way to use the output in multiple channels?

Upvotes: 2

Views: 3510

Answers (2)

pditommaso
pditommaso

Reputation: 3381

The output declaration should be:

output:
tuple id, input_for_a, input_for_b, input_for_a_b into(downstream_a, downstream_b)

In alternative, you may want to consider using DLS2 which does not have anymore the single-channel usage requirement. Read more about it here.

Upvotes: 3

xihh
xihh

Reputation: 309

Answer b seems to work:

output:
tuple id, input_for_a, input_for_a_b into downstream_a
tuple id, input_for_b, input_for_a_b into downstream_b

It seems that it failed for non related reasons.

Upvotes: 2

Related Questions