Use $projectDir for -params-file option?

Running my nextflow pipeline directly from github via nextflow run bskubi/hich, I would like to write a tutorial in which the user specifies one of the preconfigured params files stored in the params subdirectory within the repo. It would be more elegant if I could have the user specify something like -params-file '$projectDir/params/onerep_bulk.yml', but Nextflow appears to interpret $projectDir literally when supplied at the command line. Is there a workaround so that I can specify files with respect to the cached project directory at the command line without spelling out the hidden path to the project directory?

Have you considered using configuration profiles for this?

profiles {
    onerep_bulk {
        params {
            ...
        }
    }
}

That’s a decent workaround. I’m still curious if there’s another way to reference a file though?

$projectDir is a variable in groovy context so it won’t be available via CLI. Only the config files run the code. The other inputs simply provide strings if command line parameters or more complex objects (string, number, map, list) if -params-file.

One can use nextflow info to get the local path but why make it complex for the user.

2 Likes