nextflow icon indicating copy to clipboard operation
nextflow copied to clipboard

Spread operator mishandles Iterable values provided as a dataflow variable

Open msmootsgi opened this issue 9 years ago • 3 comments

In some (apparently rare) cases, the spread operator will take a file and instead of spreading the file to other channel, split the filename string on the directory separator and then spread the elements of the path over the other channel instead. Here is a failing test case:

Channel.from(1,2,3).into{ data }

process symlink {

    output:
    file(db) into db_file

    script:
    infile = "/home/msmoot/try/nextflow_stuff/some_db/db.txt"
    db = "DB"
    """
    ln -s ${infile} ${db}
    """
}

data.spread( db_file ).view()

And here is the output I see when I run it:

$ nextflow run spreadache4.nf 
N E X T F L O W  ~  version 0.24.3
Launching `spreadache4.nf` [pensive_hamilton] - revision: 778a839dbb
[warm up] executor > local
[b4/baafb5] Submitted process > symlink
[1, home]
[1, msmoot]
[1, try]
[1, nextflow_stuff]
[1, work]
[1, b4]
[1, baafb545b7306f07f8f7585d1b0a76]
[1, DB]
[2, home]
[2, msmoot]
[2, try]
[2, nextflow_stuff]
[2, work]
[2, b4]
[2, baafb545b7306f07f8f7585d1b0a76]
[2, DB]
[3, home]
[3, msmoot]
[3, try]
[3, nextflow_stuff]
[3, work]
[3, b4]
[3, baafb545b7306f07f8f7585d1b0a76]
[3, DB]

msmootsgi avatar May 26 '17 20:05 msmootsgi

I believe this bug appeared in the 0.23 release. Pipelines that had no problems with spread in 0.22 and earlier suddenly started manifesting this behavior with 0.23.

msmootsgi avatar May 26 '17 20:05 msmootsgi

The easy workaround is changing spread to combine and life is good again.

msmootsgi avatar May 26 '17 20:05 msmootsgi

It turns out there was a bug in the spread operator when applied to a dataflow variable instead of a dataflow queue.

pditommaso avatar Jun 02 '17 18:06 pditommaso