text: user3839: I need to merge multiple channel to reuse them in two processes. So far I tried as follows:
  channel.from([15,20,21]).into {k1;k2}
  channel.from(['a','b','c']).into {m1;m2}
  channel.from([1,2,3]).into {l1;l2}
  para1=m1.merge(k1).merge(l1)
  para2=m2.merge(k2).merge(l2)
  process p1{
  input:
  each m, k, l from para1
  """
  echo $m, $k, $l
  """
  }
  process p2{
  input:
  each m, k, l from para2
  """
  echo $m, $k, $l
  """
  }
  
  The error I am getting:
  Unknown process directive: '_in_each'
  
  Did you mean of these?
      each
  
  If I use para1.view() I can see the merged elements as expected. Any help
  
  user10775: I don't think you can unpack tuples using the each qualifier like that. You can, however, unpack them in the script block:
  process test {
      
      input:
      each triple from para1
      
      script: 
      def (m, k, l) = triple
      
      """
      echo "${m} ${k} ${l}"
      """
  }
  
  Consider also that the merge operator is deprecated and will be removed from future Nextflow releases. Instead, you may need to join by index, for example:
  def indexedChannel( items ) {
      return Channel.from( items.withIndex() ).map { item, idx -> tuple( idx, item ) }
  }
  
  k_ch = indexedChannel( [ 15, 20, 21 ] )
  m_ch = indexedChannel( [ 'a', 'b', 'c' ] )
  l_ch = indexedChannel( [ 1, 2, 3 ] )
  
  m_ch
      .join( k_ch )
      .join( l_ch )
      .map { idx, m, k, l -> tuple( m, k, l ) }
      .into { para1; para2 }
  
  
original_text: 3839: <p>I need to merge multiple channel to reuse them in two processes. So far I tried as follows:</p>
  <pre><code>channel.from([15,20,21]).into {k1;k2}
  channel.from(['a','b','c']).into {m1;m2}
  channel.from([1,2,3]).into {l1;l2}
  para1=m1.merge(k1).merge(l1)
  para2=m2.merge(k2).merge(l2)
  process p1{
  input:
  each m, k, l from para1
  &quot;&quot;&quot;
  echo <span class="math-container">$m, $</span>k, <span class="math-container">$l
  """
  }
  process p2{
  input:
  each m, k, l from para2
  """
  echo $m, $k, $</span>l
  &quot;&quot;&quot;
  }
  </code></pre>
  <p>The error I am getting:</p>
  <pre><code>Unknown process directive: '_in_each'
  
  Did you mean of these?
      each
  </code></pre>
  <p>If I use para1.view() I can see the merged elements as expected. Any help</p>
   10775: <p>I don't think you can unpack tuples using the <a href="https://www.nextflow.io/docs/latest/process.html#input-repeaters" rel="nofollow noreferrer">each</a> qualifier like that. You can, however, unpack them in the script block:</p>
  <pre><code>process test {
      
      input:
      each triple from para1
      
      script: 
      def (m, k, l) = triple
      
      &quot;&quot;&quot;
      echo &quot;<span class="math-container">${m} $</span>{k} ${l}&quot;
      &quot;&quot;&quot;
  }
  </code></pre>
  <p>Consider also that the <a href="https://www.nextflow.io/docs/latest/operator.html#merge" rel="nofollow noreferrer">merge</a> operator is deprecated and will be removed from future Nextflow releases. Instead, you may need to <a href="https://www.nextflow.io/docs/latest/operator.html#join" rel="nofollow noreferrer">join</a> by index, for example:</p>
  <pre><code>def indexedChannel( items ) {
      return Channel.from( items.withIndex() ).map { item, idx -&gt; tuple( idx, item ) }
  }
  
  k_ch = indexedChannel( [ 15, 20, 21 ] )
  m_ch = indexedChannel( [ 'a', 'b', 'c' ] )
  l_ch = indexedChannel( [ 1, 2, 3 ] )
  
  m_ch
      .join( k_ch )
      .join( l_ch )
      .map { idx, m, k, l -&gt; tuple( m, k, l ) }
      .into { para1; para2 }
  </code></pre>
  