carpentries-incubator / workflows-nextflow

Workflow management with Nextflow and nf-core
https://carpentries-incubator.github.io/workflows-nextflow/
Other
19 stars 29 forks source link

Nextflow configuration #37

Closed mahesh-panchal closed 3 months ago

mahesh-panchal commented 2 years ago

When configuring workflows, need to explain that workflow parameters should be overriden in a file params.yml and passed to -params-file, instead of using -c with a custom config. There is an important distinction here since params are evaluated immediately as they are read in.

ggrimes commented 2 years ago

What would be a good example of setting params in a config file?

mahesh-panchal commented 2 years ago

nextflow.config:

params.outdir = 'results'
params.publish_mode = 'copy'
process.publishDir = [ path: params.outdir, mode: params.publish_mode ]

Now I want to override the params.publish_mode, so I do -c custom.config with: custom.config:

params.publish_mode = 'symlink'

However, my publishDir still receives params.publish_mode = 'copy' because the values are resolved immediately. To make it work I should update the parameters instead using a -params-file params.yml. params.yml:

publish_mode: 'symlink'

This now works because of how configuration priority is evaluated.