Skip to main content

Passing Parameters

Nextflow can pass parameters to the pipeline using both command-line options and through config files. Config files are useful for passing multiple arguments and helps to make the command invocation shorter. Config files also helps with reusing the same parameters across multiple runs. Nextflow parameter passing is based on priorities so higher priority parameters can override defaults passed by lower priority options. This is the priority list that Nextflow will follow from highest to lowest:

  1. Parameters specified on the command-line (--something value)
  2. Parameters provided using the -params-file option
  3. Parameters specified in a configuration file specified using the -c my_config option
  4. Parameters specified in a config file named nextflow.config in the current directory

How to Pass Parameters

On the Command-line

Passing parameters on the command-line has the highest priority and can be used to override any other parameter. All parameters passed to the pipeline use double dashes (--).

nextlow run nf-core/pixelator -profile docker
--input samplesheet.csv \
--demux_mismatches 0.2 \
--max_size 5000

Using -params-file

Nextflow can pass arguments through a YAML or JSON file instead of passing everything on the command-line. The same command as above can be written as follows:

nextflow run nf-core/pixelator -profile docker -params-file nf-params.yml

Notice that we use a single dash (-) for the -params-file argument. This is because this is a core nextflow parameter and not a pipeline specific parameter.

where the nf-params.yaml file to create should have the following content:

input: samplesheet.csv
demux_mismatches: 0.2
max_size: 5000

The available keys that can be written to this config file match the command-line arguments, without double dashes (--). You can see all available parameters in the pipeline parameter documentation or the assets/nf-params.yml file in the nf-core/pixelator source code that you can download from here too. This way, you can obtain a default parameters YAML file with inline documentation that you can use as a template that is easy to adapt for your different projects.

Using a Nextflow Config File

Nextflow can read parameters from a nextflow configuration file that is either passed explicitly with the -c <path> flag or will also read any configuration file called nextflow.config on the same directory where the nextflow command is executed. All nextflow parameters defined in config files are defined under the params scope.

params {
input = samplesheet.csv
demux_mismatches = 0.2

We supply a default .config configuration for nf-core/pixelator that you can copy, modify and reuse across your projects with the nf-core/pixelator source code. If you have not cloned the nf-core/pixelator repository, you can download the default config file using this link.

Nextflow .config configuration files can be used to fine-tune many settings of the nf-core/pixelator pipeline and the execution engine. They are not only limited to just passing pipeline parameters. See the nextflow documentation for more information.