From 30e534bc7eb58b7ea630e8496df7cb87a1bc96a1 Mon Sep 17 00:00:00 2001 From: Simon Pearce <24893913+SPPearce@users.noreply.github.com> Date: Tue, 2 Jul 2024 16:57:43 +0100 Subject: [PATCH 1/2] Add comment about setting a default prefix that isn't just meta.id --- .../docs/src/content/docs/guidelines/components/modules.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/sites/docs/src/content/docs/guidelines/components/modules.md b/sites/docs/src/content/docs/guidelines/components/modules.md index 687374ca8d..38b285767b 100644 --- a/sites/docs/src/content/docs/guidelines/components/modules.md +++ b/sites/docs/src/content/docs/guidelines/components/modules.md @@ -353,12 +353,17 @@ Channel names MUST follow `snake_case` convention and be all lower case. Output file (and/or directory) names SHOULD just consist of only `${prefix}` and the file-format suffix (e.g. `${prefix}.fq.gz` or `${prefix}.bam`). - This is primarily for re-usability so that other developers have complete flexibility to name their output files however they wish when using the same module. -- As a result of using this syntax, if the module has the same named inputs and outputs then you can add a line in the `script` section like below (another example [here](https://github.com/nf-core/modules/blob/e20e57f90b6787ac9a010a980cf6ea98bd990046/modules/lima/main.nf#L37)) which will raise an error asking the developer to change the `args.prefix` variable to rename the output files so they don't clash. +- As a result of using this syntax, if the module could _potentially_ have the same named inputs and outputs add a line in the `script` section like below (another example [here](https://github.com/nf-core/modules/blob/e20e57f90b6787ac9a010a980cf6ea98bd990046/modules/lima/main.nf#L37)) which will raise an error asking the developer to change the `args.prefix` variable to rename the output files so they don't clash. ```nextflow script: if ("$bam" == "${prefix}.bam") error "Input and output names are the same, set prefix in module configuration to disambiguate!" ``` +- If the input and output files are likely to have the same name, then an appropriate default prefix may be set, for example: + + ```nextflow + def prefix = task.ext.prefix ?: "${meta.id}_sorted" + ``` ## Input/output options From 9eee363dc9ea0d25a75876c0668f18b261d2415a Mon Sep 17 00:00:00 2001 From: Simon Pearce <24893913+SPPearce@users.noreply.github.com> Date: Tue, 2 Jul 2024 17:08:43 +0100 Subject: [PATCH 2/2] Update sites/docs/src/content/docs/guidelines/components/modules.md --- sites/docs/src/content/docs/guidelines/components/modules.md | 1 + 1 file changed, 1 insertion(+) diff --git a/sites/docs/src/content/docs/guidelines/components/modules.md b/sites/docs/src/content/docs/guidelines/components/modules.md index 38b285767b..5afdfaf230 100644 --- a/sites/docs/src/content/docs/guidelines/components/modules.md +++ b/sites/docs/src/content/docs/guidelines/components/modules.md @@ -359,6 +359,7 @@ Output file (and/or directory) names SHOULD just consist of only `${prefix}` and script: if ("$bam" == "${prefix}.bam") error "Input and output names are the same, set prefix in module configuration to disambiguate!" ``` + - If the input and output files are likely to have the same name, then an appropriate default prefix may be set, for example: ```nextflow