Skip to content

When and if not identical in behaviour #1004

@apeltzer

Description

@apeltzer

Bug report

I have a process called bwa_indexhere:

https://github.com/nf-core/eager/blob/master/main.nf#L379-L401

that I'd like to be executed whenever the when directive is true.
This worked fine, but I'm also filling the same channel when a user specifies input using a simple Channel.fromPath()....

Expected behavior and actual behavior

If I use the when directive, I get an error message:


[warm up] executor > local
ERROR ~ Channel `ch_bwa_index` has been used twice as an output by process `makeBWAIndex` and another operator

 -- Check script 'main.nf' at line: 375 or see '.nextflow.log' file for more details

When I replace the when with an if clause around the respective process, I get no error and everything works fine.

I do like to use when where possible but had also issues when mixing channels with the multiple index files being consumed once and then not being able to process more than just one sample.

I'm not sure what this behaviour means / what I can do about it or whether this is intended.

Environment

  • Nextflow version: latest stable (18.10.1)
  • Java version: 1.8
  • Operating system: OSX

Additional context

Working on this Pull Request atm: nf-core/eager#127

Problematic are calls that use the respective variable ch_bwa_index.

I create the references using this command for example (which simulates an entire run of the pipeline and is used by us to run the entire pipeline for testing purposes):

nextflow run . -profile test,docker --pairedEnd --saveReference

Now I can reproduce using the previously generated reference genome indices:

nextflow run . -profile test,docker --singleEnd --bwa_index results/reference_genome/bwa_index/

Ideally, I'd expect being able to use when and not having to take care that the ch_bwa_index isn't reached at all ...

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions