<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>

CC BY-SA 4.0
2021-04-02T14:17:01.733Z
Thanks `@Steve`. Personally I liked merge option (fewer lines). The processes ran without any error but how could I see the outputs?
zillur rahman
CC BY-SA 4.0
2021-04-03T11:51:39.297Z
No worries @zillurrahman. The test process above will just echo to stdout and this should be captured in the '.command.out' files in the process work dir. HTH.
Steve
CC BY-SA 4.0
2021-04-02T11:16:38.077Z
2021-04-02T11:16:38.077Z
Steve
<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>

<nextflow>
Input from multiple channel, merge and use in nextflow
# Input from multiple channel, merge and use in nextflow

(Asked by: username_0 on 2021-04-02)

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

**Tags:** nextflow

---

## 1 answers

### Answer by username_1 on 2021-04-02. Score: 2 | Accepted answer

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 }

> **Comments:**
> **username_0**: Thanks `@Steve`. Personally I liked merge option (fewer lines). The processes ran without any error but how could I see the outputs?  
> **username_1**: No worries @zillurrahman. The test process above will just echo to stdout and this should be captured in the '.command.out' files in the process work dir. HTH.  

---

