nextflow icon indicating copy to clipboard operation
nextflow copied to clipboard

two input variables with identical names are allowed

Open jgbaum opened this issue 1 year ago • 3 comments

Bug report

Nextflow seems to allow multiple input variables with identical names in the same process, which could lead to unexpected behavior.

Expected behavior and actual behavior

Nextflow should throw an error if a process contains multiple input variables with the same name.

Steps to reproduce the problem

Run the workflow below, which contains two input variables with the name 'sample_id'. This was originally taken from example 6.3.5 of the training documentation.

reads_ch = Channel.fromFilePairs('data/ggal/*_{1,2}.fq')

process FOO {
    input:
    tuple val(sample_id), path(sample_id)

    output:
    tuple val(sample_id), path('sample.bam')

    script:
    """
    echo your_command_here --reads $sample_id > sample.bam
    """
}

workflow {
    bam_ch = FOO(reads_ch)
    bam_ch.view()
}

Program output

N E X T F L O W  ~  version 22.10.7
Launching `processes.nf` [insane_goldstine] DSL2 - revision: 11430b8ce3
executor >  local (3)
[25/dbc431] process > FOO (2) [100%] 3 of 3 ✔
[[lung_1.fq, lung_2.fq], /Users/jgbaum/odrive/GDrive_LJI/_current_work/nextflow-training/random-scripts/work/b2/d2f9a3991d8f08d840546d2d80469c/sample.bam]
[[liver_1.fq, liver_2.fq], /Users/jgbaum/odrive/GDrive_LJI/_current_work/nextflow-training/random-scripts/work/c6/4905e0a1adf807ff156fc0dfff6d16/sample.bam]
[[gut_1.fq, gut_2.fq], /Users/jgbaum/odrive/GDrive_LJI/_current_work/nextflow-training/random-scripts/work/25/dbc4314edaca84665b1a89d57f4caa/sample.bam]

Environment

  • Nextflow version: 22.10.7
  • Java version: 17.0.6
  • Operating system: macOS 13.3.1
  • Bash version: zsh 5.9 (x86_64-apple-darwin22.0)

Additional context

This was originally raised in the nextflow training repo: https://github.com/nextflow-io/training/issues/231

jgbaum avatar Apr 17 '23 00:04 jgbaum