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

camelCase params duplicated with hypens #2061

Closed
ewels opened this issue Apr 23, 2021 · 5 comments
Closed

camelCase params duplicated with hypens #2061

ewels opened this issue Apr 23, 2021 · 5 comments

Comments

@ewels
Copy link
Member

ewels commented Apr 23, 2021

Bug report

Expected behavior and actual behavior

When using a param with camelCase, a duplicated copy is made with hyphens (camel-case). I've never noticed this before, but the new @nf-core schema validation now warns about these params as they are unexpected.

Expected behaviour would be to, well, not do this. 😀

Steps to reproduce the problem

params.snake_case = 'foo'
params.camelCase = 'bar'
params.multiCamelCaseParam = 'baz'

println(params)

Program output

$ nextflow run main.nf
N E X T F L O W  ~  version 21.03.0-edge
Launching `main.nf` [elegant_euler] - revision: b5f0bc6361
[snake_case:foo, camelCase:bar, camel-case:bar, multiCamelCaseParam:baz, multi-camel-case-param:baz]

More readable:

  • snake_case: foo
  • camelCase: bar
  • camel-case: bar
  • multiCamelCaseParam: baz
  • multi-camel-case-param: baz

'cc @KevinMenden @Leon-Bichmann

@pditommaso
Copy link
Member

Yes, this was a choice made in the early days, I admin, not one of the best.

@ewels
Copy link
Member Author

ewels commented Apr 26, 2021

What's more confusing is that the nextflow config command doesn't do this, only nextflow run:

nextflow.config:

params {
    snake_case = 'foo'
    camelCase = 'bar'
    multiCamelCaseParam = 'baz'
}

main.nf:

println(params)
$ nextflow config -flat .
params.snake_case = 'foo'
params.camelCase = 'bar'
params.multiCamelCaseParam = 'baz'

$ nextflow run .
N E X T F L O W  ~  version 21.03.0-edge
Launching `./main.nf` [happy_brattain] - revision: ec72fcbcb3
[snake_case:foo, camelCase:bar, camel-case:bar, multiCamelCaseParam:baz, multi-camel-case-param:baz]

This is actually a good thing in our case, as it means that we only need to add a workaround in the pipeline schema validation at run time, and don't need to patch any of the code in nf-core/tools that builds stuff with the output of nextflow config.

Phil

@pditommaso
Copy link
Member

I think it should be fixed with a big note in the cli docs

@pditommaso
Copy link
Member

Done ebfed09

@ewels
Copy link
Member Author

ewels commented May 2, 2021

Thank you!

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