Skip to content

Cryptic Issue with params assignment in maps keys #6289

@VasLem

Description

@VasLem

Bug report

This bug took me so long to identify, and it caused my pipeline to infinitely freeze. Here is a minimum example:

params.reference = 'hg38'
params.flank = ""
params.test = 'test'

workflow{
    def x = "ensembl.annot.genes.flanked${params.flank}"
    def test = params.test
    def ids = ['ensembl.annot.genes',x, test]
    reference = channel.value(params.reference)
    files = reference.map { ref -> ids.collect { id -> [id, "${ref}.${id}.bed"] }.collectEntries() }
    files.map { it-> {
        println "trying to get ${x} from ${it}: ${it[x]}"}}
    files.map { it-> {
        println "trying to get ${test} from ${it}: ${it[test]}"}}
        
}

Expected behavior and actual behavior

Expected:

trying to get ensembl.annot.genes.flanked from [ensembl.annot.genes:hg38.ensembl.annot.genes.bed, ensembl.annot.genes.flanked:hg38.ensembl.annot.genes.flanked.bed, test:hg38.test.bed]: hg38.ensembl.annot.genes.flanked.bed
trying to get test from [ensembl.annot.genes:hg38.ensembl.annot.genes.bed, ensembl.annot.genes.flanked:hg38.ensembl.annot.genes.flanked.bed, test:hg38.test.bed]: hg38.test.bed

Actual:

trying to get ensembl.annot.genes.flanked from [ensembl.annot.genes:hg38.ensembl.annot.genes.bed, ensembl.annot.genes.flanked:hg38.ensembl.annot.genes.flanked.bed, test:hg38.test.bed]: null
trying to get test from [ensembl.annot.genes:hg38.ensembl.annot.genes.bed, ensembl.annot.genes.flanked:hg38.ensembl.annot.genes.flanked.bed, test:hg38.test.bed]: hg38.test.bed

The reason why my pipeline froze is that there is another bug, when merging with a null channel, that makes it infinitely wait. It is enough to add this line after the workflow above to reproduce this infinite wait:

out = files.map{it->it[x]}.merge(channel.value('hi'))

Environment

  • Nextflow version: 25.04.6

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions