Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Passing a quoted string starting with - to nextflow CLI has unexpected behaviour #5376

Open
cjw85 opened this issue Oct 7, 2024 · 1 comment

Comments

@cjw85
Copy link
Contributor

cjw85 commented Oct 7, 2024

Bug report

Expected behavior and actual behavior

I would anticipate that passing arguments such as --minimap2_args '-k15' would result in the parameter minimap2_args being set to the string -k15. However, nextflow complains:

Unknown option: -k15 -- Check the available commands and options and syntax with 'help'

Note that the situation is different if the user provides --minimap2_args '-k 15'. The paramater is set to the string -k 15 as expected, so it is not simply that anything starting with '- is taken as an argument for nextflow itself.

Steps to reproduce the problem

nextflow run epi2me-labs/wf-transcriptomes \
        --de_analysis \
        --direct_rna \
        --fastq 'wf-transcriptomes-demo/differential_expression_fastq' \
        --minimap2_index_opts '-k15' \
        --ref_annotation 'wf-transcriptomes-demo/gencode.v22.annotation.chr20.gtf' \
        --ref_genome 'wf-transcriptomes-demo/hg38_chr20.fa' \
        --sample_sheet 'wf-transcriptomes-demo/sample_sheet.csv' \
        -profile standard

Program output

Unknown option: -k15 -- Check the available commands and options and syntax with 'help'

There's no nextflow.log produced.

Environment

  • Nextflow version: version 24.04.4 build 5917
  • Java version: OpenJDK 64-Bit Server VM Temurin-17.0.8.1+1 (build 17.0.8.1+1, mixed mode)
  • Operating system: macOS
  • Bash version: zsh 5.9 (x86_64-apple-darwin23.0)

Additional context

There's a difference in behaviour compared to when the arguments are provided in a config file as:

params {
        de_analysis = true
        direct_rna = true
        fastq = 'wf-transcriptomes-demo/differential_expression_fastq'
        minimap2_index_opts = '-k15'
        ref_annotation = 'wf-transcriptomes-demo/gencode.v22.annotation.chr20.gtf'
        ref_genome = 'wf-transcriptomes-demo/hg38_chr20.fa'
        sample_sheet = 'wf-transcriptomes-demo/sample_sheet.csv'
}

Our users caught this as our documentation contains a CLI invocation built from the contents of the config file, we did not catch it in testing as our CI pipelines run nextflow -c config .... instead.

@bentsherman
Copy link
Member

Looks like the underlying CLI library (JCommander) prefers to parse -k15 as a CLI option instead of a parameter value. I believe this problem is solved by #3600 which adds a new CLI based on picocli, but ideally i would want to refactor the existing CLI to also use picocli, which would solve the problem here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants