Hi, My subworkflow uses a module with a specific c...
# tools
y
Hi, My subworkflow uses a module with a specific configuration. It uses https://github.com/nf-core/modules/blob/master/modules/nf-core/picard/scatterintervalsbyns/main.nf where task.ext.args should always be
OUTPUT_TYPE=ACGT
, is there a way to set this specific config when people install this subworkflow ?
a
What follows is a personal recommendation and I’m not sure if nf-core has official guidance on this right now. The best thing would be to put it into a config file that goes alongside the subworkflow. The user will still need to include this manually after install but it’s probably the best solution for now. To ensure it only applies to the module being used within the subworkflow (and doesn’t clash with another invocation of a module in someone’s pipeline) then you should set the config using a partially qualified module
withName
e.g.
Copy code
process {
    withName: ".*SUBWORKFLOW_NAME:PICARD_SCATTERINTERVALSBYNS" {
        ext.args = "OUTPUT_TYPE=ACGT"
    }
}
The wildcard at the start is necessary as a catch-all for whatever the fully-qualified name will be in peoples’ pipelines.
👍 3
y
@Arthur ok, thanks. So for now, there is still a manual operation that is needed . ✅
s
<!subteam^S044DU0NG68>, something we should think about. The
bam_ngscheckmate
subworkflow has a similar requirement for the args for bcftools, although it looks like it was moved into the tests folder during the nf-test conversion; I think we should move that back out to the subworkflow base (and have a separate config for the tests potentially)
👍 1
party this 1
u
nf-core tools can automate this one. If there is a nextflow.config file in next to the module or workflow main.nf, nf-core tools can detect that post installation and inject its path into the pipeline nextflow.config before including modules.config. This will show up in the git diff so the developer will know that there is a default file. I have also seen a case where this is needed.
👍 2
a
I don't like the idea of tools modifying pipeline code personally
💯 1
s
It could print it to the console, like how it gives you the
include
statement
💯 2
u
Yes, I was typing the same.
a
I believe that if you have a custom config alongside your module or subworkflow tools currently prints the required
includeConfig
line (I wrote that code so I hope it's there!)
🙌 1
m
Brillant idea
s
Ok, so Arthur has already done the thing that needs to be done?
Well, I guess that makes it easier 😉
y
I'm a little bit lost. Is there anywhere a working example for that one please ?
a
line 185 here is the relevant code. Seems it's only switched on for subworkflows and only if the config is called
nextflow.config
s
@yokofakun, give me a few minutes to fix bam_ngscheckmate and then you'll have an example. But basically just put a nextflow.config file with the subworkflow main.nf file and the nf-core tools will automatically tell people they need to include that extra config. I'd suggest we also add something to the meta.yml or the workflow to make it clear too
👏 1
y
@Arthur thanks. As far as I understand, I should just write a nextflow.config file under my subworkflows/dir1/dir2/main.nf and it will be used to configure the tool used in my subworkflow.
@Simon Pearce thanks
s
✅ 1
👍 1