Max Cummins
11/05/2025, 3:23 PMdef args = task.ext.args ?: ''
for example, something similar to:
include { RASUSA as LONG_RASUSA } from '../../../modules/nf-core/rasusa'
workflow DOWNSAMPLING {
take:
long_reads_ch // channel: [ val(meta), long_reads ]
main:
LONG_RASUSA (
long_reads_ch,
100,
args: "--seed 1"
)
or
include { RASUSA as LONG_RASUSA } from '../../../modules/nf-core/rasusa'
def long_rasusa.ext.args = "--seed 1"
workflow DOWNSAMPLING {
take:
long_reads_ch // channel: [ val(meta), long_reads ]
main:
LONG_RASUSA (
long_reads_ch,
100
)
I want to avoid using conf/modules.config or modifying/patching the underlying moduleIgor Trujnara
11/05/2025, 3:39 PMmodules.config ? It is the file meant for this specific useMax Cummins
11/05/2025, 3:47 PMMax Cummins
11/05/2025, 3:49 PMmodules.config , but I want to maximise subworkflow portability, and not every nf-core *module*** is fit for my needs.
Patching of modules is also a pipeline level function. I also don't want to clone modules for a given subworkflow to add a single argumentIgor Trujnara
11/05/2025, 3:54 PMnextflow.config included inside the subworkflow file. Cf. documentation here.Max Cummins
11/05/2025, 3:54 PMmodules.config?Max Cummins
11/05/2025, 3:56 PMworkflow directive at the start I have added confusion in my choice of language 😛Max Cummins
11/05/2025, 3:56 PMMax Cummins
11/05/2025, 3:56 PMnextflow.config can indeed inject similarly to modules.config at the pipeline levelMax Cummins
11/05/2025, 3:56 PMAlexander Nater
11/05/2025, 3:57 PMnf-test. I don't see how that would work for your actual pipeline subworkflow invokation.Max Cummins
11/05/2025, 4:08 PMnextflow.config including module level arguments in the same fashion as a modules.configMax Cummins
11/05/2025, 4:09 PMmodules.config , but I presume they could just as easily be defined there rather than inheritedMax Cummins
11/05/2025, 4:09 PMAlexander Nater
11/05/2025, 4:12 PMincludeConfig for every imported subworkflow to your main nextflow.config.Max Cummins
11/05/2025, 4:12 PMMax Cummins
11/05/2025, 4:13 PMMax Cummins
11/05/2025, 4:14 PMprocess {
withName: 'MODULEA' {
ext.args = "--arg1 abc"
}
}
Can you just add that atop the subworkflow I wonderMax Cummins
11/05/2025, 4:15 PMinclude { RASUSA as LONG_RASUSA } from '../../../modules/nf-core/rasusa'
process {
withName: 'LONG_RASUSA' {
ext.args = "--seed 1"
}
}
workflow DOWNSAMPLING {
take:
long_reads_ch // channel: [ val(meta), long_reads ]
main:
LONG_RASUSA (
long_reads_ch,
100
)Max Cummins
11/05/2025, 4:16 PMERROR ~ Module compilation error
- file : /mnt/blockvolume/readqc/subworkflows/local/downsampling/main.nf
- cause: Process definition syntax error -- A string identifier must be provided after the `process` keyword @ line 4, column 8.
process {
^
1 error
-- Check script 'workflows/readqc.nf' at line: 11 or see '.nextflow.log' file for more detailsAlexander Nater
11/05/2025, 4:17 PMMax Cummins
11/05/2025, 4:19 PMext.args likely become global (and potentially clash) after being included in the top level config via includeConfigAlexander Nater
11/05/2025, 4:21 PMMax Cummins
11/05/2025, 4:22 PMnextflow.config)
process {
withName: 'LONG_RASUSA' {
ext.args = "--seed 1"
}
}
instead of
process {
withName: 'RASUSA' {
ext.args = "--seed 1"
}
}Max Cummins
11/05/2025, 4:22 PMinclude { RASUSA as SHORT_RASUSA } from '../../../modules/nf-core/rasusa'
include { RASUSA as LONG_RASUSA } from '../../../modules/nf-core/rasusa'Max Cummins
11/05/2025, 4:23 PMworkflow DOWNSAMPLING {Alexander Nater
11/05/2025, 4:24 PMprocess {
withName: 'DOWNSAMPLING:LONG_RASUSA' {
ext.args = "--seed 1"
}
}Max Cummins
11/05/2025, 4:25 PMMax Cummins
11/05/2025, 4:25 PMAlexander Nater
11/05/2025, 4:25 PMMax Cummins
11/05/2025, 4:26 PMMax Cummins
11/05/2025, 4:26 PMArthur
11/06/2025, 1:32 AMtask.ext.args but not sure if a better solution has emerged yet).
Given that a user of a subworkflow has to manually include the actual subworkflow I have never considered it particularly onerous that they should need to also include an associated config file.
Something I would not though, is that I don’t think Alexander’s example will work quite as expected. AFAIK Nextflow expects process name selectors to be either the process name alone (no :), or to match the fully qualified name.
If DOWNSAMPLING is intended to be used as a subworkflow to be included in other workflows then the fully qualified name may not match DOWNSAMPLING:LONG_RASUSA.
Instead you should pattern match on the subworkflow name:
process {
withName: '(.*:)?DOWNSAMPLING:LONG_RASUSA' {
ext.args = "--seed 1"
}
}
This will then allow the config to match e.g. MYPIPELINE:DOWNSAMPLING:LONG_RASUSA
Unfortunately this does not work if someone includes a subworkflow under an alias. e.g.
include { DOWNSAMPLING as DS } from '../downsampling.nf'
This differs from the historic behaviour of processes where the config would be applied if it matched the original name as well as if it matched the alias.Max Cummins
11/07/2025, 9:34 AM