Step 16 - Where to put params
?
We want the output filename to be configurable. That means that we either use the params
map for this (and take care it is available in modules that are include
d) or we pass it to the process
as part of the input. Let us explore both scenarios.
But first, we need to understand a bit better where the contents of params
comes from. We already covered a few examples where we specify a params
key on the CLI. There is another way as well, via nextflow.config
. In it, we can add a scope params
and add the configuration there.
Let us reconsider the previous example (step15
) but this time add a nextflow.config
file like this (please update the <...>
part according to your situation):
params.input = “$PWD/data/input?.txt”
Let us illustrate the effect by means of two examples:
> nextflow -q run . -entry step15
WARN: DSL 2 IS AN EXPERIMENTAL FEATURE UNDER DEVELOPMENT -- SYNTAX MAY CHANGE IN FUTURE RELEASE
[input3, <...>/work/d3/3b7016780d0a10bc43a4a1e303edbc/output.txt]
[input1, <...>/work/e8/52a69a6234d9008041151f0ddaea06/output.txt]
[input2, <...>/work/c9/ff527e7934c309ec34ee4fabdf0654/output.txt]
> nextflow -q run . -entry step15 --input data/input1.txt
WARN: DSL 2 IS AN EXPERIMENTAL FEATURE UNDER DEVELOPMENT -- SYNTAX MAY CHANGE IN FUTURE RELEASE
[input1, <...>/work/4a/9479b71506cc1ca0c536ad587498af/output.txt]
In other words, params
can be defined in nextflow.config
but if it appears on the CLI then the latter gets priority. Please be reminded that params
is a map, the following is equivalent:
params {
input = "/.../diflow/data/*.txt"
}