From 790e980f4153441147fb1e3b6ef5f3a3905dd1de Mon Sep 17 00:00:00 2001 From: kevinmenden Date: Fri, 16 Apr 2021 10:47:59 +0200 Subject: [PATCH 1/5] fixed bug #1011 --- CHANGELOG.md | 1 + nf_core/module-template/software/main.nf | 2 +- nf_core/modules/create.py | 5 +++-- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 01325e390e..4ca5450c58 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ * Added a timestamp to the trace + timetime + report + dag filenames to fix overwrite issue on AWS * Rewrite the `params_summary_log()` function to properly ignore unset params and have nicer formatting [[#971](https://github.com/nf-core/tools/issues/971)] * Fix overly strict `--max_time` formatting regex in template schema [[#973](https://github.com/nf-core/tools/issues/973)] +* Added `tool_name_underscore` to the module template to allow TOOL_SUBTOOL in `main.nf` [[#1011](https://github.com/nf-core/tools/issues/1011)] ## [v1.13.3 - Copper Crocodile Resurrection :crocodile:](https://github.com/nf-core/tools/releases/tag/1.13.2) - [2021-03-24] diff --git a/nf_core/module-template/software/main.nf b/nf_core/module-template/software/main.nf index 6d6fabc8c8..c80ea5a038 100644 --- a/nf_core/module-template/software/main.nf +++ b/nf_core/module-template/software/main.nf @@ -20,7 +20,7 @@ include { initOptions; saveFiles; getSoftwareName } from './functions' params.options = [:] options = initOptions(params.options) -process {{ tool_name|upper }} { +process {{ tool_name_underscore|upper }} { tag {{ '"$meta.id"' if has_meta else "'$bam'" }} label '{{ process_label }}' publishDir "${params.outdir}", diff --git a/nf_core/modules/create.py b/nf_core/modules/create.py index 5c2253abf6..878528259f 100644 --- a/nf_core/modules/create.py +++ b/nf_core/modules/create.py @@ -33,9 +33,8 @@ def __init__( self.process_label = process_label self.has_meta = has_meta self.force_overwrite = force - - self.tool_conda_name = conda_name self.subtool = None + self.tool_conda_name = conda_name self.tool_licence = None self.repo_type = None self.tool_licence = "" @@ -116,6 +115,8 @@ def create(self): self.tool_name = f"{self.tool}/{self.subtool}" self.tool_dir = os.path.join(self.tool, self.subtool) + self.tool_name_underscore = self.tool_name.replace("/", "_") + # Check existance of directories early for fast-fail self.file_paths = self.get_module_dirs() From 6aae0b000b73f8f6570a2ce78f9de8fe38de4c80 Mon Sep 17 00:00:00 2001 From: kevinmenden Date: Fri, 16 Apr 2021 12:27:34 +0200 Subject: [PATCH 2/5] fix test.yml template --- nf_core/module-template/tests/main.nf | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/nf_core/module-template/tests/main.nf b/nf_core/module-template/tests/main.nf index d062eba787..a1276b800e 100644 --- a/nf_core/module-template/tests/main.nf +++ b/nf_core/module-template/tests/main.nf @@ -2,9 +2,9 @@ nextflow.enable.dsl = 2 -include { {{ tool_name|upper }} } from '../../../{{ "../" if subtool else "" }}software/{{ tool_dir }}/main.nf' addParams( options: [:] ) +include { {{ tool_name_underscore|upper }} } from '../../../{{ "../" if subtool else "" }}software/{{ tool_dir }}/main.nf' addParams( options: [:] ) -workflow test_{{ tool_name }} { +workflow test_{{ tool_name_underscore }} { {% if has_meta %} input = [ [ id:'test', single_end:false ], // meta map file(params.test_data['sarscov2']['illumina']['test_paired_end_bam'], checkIfExists: true) ] @@ -12,5 +12,5 @@ workflow test_{{ tool_name }} { input = file(params.test_data['sarscov2']['illumina']['test_single_end_bam'], checkIfExists: true) {%- endif %} - {{ tool_name|upper }} ( input ) + {{ tool_name_underscore|upper }} ( input ) } From 30c18b53112fcb972c0ce808ffaf1032c98f7155 Mon Sep 17 00:00:00 2001 From: kevinmenden Date: Fri, 16 Apr 2021 13:15:33 +0200 Subject: [PATCH 3/5] fixed test.yml template --- nf_core/module-template/tests/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nf_core/module-template/tests/test.yml b/nf_core/module-template/tests/test.yml index 8410f23c5d..ba807849cc 100644 --- a/nf_core/module-template/tests/test.yml +++ b/nf_core/module-template/tests/test.yml @@ -1,7 +1,7 @@ ## TODO nf-core: Please run the following command to build this file: # nf-core modules create-test-yml {{ tool }}{%- if subtool %}/{{ subtool }}{%- endif %} - name: {{ tool }}{{ ' '+subtool if subtool else '' }} - command: nextflow run ./tests/software/{{ tool_dir }} -entry test_{{ tool_name }} -c tests/config/nextflow.config + command: nextflow run ./tests/software/{{ tool_dir }} -entry test_{{ tool_name_underscore }} -c tests/config/nextflow.config tags: - {{ tool }} {%- if subtool %} From d15d4e6b1cea17318073d8b83bf9a66de7729bee Mon Sep 17 00:00:00 2001 From: kevinmenden Date: Fri, 16 Apr 2021 13:21:06 +0200 Subject: [PATCH 4/5] fix meta.yml template --- nf_core/module-template/software/meta.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nf_core/module-template/software/meta.yml b/nf_core/module-template/software/meta.yml index a5116432be..be6d3e5f93 100644 --- a/nf_core/module-template/software/meta.yml +++ b/nf_core/module-template/software/meta.yml @@ -1,4 +1,4 @@ -name: {{ tool_name }} +name: {{ tool_name_underscore }} ## TODO nf-core: Add a description of the module and list keywords description: write your description here keywords: From b9336f7132d5e027046706a9c5d3e9485f767128 Mon Sep 17 00:00:00 2001 From: kevinmenden Date: Fri, 16 Apr 2021 13:58:50 +0200 Subject: [PATCH 5/5] add newline to functions.nf --- nf_core/module-template/software/functions.nf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nf_core/module-template/software/functions.nf b/nf_core/module-template/software/functions.nf index 078fda9d21..9d0137e374 100644 --- a/nf_core/module-template/software/functions.nf +++ b/nf_core/module-template/software/functions.nf @@ -67,4 +67,4 @@ def saveFiles(Map args) { return "${getPathFromList(path_list)}/$args.filename" } } -} \ No newline at end of file +}