# Multi-channel output cannot be applied to operator combine

**URL:** <https://community.seqera.io/t/multi-channel-output-cannot-be-applied-to-operator-combine/1248>\
**Category:** Ask for help\
**Tags:** nextflow\
**Created:** [October 2, 2024, 5:11pm UTC](https://community.seqera.io/t/multi-channel-output-cannot-be-applied-to-operator-combine/1248 "2024-10-02T17:11:34Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![lisalamberte](https://dub1.discourse-cdn.com/flex013/user_avatar/community.seqera.io/lisalamberte/32/1104_2.png) [@lisalamberte](https://community.seqera.io/u/lisalamberte)\
**Post date:** [October 2, 2024, 5:11pm UTC](https://community.seqera.io/t/multi-channel-output-cannot-be-applied-to-operator-combine/1248/1 "2024-10-02T17:11:34Z")

</div>

Hi everyone, I’m trying to develop a bespoke tool for extracting sequences using Nextflow. Currently, I have this workflow:

```auto
workflow {
    // Define the input channels
    assembly_ch = Channel.fromPath(params.assemblies)
                         .ifEmpty { error "Cannot find any assemblies matching: ${params.assemblies}" }

    query_ch = Channel.value(params.query)

    // Create BLAST database for each assembly
    blastdb_ch = assembly_ch | createBlastDB

    // Move BLAST databases to the final directory
    blastdb_ch | moveBlastDB

    // Combine BLAST databases and query for the search process
    blast_results_ch = blastdb_ch.combine(query_ch) | runBlastSearch

    // Split the tuple into unfiltered and filtered BLAST results
    blast_results_unfiltered_ch = blast_results_ch.map { it[0] }
    blast_results_filtered_ch = blast_results_ch.map { it[1] }

    // Move unfiltered BLAST results to "02_blastoutput"
    blast_results_unfiltered_ch | moveBlastOutput

    // Move filtered BLAST results to "03_blastoutput_filtered"
    blast_results_filtered_ch | moveFilteredBlastOutput

    // Extract sequences based on the filtered BLAST results
    blast_results_filtered_ch.map { filtered_out ->
        def base_name = filtered_out.baseName.replace("_vs_", "_blastdb_")
        def fasta_file = "blastdb/${base_name}/${base_name}.fasta"
        return tuple(filtered_out, fasta_file)
    } | extractSequences

```

But I always get an error that is: “Multi-channel output cannot be applied to operator combine for which argument is already provided”. I’ve tried many things to address this, but it seems that I’ve hit a well. Can anyone help?

---

<div class="post-metadata">

**Author:** ![mahesh.binzerpanchal](https://dub1.discourse-cdn.com/flex013/user_avatar/community.seqera.io/mahesh.binzerpanchal/32/253_2.png) [@mahesh.binzerpanchal](https://community.seqera.io/u/mahesh.binzerpanchal)\
**Post date:** [October 2, 2024, 7:30pm UTC](https://community.seqera.io/t/multi-channel-output-cannot-be-applied-to-operator-combine/1248/2 "2024-10-02T19:30:22Z")

</div>

You get this because your process `createBlastDB` likely defines more than one output channel.

Use the `emit:` keyword to label output channels and select specifically which you want to use.

```nextflow
workflow {
    task_ch = TASK().csv
    task_ch.combine(
        Channel.value(1)
    ).view()
}

process TASK {
    script:
    """
    touch sample.{csv,tsv}
    """

    output:
    path 'sample.csv', emit: csv
    path 'sample.tsv', emit: tsv
}

```

If the `.csv` is left off, you’ll get the error you’ve seen.

Since it seems your `moveBlastDB` also takes more than one channel as input too, another option is to change the `blastdb_ch.combine(query_ch)` to

```nextflow
blastdb_ch.<ch_name>.combine(query_ch) // If you use emit:

```

or

```nextflow
blastdb_ch[index].combine(query_ch) // where index is the index of the channel starting at 0

```

---

<div class="post-metadata">

**Author:** ![lisalamberte](https://dub1.discourse-cdn.com/flex013/user_avatar/community.seqera.io/lisalamberte/32/1104_2.png) [@lisalamberte](https://community.seqera.io/u/lisalamberte)\
**Post date:** [October 24, 2024, 5:05pm UTC](https://community.seqera.io/t/multi-channel-output-cannot-be-applied-to-operator-combine/1248/3 "2024-10-24T17:05:51Z")

</div>

That’s great, thanks very much. When I incorporated your suggestions to the script, it’s now working.

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/flex013/user_avatar/community.seqera.io/system/32/2402_2.png) [@system](https://community.seqera.io/u/system)\
**Post date:** [October 31, 2024, 5:05pm UTC](https://community.seqera.io/t/multi-channel-output-cannot-be-applied-to-operator-combine/1248/4 "2024-10-31T17:05:53Z")

</div>

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.
