ext properties/keys

Ext properties or keys are special process directives (See: ext directive ) that insert strings into the module scripts. For example, an nf-core module uses the string assigned to ext.args ( or ext.args2, ext.args3, … ) to insert tool specific options in a module script:

Example:

The configuration

process {
  withName: 'TOOL_SUBTOOL' {
    ext.args = '-T -K'
  }
}

inserts the string -T -K as options to the module script:

process TOOL_SUBTOOL {
  input:
  tuple val(meta), path(bam)
 
  output:
  tuple val(meta), path("*.log"), emit: log
  path "versions.yml",            emit: versions
 
  script:
  def args   = task.ext.args ?: ''          // If ext.args is defined assign it to args
  def prefix = task.ext.prefix ?: meta.id   // If ext.prefix is defined assign it to prefix, otherwise assign meta.id value
  """
  tool subtool $args $bam > ${prefix}.log
  """
}

so the script becomes:

#! /usr/env/bin bash
tool subtool -T -K test.bam > test.log

Permitted ext keys

The following table lists the permitted keys used in nf-core modules. Other keys must be discussed with maintainers, and added here when permitted.

KeyDescription
ext.argsAdditional arguments appended to command in module.
ext.args2Second set of arguments appended to command in module.
ext.args3Third set of arguments appended to command in module.
ext.argsNNth set of arguments appended to command in module.
ext.prefixFile name prefix for output files.
ext.whenBoolean expression to determine when a module runs.
ext.use_gpuDetermines whether the module uses GPU settings.
ext.singularity_pull_docker_containerWhether to use the Docker URI instead of the Singularity URI under the singularity profile
Note

The order of the numeric ID of args must match the order of the tools as used in the module.

To see some more advanced examples of these keys in use see:

Rational

The ext keys are properties that are intended to allow a pipeline user to change via configuration file how a module behaves. They are not a means for a developer to bypass passing values via a module’s input:. The majority of optional command-line flags are passed through ext.args. If changing an ext key would lead to pipeline instability, it should be an input:. This allows module parameters to be fully described and documented.