nextflow-io / nextflow

A DSL for data-driven computational pipelines
http://nextflow.io
Apache License 2.0
2.71k stars 621 forks source link

Undocumented behavior - Duplicated workflow parameters when using specific naming conventions #4990

Closed JaimeSeqLabs closed 1 day ago

JaimeSeqLabs commented 4 months ago

Bug report

Expected behavior and actual behavior

Expected behavior: When running a workflow with a -params-file in json format, I expect the params property to contain only the provided keys set in the json file.

Actual behavior: While the key (and values) set in the parameters file are accessible through the params property to the workflow, additional parameters are being added with a key derived from the original one. This only happens if the parameter are named using camel case and/or kebab case naming conventions (i.e. camelCase, kebab-case). When setting a parameter named testParam nextflow will add an additional test-param parameter to params property that was not present in the file.

Steps to reproduce the problem

Create nextflow and parameters file:

main.nf:

workflow {
    log.info "Params map: $params"
}

params.json:

{
    "camelCase": "test",
    "kebab-case": "test",
    "normal": "test"
}

Run the nf file with the parameters file:

$> nextflow run main.nf -params-file params.json 

Program output

N E X T F L O W  ~  version 22.10.2
Launching `main.nf` [lethal_laplace] DSL2 - revision: 47784e7723
Params map: [camelCase:test, camel-case:test, kebab-case:test, kebabCase:test, normal:test]

Notice that the camel case and kebab case parameters are duplicated while the "normal" parameter is not.

Environment

bentsherman commented 4 months ago

Should be addressed by #4702 . Any kebab-case param from the CLI should be converted to camelCase and not stored, since kebab case params can't be accessed from the script anyway