Nested tuple as input

Hi all! I am trying to propagate the metadata through a process without using them. The problem is that both my input and output contain a tuple within a tuple. This gives the following error: Oct-22 15:18:31.502 [main] DEBUG nextflow.Session - Session aborted -- Cause: Unknown variable 'meta'. I pinpointed the origin to this process, but I’m not sure if this is the best way of handling tuples within tuples or inputs not used in the script. I couldn’t find in the docs similar examples either. This is how my process currently looks like:

process FOO {

    debug true

    input:
    tuple tuple(meta), path(foo)

    output:
    tuple tuple(meta), val(bar)

    script:
    // meta not used within the script
    .
    .
    .
}

Thanks for your help!

It shouldn’t be a problem to forward meta to the next process even if it wasn’t used in the script block. Can you share a minimal reproducible example?

Sure! Here it is:

process FOO {

    input:
    tuple tuple(meta), val(letter)

    output:
    tuple tuple(meta), val(letter)

    script:
    """
    
        """

}

workflow {    

    ch_ids = Channel.of("A", "B", "C")
    ch_nums = Channel.of(1, 2, 3)
    ch_letters = Channel.of("a", "b", "c")

    ch_input = ch_ids
        .merge(ch_nums, ch_letters) 
        .map { id, num, letter ->
            def meta = ["id": id, "num": num]
            ["meta": meta, "letter": letter]}

    FOO(ch_input)

}
1 Like

Okay I just noticed in the last code snippet of this training section that the meta tuple is declared as val instead of tuple in the input block, so it can be accessed by name within the process:

process ExampleProcess {
    input:
    tuple val(meta), path(reads)

    // ...

It works now with that modification. Thank you for your time!

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