Skip to content

Allow custom configs params to be parsed before nextflow.config #2662

@mahesh-panchal

Description

@mahesh-panchal

New feature

I'm not sure whether to classify this as a feature request or bug.
The issue is that params configuration from custom configs (-c) appears to be read in after nextflow.config.
The docs describe that params provided in a custom config have a higher priority than those in the nextflow.config. This is true at the time of running the workflow, but not when parsing and evaluating the conditions in the Nextflow config.

For example:
main.nf:

#! /usr/bin/env nextflow

nextflow.enable.dsl = 2

workflow {
    FOO()
}

process FOO {

    output:
    path 'myfile.txt'

    script:
    """
    touch myfile.txt
    """
}

nextflow.config:

params.outdir = 'results'
process {
    withName: 'FOO' {
        publishDir = "$params.outdir/foo"
    }
}

If one runs:

$ nextflow run main.nf --outdir '/my/new/path'

or

$ cat params.yml
outdir : '/my/new/path'
$ nextflow run main.nf -params-file params.yml

Then the publishDir is correctly set.

However, if one uses

$ cat custom.config
params.outdir = '/my/new/path'
$ nextflow run main.nf -c custom.config

Then the publishDir is not correct, instead using the default value.

Usage scenario

Lot's of Nextflow users currently provide custom params via the -c option, not realizing it is not applying to configuration in the nextflow.config.

Suggest implementation

Perhaps read in any custom configs in the order described by the docs before and implement the configuration evaluation in such a way that if the keys are already present, don't override them.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions