Answers.Body: <p>I have solved this problem in the past by <a href="https://www.nextflow.io/docs/latest/faq.html#how-do-i-use-the-same-channel-multiple-times" rel="nofollow noreferrer">duplicating the output channel</a> of the desired process in order to feed the same output into multiple downstream processes.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-05-26T04:38:06.793Z
Answers.LastActivityDate: 2021-05-26T04:38:06.793Z
Answers.UserDisplayName: Throckmorton
Answers.Body: <p>As far as I know, DSL2 should be able to handle this. Have you specified an output qualifier for your process <code>get_fq_info</code> (e.g. <code>path</code>)? I ran into a similar issue when I forgot to specify it.</p>
  <p>For example, this will result in the error <code>process align_bowtie2 declares 1 input channel but 0 were specified</code>:</p>
  <pre><code>process get_fq_info {
     input:
     path reads
  
     output:
     &quot;output.txt&quot;
  
     shell:
     &quot;&quot;&quot;
     myprocess.sh ${reads} &gt; output.txt
     &quot;&quot;&quot;
  }
  </code></pre>
  <p>And is probably solved by this:</p>
  <pre><code>process get_fq_info {
     input:
     path reads
  
     output:
     path &quot;output.txt&quot;
  
     shell:
     &quot;&quot;&quot;
     myprocess.sh ${reads} &gt; output.txt
     &quot;&quot;&quot;
  
  <span class="math-container">```</span>
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-01-10T17:50:05.060Z
Answers.LastActivityDate: 2022-01-10T17:58:25.413Z
Answers.LastEditDate: 2022-01-10T17:58:25.413Z
Answers.UserDisplayName: Geert van Geest
Body: <p>This is my workflow:</p>
  <pre><code>pre_align()
  pre_align.out.single_fastqs.view()
  get_fq_info(pre_align.out.single_fastqs)
  
  align_bwa(get_fq_info.out.fq_info)
  
  align_bowtie2(get_fq_info.out.fq_info)
  </code></pre>
  <p>where I want to use the same output from <code>get_fq_info</code> as input for either <code>align_bwa</code> and align_bowtie2`.</p>
  <p>As it's shown here <strong>only align_bwa is executed</strong>. If I comment <code>align_bwa</code> THEN <code>align_bowtie2</code> gets executed.</p>
  <p>How can I fix this?</p>
  <p>Thank you!</p>
  
Tags: <nextflow>
Title: use same output in two processes in nextflow dsl2
ThreadText: # use same output in two processes in nextflow dsl2
  
  (Asked by: username_0 on 2021-05-22)
  
  This is my workflow:
  
  ```
  pre_align()
  pre_align.out.single_fastqs.view()
  get_fq_info(pre_align.out.single_fastqs)
  
  align_bwa(get_fq_info.out.fq_info)
  
  align_bowtie2(get_fq_info.out.fq_info)
  
  ```
  
  where I want to use the same output from `get_fq_info` as input for either `align_bwa` and align\_bowtie2`.
  
  As it's shown here **only align\_bwa is executed**. If I comment `align_bwa` THEN `align_bowtie2` gets executed.
  
  How can I fix this?
  
  Thank you!
  
  **Tags:** nextflow
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2021-05-26. Score: 2
  
  I have solved this problem in the past by [duplicating the output channel](https://www.nextflow.io/docs/latest/faq.html#how-do-i-use-the-same-channel-multiple-times) of the desired process in order to feed the same output into multiple downstream processes.
  
  
  ---
  
  ### Answer by username_2 on 2022-01-10. Score: 1
  
  As far as I know, DSL2 should be able to handle this. Have you specified an output qualifier for your process `get_fq_info` (e.g. `path`)? I ran into a similar issue when I forgot to specify it.
  
  For example, this will result in the error `process align_bowtie2 declares 1 input channel but 0 were specified`:
  
  ```
  process get_fq_info {
     input:
     path reads
  
     output:
     "output.txt"
  
     shell:
     """
     myprocess.sh ${reads} > output.txt
     """
  }
  
  ```
  
  And is probably solved by this:
  
  ```
  process get_fq_info {
     input:
     path reads
  
     output:
     path "output.txt"
  
     shell:
     """
     myprocess.sh ${reads} > output.txt
     """
  
  ```
  
  ```
  
  
  ---
  
  