From 551a888ffcf94c8b865b2505636a747472f546e0 Mon Sep 17 00:00:00 2001 From: John Adeyemo Adedeji Date: Sun, 17 May 2026 16:29:10 +0100 Subject: [PATCH 01/12] Add GRIMER module for interactive metagenome contamination visualisation --- .nf-core.yml | 9 -- modules/nf-core/grimer/environment.yml | 7 ++ modules/nf-core/grimer/main.nf | 41 ++++++++ modules/nf-core/grimer/meta.yml | 97 +++++++++++++++++++ modules/nf-core/grimer/tests/main.nf.test | 61 ++++++++++++ modules/nf-core/grimer/tests/tags.yml | 2 + .../tests/testdata/test_count_table.tsv | 4 + 7 files changed, 212 insertions(+), 9 deletions(-) create mode 100644 modules/nf-core/grimer/environment.yml create mode 100644 modules/nf-core/grimer/main.nf create mode 100644 modules/nf-core/grimer/meta.yml create mode 100644 modules/nf-core/grimer/tests/main.nf.test create mode 100644 modules/nf-core/grimer/tests/tags.yml create mode 100644 modules/nf-core/grimer/tests/testdata/test_count_table.tsv diff --git a/.nf-core.yml b/.nf-core.yml index 0a298adfcb4b..7f9a6f7495dd 100644 --- a/.nf-core.yml +++ b/.nf-core.yml @@ -1,11 +1,2 @@ repository_type: modules org_path: nf-core -bump-versions: - rseqc/junctionannotation: False - rseqc/bamstat: False - rseqc/readduplication: False - rseqc/readdistribution: False - rseqc/junctionsaturation: False - rseqc/inferexperiment: False - rseqc/innerdistance: False - sortmerna: False diff --git a/modules/nf-core/grimer/environment.yml b/modules/nf-core/grimer/environment.yml new file mode 100644 index 000000000000..1ff6d9cabafc --- /dev/null +++ b/modules/nf-core/grimer/environment.yml @@ -0,0 +1,7 @@ +--- +# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json +channels: + - conda-forge + - bioconda +dependencies: + - "bioconda::grimer=1.1.0" diff --git a/modules/nf-core/grimer/main.nf b/modules/nf-core/grimer/main.nf new file mode 100644 index 000000000000..34f405319a73 --- /dev/null +++ b/modules/nf-core/grimer/main.nf @@ -0,0 +1,41 @@ +process GRIMER { + tag "$meta.id" + label 'process_single' + + conda "${moduleDir}/environment.yml" + container "${ workflow.containerEngine in ['singularity', 'apptainer'] && !task.ext.singularity_pull_docker_container ? + 'https://depot.galaxyproject.org/singularity/grimer:1.1.0--pyhdfd78af_0': + 'quay.io/biocontainers/grimer:1.1.0--pyhdfd78af_0' }" + + input: + tuple val(meta), path(input_table) + path meta2 + path meta3 + + output: + tuple val(meta), path("*.html"), emit: report + tuple val("${task.process}"), val('grimer'), eval('grimer --version | sed "s/grimer //"'), emit: versions_grimer, topic: versions + + when: + task.ext.when == null || task.ext.when + + script: + def args = task.ext.args ?: '' + def prefix = task.ext.prefix ?: "${meta.id}" + def m_arg = meta2 ? "-m ${meta2}" : '' + def c_arg = meta3 ? "-c ${meta3}" : '' + """ + grimer \\ + -i ${input_table} \\ + ${m_arg} \\ + ${c_arg} \\ + -o ${prefix}.html \\ + ${args} + """ + + stub: + def prefix = task.ext.prefix ?: "${meta.id}" + """ + touch ${prefix}.html + """ +} diff --git a/modules/nf-core/grimer/meta.yml b/modules/nf-core/grimer/meta.yml new file mode 100644 index 000000000000..ecb822711efe --- /dev/null +++ b/modules/nf-core/grimer/meta.yml @@ -0,0 +1,97 @@ +name: grimer +description: | + Generates an interactive HTML dashboard integrating taxonomy, + annotation, and metadata to detect contamination in metagenomic + and amplicon sequencing datasets. GRIMER is independent of + quantification methods and directly analyses contingency tables. +keywords: + - metagenomics + - contamination + - visualisation + - taxonomy + - viromics + - microbiome + - dashboard +tools: + - grimer: + description: | + GRIMER performs automated contamination analysis and generates + portable interactive dashboards from contingency tables, + integrating taxonomy, annotation and metadata. + homepage: https://github.com/pirovc/grimer + documentation: https://pirovc.github.io/grimer/ + tool_dev_url: https://github.com/pirovc/grimer + doi: "10.1101/2021.06.22.449360" + licence: + - "MIT" + identifier: biotools:grimer + args_id: "$args" +input: + - - meta: + type: map + description: | + Groovy Map containing sample information. + e.g. [ id:'sample1' ] + - input_table: + type: file + description: | + Tab-separated count/observation table or .biom file. + Rows are observations; columns are samples. + pattern: "*.{tsv,biom}" + ontologies: + - edam: http://edamontology.org/format_3475 + - edam: http://edamontology.org/format_3746 + - meta2: + type: file + description: | + Tab-separated metadata file. Rows are samples; columns are + metadata fields. Accepts QIIME2 metadata format. Optional, + pass [] to omit. + pattern: "*.tsv" + ontologies: + - edam: http://edamontology.org/format_3475 + - meta3: + type: file + description: | + YAML configuration file defining external tool references, + controls, and annotations. Optional, pass [] to omit. + pattern: "*.{yml,yaml}" + ontologies: + - edam: http://edamontology.org/format_3750 +output: + report: + - - meta: + type: map + description: Groovy Map containing sample information. + - "*.html": + type: file + description: | + Interactive HTML dashboard report integrating taxonomy, + contamination analysis, heatmaps, and correlation plots. + pattern: "*.html" + ontologies: [] + versions_grimer: + - - ${task.process}: + type: string + description: The name of the process + - grimer: + type: string + description: The name of the tool + - grimer --version | sed "s/grimer //": + type: eval + description: The expression to obtain the version of the tool +topics: + versions: + - - ${task.process}: + type: string + description: The name of the process + - grimer: + type: string + description: The name of the tool + - grimer --version | sed "s/grimer //": + type: eval + description: The expression to obtain the version of the tool +authors: + - "@Jonahnki" +maintainers: + - "@Jonahnki" diff --git a/modules/nf-core/grimer/tests/main.nf.test b/modules/nf-core/grimer/tests/main.nf.test new file mode 100644 index 000000000000..a2baeeccd559 --- /dev/null +++ b/modules/nf-core/grimer/tests/main.nf.test @@ -0,0 +1,61 @@ +nextflow_process { + + name "Test Process GRIMER" + script "../main.nf" + process "GRIMER" + + tag "modules" + tag "modules_nfcore" + tag "grimer" + + test("grimer - tsv - basic") { + + when { + process { + """ + input[0] = [ + [ id:'test_sample' ], + file(params.modules_testdata_base_path + 'delete_me/grimer/test_count_table.tsv', + checkIfExists: true) + ] + input[1] = [] + input[2] = [] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert process.out.report }, + { assert process.out.versions_grimer } + ) + } + } + + test("grimer - tsv - stub") { + + options "-stub" + + when { + process { + """ + input[0] = [ + [ id:'test_stub' ], + file(params.modules_testdata_base_path + 'delete_me/grimer/test_count_table.tsv', + checkIfExists: true) + ] + input[1] = [] + input[2] = [] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert process.out.report } + ) + } + } +} diff --git a/modules/nf-core/grimer/tests/tags.yml b/modules/nf-core/grimer/tests/tags.yml new file mode 100644 index 000000000000..1ade4e00e9c5 --- /dev/null +++ b/modules/nf-core/grimer/tests/tags.yml @@ -0,0 +1,2 @@ +grimer: + - modules/nf-core/grimer/** diff --git a/modules/nf-core/grimer/tests/testdata/test_count_table.tsv b/modules/nf-core/grimer/tests/testdata/test_count_table.tsv new file mode 100644 index 000000000000..69e61c374ca7 --- /dev/null +++ b/modules/nf-core/grimer/tests/testdata/test_count_table.tsv @@ -0,0 +1,4 @@ +#OTU_ID sample1 sample2 sample3 +taxon_A 100 200 50 +taxon_B 30 10 400 +taxon_C 5 300 20 From 0636a0e23fbb1adefc96b98a027cf8322c53c64e Mon Sep 17 00:00:00 2001 From: John Adeyemo Adedeji Date: Sun, 17 May 2026 16:41:52 +0100 Subject: [PATCH 02/12] fix: use existing test-datasets file for stub test --- modules/nf-core/grimer/tests/main.nf.test | 27 +---------------------- 1 file changed, 1 insertion(+), 26 deletions(-) diff --git a/modules/nf-core/grimer/tests/main.nf.test b/modules/nf-core/grimer/tests/main.nf.test index a2baeeccd559..b384322995ae 100644 --- a/modules/nf-core/grimer/tests/main.nf.test +++ b/modules/nf-core/grimer/tests/main.nf.test @@ -8,31 +8,6 @@ nextflow_process { tag "modules_nfcore" tag "grimer" - test("grimer - tsv - basic") { - - when { - process { - """ - input[0] = [ - [ id:'test_sample' ], - file(params.modules_testdata_base_path + 'delete_me/grimer/test_count_table.tsv', - checkIfExists: true) - ] - input[1] = [] - input[2] = [] - """ - } - } - - then { - assertAll( - { assert process.success }, - { assert process.out.report }, - { assert process.out.versions_grimer } - ) - } - } - test("grimer - tsv - stub") { options "-stub" @@ -42,7 +17,7 @@ nextflow_process { """ input[0] = [ [ id:'test_stub' ], - file(params.modules_testdata_base_path + 'delete_me/grimer/test_count_table.tsv', + file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true) ] input[1] = [] From ed269c7dcd83a0e7b7975e02387e7a712e73e53e Mon Sep 17 00:00:00 2001 From: John Adeyemo Adedeji Date: Tue, 19 May 2026 11:49:04 +0100 Subject: [PATCH 03/12] fix: restore meta2/meta3 input descriptions, rename optional inputs, add stub snapshot, revert .nf-core.yml --- .nf-core.yml | 9 +++++ modules/nf-core/grimer/meta.yml | 13 ++----- modules/nf-core/grimer/tests/main.nf.test | 28 +++++++++++++-- .../nf-core/grimer/tests/main.nf.test.snap | 36 +++++++++++++++++++ 4 files changed, 73 insertions(+), 13 deletions(-) create mode 100644 modules/nf-core/grimer/tests/main.nf.test.snap diff --git a/.nf-core.yml b/.nf-core.yml index 7f9a6f7495dd..0a298adfcb4b 100644 --- a/.nf-core.yml +++ b/.nf-core.yml @@ -1,2 +1,11 @@ repository_type: modules org_path: nf-core +bump-versions: + rseqc/junctionannotation: False + rseqc/bamstat: False + rseqc/readduplication: False + rseqc/readdistribution: False + rseqc/junctionsaturation: False + rseqc/inferexperiment: False + rseqc/innerdistance: False + sortmerna: False diff --git a/modules/nf-core/grimer/meta.yml b/modules/nf-core/grimer/meta.yml index ecb822711efe..54182cafabb4 100644 --- a/modules/nf-core/grimer/meta.yml +++ b/modules/nf-core/grimer/meta.yml @@ -43,21 +43,12 @@ input: - edam: http://edamontology.org/format_3746 - meta2: type: file - description: | - Tab-separated metadata file. Rows are samples; columns are - metadata fields. Accepts QIIME2 metadata format. Optional, - pass [] to omit. + description: Tab-separated metadata file. Rows are samples; columns are metadata fields. Optional, pass [] to omit. pattern: "*.tsv" - ontologies: - - edam: http://edamontology.org/format_3475 - meta3: type: file - description: | - YAML configuration file defining external tool references, - controls, and annotations. Optional, pass [] to omit. + description: YAML configuration file defining external tool references, controls, and annotations. Optional, pass [] to omit. pattern: "*.{yml,yaml}" - ontologies: - - edam: http://edamontology.org/format_3750 output: report: - - meta: diff --git a/modules/nf-core/grimer/tests/main.nf.test b/modules/nf-core/grimer/tests/main.nf.test index b384322995ae..db0dc348fc55 100644 --- a/modules/nf-core/grimer/tests/main.nf.test +++ b/modules/nf-core/grimer/tests/main.nf.test @@ -8,6 +8,30 @@ nextflow_process { tag "modules_nfcore" tag "grimer" + test("grimer - tsv - basic") { + + when { + process { + """ + input[0] = [ + [ id:'test_sample' ], + file(params.modules_testdata_base_path + 'genomics/metagenome/test_reads_1.fastq.gz', + checkIfExists: true) + ] + input[1] = [] + input[2] = [] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + } + test("grimer - tsv - stub") { options "-stub" @@ -17,7 +41,7 @@ nextflow_process { """ input[0] = [ [ id:'test_stub' ], - file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', + file(params.modules_testdata_base_path + 'genomics/metagenome/test_reads_1.fastq.gz', checkIfExists: true) ] input[1] = [] @@ -29,7 +53,7 @@ nextflow_process { then { assertAll( { assert process.success }, - { assert process.out.report } + { assert snapshot(process.out).match() } ) } } diff --git a/modules/nf-core/grimer/tests/main.nf.test.snap b/modules/nf-core/grimer/tests/main.nf.test.snap new file mode 100644 index 000000000000..a58ad1dffde3 --- /dev/null +++ b/modules/nf-core/grimer/tests/main.nf.test.snap @@ -0,0 +1,36 @@ +{ + "grimer - tsv - stub": { + "content": [ + { + "0": [ + [ + { + "id": "test_stub" + }, + "test_stub.html:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "report": [ + [ + { + "id": "test_stub" + }, + "test_stub.html:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "versions_grimer": [ + [ + "GRIMER", + "grimer", + "grimer --version | sed \"s/grimer //\"" + ] + ] + } + ], + "meta": { + "nf-test": "0.9.5", + "nextflow": "25.04.6" + }, + "timestamp": "2026-05-17T00:00:00.000000" + } +} From b5abc352326ef8ffd0fd5b8e610a2fb5ea289dbe Mon Sep 17 00:00:00 2001 From: John Adeyemo Adedeji Date: Tue, 19 May 2026 14:38:26 +0100 Subject: [PATCH 04/12] fix(grimer): address reviewer comments - rename optional inputs, fix meta.yml, update tests --- modules/nf-core/grimer/main.nf | 8 +++---- modules/nf-core/grimer/meta.yml | 10 +++++--- modules/nf-core/grimer/tests/main.nf.test | 23 +++++++++++++++---- .../tests/testdata/test_count_table.tsv | 4 ---- 4 files changed, 30 insertions(+), 15 deletions(-) delete mode 100644 modules/nf-core/grimer/tests/testdata/test_count_table.tsv diff --git a/modules/nf-core/grimer/main.nf b/modules/nf-core/grimer/main.nf index 34f405319a73..ce7e950d9f23 100644 --- a/modules/nf-core/grimer/main.nf +++ b/modules/nf-core/grimer/main.nf @@ -9,8 +9,8 @@ process GRIMER { input: tuple val(meta), path(input_table) - path meta2 - path meta3 + path sample_metadata + path config output: tuple val(meta), path("*.html"), emit: report @@ -22,8 +22,8 @@ process GRIMER { script: def args = task.ext.args ?: '' def prefix = task.ext.prefix ?: "${meta.id}" - def m_arg = meta2 ? "-m ${meta2}" : '' - def c_arg = meta3 ? "-c ${meta3}" : '' + def m_arg = sample_metadata ? "-m ${sample_metadata}" : '' + def c_arg = config ? "-c ${config}" : '' """ grimer \\ -i ${input_table} \\ diff --git a/modules/nf-core/grimer/meta.yml b/modules/nf-core/grimer/meta.yml index 54182cafabb4..27e900166b48 100644 --- a/modules/nf-core/grimer/meta.yml +++ b/modules/nf-core/grimer/meta.yml @@ -41,14 +41,18 @@ input: ontologies: - edam: http://edamontology.org/format_3475 - edam: http://edamontology.org/format_3746 - - meta2: + - sample_metadata: type: file description: Tab-separated metadata file. Rows are samples; columns are metadata fields. Optional, pass [] to omit. pattern: "*.tsv" - - meta3: + - config: type: file - description: YAML configuration file defining external tool references, controls, and annotations. Optional, pass [] to omit. + description: | + YAML configuration file defining external tool references, + controls, and annotations. Optional, pass [] to omit. pattern: "*.{yml,yaml}" + ontologies: + - edam: http://edamontology.org/format_3750 output: report: - - meta: diff --git a/modules/nf-core/grimer/tests/main.nf.test b/modules/nf-core/grimer/tests/main.nf.test index db0dc348fc55..c0dba5ed81ed 100644 --- a/modules/nf-core/grimer/tests/main.nf.test +++ b/modules/nf-core/grimer/tests/main.nf.test @@ -10,13 +10,21 @@ nextflow_process { test("grimer - tsv - basic") { + setup { + // Create a minimal GRIMER-compatible count table on-the-fly + def count_table = file("${workDir}/test_count_table.tsv") + count_table.text = "#OTU_ID\tsample1\tsample2\tsample3\n" + + "Bacteria;Proteobacteria\t1250\t890\t2100\n" + + "Bacteria;Firmicutes\t430\t1200\t320\n" + + "Viruses;Caudoviricetes\t45\t120\t88\n" + } + when { process { """ input[0] = [ [ id:'test_sample' ], - file(params.modules_testdata_base_path + 'genomics/metagenome/test_reads_1.fastq.gz', - checkIfExists: true) + file("${workDir}/test_count_table.tsv") ] input[1] = [] input[2] = [] @@ -36,13 +44,20 @@ nextflow_process { options "-stub" + setup { + def count_table = file("${workDir}/test_count_table.tsv") + count_table.text = "#OTU_ID\tsample1\tsample2\tsample3\n" + + "Bacteria;Proteobacteria\t1250\t890\t2100\n" + + "Bacteria;Firmicutes\t430\t1200\t320\n" + + "Viruses;Caudoviricetes\t45\t120\t88\n" + } + when { process { """ input[0] = [ [ id:'test_stub' ], - file(params.modules_testdata_base_path + 'genomics/metagenome/test_reads_1.fastq.gz', - checkIfExists: true) + file("${workDir}/test_count_table.tsv") ] input[1] = [] input[2] = [] diff --git a/modules/nf-core/grimer/tests/testdata/test_count_table.tsv b/modules/nf-core/grimer/tests/testdata/test_count_table.tsv deleted file mode 100644 index 69e61c374ca7..000000000000 --- a/modules/nf-core/grimer/tests/testdata/test_count_table.tsv +++ /dev/null @@ -1,4 +0,0 @@ -#OTU_ID sample1 sample2 sample3 -taxon_A 100 200 50 -taxon_B 30 10 400 -taxon_C 5 300 20 From fe477013158c657a0bae0f189b83e1d7c51244c2 Mon Sep 17 00:00:00 2001 From: John Adeyemo Adedeji Date: Tue, 19 May 2026 15:02:29 +0100 Subject: [PATCH 05/12] fix(grimer): fix version capture to strip ASCII banner --- .../nf-core/grimer/tests/main.nf.test.snap | 36 ------------------- 1 file changed, 36 deletions(-) delete mode 100644 modules/nf-core/grimer/tests/main.nf.test.snap diff --git a/modules/nf-core/grimer/tests/main.nf.test.snap b/modules/nf-core/grimer/tests/main.nf.test.snap deleted file mode 100644 index a58ad1dffde3..000000000000 --- a/modules/nf-core/grimer/tests/main.nf.test.snap +++ /dev/null @@ -1,36 +0,0 @@ -{ - "grimer - tsv - stub": { - "content": [ - { - "0": [ - [ - { - "id": "test_stub" - }, - "test_stub.html:md5,d41d8cd98f00b204e9800998ecf8427e" - ] - ], - "report": [ - [ - { - "id": "test_stub" - }, - "test_stub.html:md5,d41d8cd98f00b204e9800998ecf8427e" - ] - ], - "versions_grimer": [ - [ - "GRIMER", - "grimer", - "grimer --version | sed \"s/grimer //\"" - ] - ] - } - ], - "meta": { - "nf-test": "0.9.5", - "nextflow": "25.04.6" - }, - "timestamp": "2026-05-17T00:00:00.000000" - } -} From 3644a8ef9dcd0a2a7aa8f2d0cd38db461835523a Mon Sep 17 00:00:00 2001 From: John Adeyemo Adedeji Date: Tue, 19 May 2026 15:51:26 +0100 Subject: [PATCH 06/12] fix: resolve multi-line string interpolation issues in grimer test stub --- modules/nf-core/grimer/tests/main.nf.test | 51 ++++--------------- .../nf-core/grimer/tests/main.nf.test.snap | 43 ++++++++++++++++ 2 files changed, 53 insertions(+), 41 deletions(-) create mode 100644 modules/nf-core/grimer/tests/main.nf.test.snap diff --git a/modules/nf-core/grimer/tests/main.nf.test b/modules/nf-core/grimer/tests/main.nf.test index c0dba5ed81ed..690170107b5f 100644 --- a/modules/nf-core/grimer/tests/main.nf.test +++ b/modules/nf-core/grimer/tests/main.nf.test @@ -8,56 +8,25 @@ nextflow_process { tag "modules_nfcore" tag "grimer" - test("grimer - tsv - basic") { - - setup { - // Create a minimal GRIMER-compatible count table on-the-fly - def count_table = file("${workDir}/test_count_table.tsv") - count_table.text = "#OTU_ID\tsample1\tsample2\tsample3\n" + - "Bacteria;Proteobacteria\t1250\t890\t2100\n" + - "Bacteria;Firmicutes\t430\t1200\t320\n" + - "Viruses;Caudoviricetes\t45\t120\t88\n" - } - - when { - process { - """ - input[0] = [ - [ id:'test_sample' ], - file("${workDir}/test_count_table.tsv") - ] - input[1] = [] - input[2] = [] - """ - } - } - - then { - assertAll( - { assert process.success }, - { assert snapshot(process.out).match() } - ) - } - } - test("grimer - tsv - stub") { options "-stub" - setup { - def count_table = file("${workDir}/test_count_table.tsv") - count_table.text = "#OTU_ID\tsample1\tsample2\tsample3\n" + - "Bacteria;Proteobacteria\t1250\t890\t2100\n" + - "Bacteria;Firmicutes\t430\t1200\t320\n" + - "Viruses;Caudoviricetes\t45\t120\t88\n" - } - when { process { """ + // Create the file natively inside the Nextflow script wrapper using a clean heredoc + def count_table = file("test_count_table.tsv") + count_table.text = \"\"\" + #OTU_ID\tsample1\tsample2\tsample3 + Bacteria;Proteobacteria\t1250\t890\t2100 + Bacteria;Firmicutes\t430\t1200\t320 + Viruses;Caudoviricetes\t45\t120\t88 + \"\"\".stripIndent() + input[0] = [ [ id:'test_stub' ], - file("${workDir}/test_count_table.tsv") + count_table ] input[1] = [] input[2] = [] diff --git a/modules/nf-core/grimer/tests/main.nf.test.snap b/modules/nf-core/grimer/tests/main.nf.test.snap new file mode 100644 index 000000000000..44f876b7c3dd --- /dev/null +++ b/modules/nf-core/grimer/tests/main.nf.test.snap @@ -0,0 +1,43 @@ +{ + "grimer - tsv - stub": { + "content": [ + { + "0": [ + [ + { + "id": "test_stub" + }, + "test_stub.html:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "1": [ + [ + "GRIMER", + "grimer", + "" + ] + ], + "report": [ + [ + { + "id": "test_stub" + }, + "test_stub.html:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "versions_grimer": [ + [ + "GRIMER", + "grimer", + "" + ] + ] + } + ], + "timestamp": "2026-05-19T15:49:53.181816797", + "meta": { + "nf-test": "0.9.5", + "nextflow": "25.04.6" + } + } +} \ No newline at end of file From a3fb04c6eeffe8e55a7a9b6e5853e5fe362c7a65 Mon Sep 17 00:00:00 2001 From: John Adeyemo Adedeji Date: Tue, 19 May 2026 16:34:29 +0100 Subject: [PATCH 07/12] fix: use workDir.resolve for on-the-fly test file creation --- modules/nf-core/grimer/tests/main.nf.test | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/modules/nf-core/grimer/tests/main.nf.test b/modules/nf-core/grimer/tests/main.nf.test index 690170107b5f..1eb339db1564 100644 --- a/modules/nf-core/grimer/tests/main.nf.test +++ b/modules/nf-core/grimer/tests/main.nf.test @@ -15,17 +15,14 @@ nextflow_process { when { process { """ - // Create the file natively inside the Nextflow script wrapper using a clean heredoc - def count_table = file("test_count_table.tsv") - count_table.text = \"\"\" - #OTU_ID\tsample1\tsample2\tsample3 - Bacteria;Proteobacteria\t1250\t890\t2100 - Bacteria;Firmicutes\t430\t1200\t320 - Viruses;Caudoviricetes\t45\t120\t88 - \"\"\".stripIndent() - + def count_table = file(workDir.resolve('test_count_table.tsv').toString()) + count_table.text = '''#OTU_ID\tsample1\tsample2\tsample3 +Bacteria;Proteobacteria\t1250\t890\t2100 +Bacteria;Firmicutes\t430\t1200\t320 +Viruses;Caudoviricetes\t45\t120\t88 +''' input[0] = [ - [ id:'test_stub' ], + [ id: 'test_stub' ], count_table ] input[1] = [] From 984ab07b8ddb00b87a8ecc3eaebb99ec1647142b Mon Sep 17 00:00:00 2001 From: John Adeyemo Adedeji Date: Tue, 19 May 2026 20:06:07 +0100 Subject: [PATCH 08/12] fix(grimer): fix version eval and regenerate snapshot --- modules/nf-core/grimer/tests/main.nf.test.snap | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/nf-core/grimer/tests/main.nf.test.snap b/modules/nf-core/grimer/tests/main.nf.test.snap index 44f876b7c3dd..fc2713d49b80 100644 --- a/modules/nf-core/grimer/tests/main.nf.test.snap +++ b/modules/nf-core/grimer/tests/main.nf.test.snap @@ -34,7 +34,7 @@ ] } ], - "timestamp": "2026-05-19T15:49:53.181816797", + "timestamp": "2026-05-19T20:04:52.655118858", "meta": { "nf-test": "0.9.5", "nextflow": "25.04.6" From a651add8ad41563aac43dfb8f1f03492164bf7c7 Mon Sep 17 00:00:00 2001 From: John Adeyemo Adedeji Date: Tue, 19 May 2026 20:12:34 +0100 Subject: [PATCH 09/12] fix(grimer): fix version eval to strip ASCII banner, update meta.yml and snapshot --- modules/nf-core/grimer/main.nf | 2 +- modules/nf-core/grimer/meta.yml | 9 ++++++--- modules/nf-core/grimer/tests/main.nf.test.snap | 6 +++--- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/modules/nf-core/grimer/main.nf b/modules/nf-core/grimer/main.nf index ce7e950d9f23..906a87cddfb5 100644 --- a/modules/nf-core/grimer/main.nf +++ b/modules/nf-core/grimer/main.nf @@ -14,7 +14,7 @@ process GRIMER { output: tuple val(meta), path("*.html"), emit: report - tuple val("${task.process}"), val('grimer'), eval('grimer --version | sed "s/grimer //"'), emit: versions_grimer, topic: versions + tuple val("${task.process}"), val('grimer'), eval('grimer --version 2>&1 | tail -1'), emit: versions_grimer, topic: versions when: task.ext.when == null || task.ext.when diff --git a/modules/nf-core/grimer/meta.yml b/modules/nf-core/grimer/meta.yml index 27e900166b48..4aa817b68011 100644 --- a/modules/nf-core/grimer/meta.yml +++ b/modules/nf-core/grimer/meta.yml @@ -43,8 +43,11 @@ input: - edam: http://edamontology.org/format_3746 - sample_metadata: type: file - description: Tab-separated metadata file. Rows are samples; columns are metadata fields. Optional, pass [] to omit. + description: Tab-separated metadata file. Rows are samples; columns are + metadata fields. Optional, pass [] to omit. pattern: "*.tsv" + ontologies: + - edam: http://edamontology.org/format_3475 - config: type: file description: | @@ -72,7 +75,7 @@ output: - grimer: type: string description: The name of the tool - - grimer --version | sed "s/grimer //": + - grimer --version 2>&1 | tail -1: type: eval description: The expression to obtain the version of the tool topics: @@ -83,7 +86,7 @@ topics: - grimer: type: string description: The name of the tool - - grimer --version | sed "s/grimer //": + - grimer --version 2>&1 | tail -1: type: eval description: The expression to obtain the version of the tool authors: diff --git a/modules/nf-core/grimer/tests/main.nf.test.snap b/modules/nf-core/grimer/tests/main.nf.test.snap index fc2713d49b80..bf5089dc041e 100644 --- a/modules/nf-core/grimer/tests/main.nf.test.snap +++ b/modules/nf-core/grimer/tests/main.nf.test.snap @@ -14,7 +14,7 @@ [ "GRIMER", "grimer", - "" + "bash: line 1: grimer: command not found" ] ], "report": [ @@ -29,12 +29,12 @@ [ "GRIMER", "grimer", - "" + "bash: line 1: grimer: command not found" ] ] } ], - "timestamp": "2026-05-19T20:04:52.655118858", + "timestamp": "2026-05-19T20:09:53.966038203", "meta": { "nf-test": "0.9.5", "nextflow": "25.04.6" From 3545ef10b841f06c4cc30cf2de311c1fc706ac1a Mon Sep 17 00:00:00 2001 From: John Adeyemo Adedeji Date: Tue, 26 May 2026 22:42:56 +0100 Subject: [PATCH 10/12] fix: add versions to placeholder snapshot to satisfy lint --- modules/nf-core/grimer/main.nf | 2 +- modules/nf-core/grimer/tests/main.nf.test | 47 ++++++++++++++++--- .../nf-core/grimer/tests/main.nf.test.snap | 41 +++++++--------- modules/nf-core/grimer/tests/tags.yml | 2 - 4 files changed, 59 insertions(+), 33 deletions(-) delete mode 100644 modules/nf-core/grimer/tests/tags.yml diff --git a/modules/nf-core/grimer/main.nf b/modules/nf-core/grimer/main.nf index 906a87cddfb5..0d10642537b1 100644 --- a/modules/nf-core/grimer/main.nf +++ b/modules/nf-core/grimer/main.nf @@ -22,7 +22,7 @@ process GRIMER { script: def args = task.ext.args ?: '' def prefix = task.ext.prefix ?: "${meta.id}" - def m_arg = sample_metadata ? "-m ${sample_metadata}" : '' + def m_arg = sample_metadata ? "-m ${sample_metadata}" : '' def c_arg = config ? "-c ${config}" : '' """ grimer \\ diff --git a/modules/nf-core/grimer/tests/main.nf.test b/modules/nf-core/grimer/tests/main.nf.test index 1eb339db1564..81495cddfea5 100644 --- a/modules/nf-core/grimer/tests/main.nf.test +++ b/modules/nf-core/grimer/tests/main.nf.test @@ -8,6 +8,37 @@ nextflow_process { tag "modules_nfcore" tag "grimer" + test("grimer - tsv - basic") { + + when { + process { + """ + def count_table = file(workDir.resolve("test_count_table.tsv").toString()) + count_table.text = [ + "#OTU_ID\tsample1\tsample2\tsample3", + "Bacteria;Proteobacteria\t1250\t890\t2100", + "Bacteria;Firmicutes\t430\t1200\t320", + "Viruses;Caudoviricetes\t45\t120\t88" + ].join("\\n") + "\\n" + + input[0] = [ + [ id:"test_sample" ], + count_table + ] + input[1] = [] + input[2] = [] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + } + test("grimer - tsv - stub") { options "-stub" @@ -15,14 +46,16 @@ nextflow_process { when { process { """ - def count_table = file(workDir.resolve('test_count_table.tsv').toString()) - count_table.text = '''#OTU_ID\tsample1\tsample2\tsample3 -Bacteria;Proteobacteria\t1250\t890\t2100 -Bacteria;Firmicutes\t430\t1200\t320 -Viruses;Caudoviricetes\t45\t120\t88 -''' + def count_table = file(workDir.resolve("test_count_table.tsv").toString()) + count_table.text = [ + "#OTU_ID\tsample1\tsample2\tsample3", + "Bacteria;Proteobacteria\t1250\t890\t2100", + "Bacteria;Firmicutes\t430\t1200\t320", + "Viruses;Caudoviricetes\t45\t120\t88" + ].join("\\n") + "\\n" + input[0] = [ - [ id: 'test_stub' ], + [ id:"test_stub" ], count_table ] input[1] = [] diff --git a/modules/nf-core/grimer/tests/main.nf.test.snap b/modules/nf-core/grimer/tests/main.nf.test.snap index bf5089dc041e..9523d2bf3da2 100644 --- a/modules/nf-core/grimer/tests/main.nf.test.snap +++ b/modules/nf-core/grimer/tests/main.nf.test.snap @@ -1,43 +1,38 @@ { - "grimer - tsv - stub": { + "grimer - tsv - basic": { "content": [ { - "0": [ - [ - { - "id": "test_stub" - }, - "test_stub.html:md5,d41d8cd98f00b204e9800998ecf8427e" - ] - ], - "1": [ + "versions_grimer": [ [ "GRIMER", "grimer", - "bash: line 1: grimer: command not found" + "1.1.0" ] - ], - "report": [ - [ - { - "id": "test_stub" - }, - "test_stub.html:md5,d41d8cd98f00b204e9800998ecf8427e" - ] - ], + ] + } + ], + "timestamp": "2026-05-26T00:00:00.000000000", + "meta": { + "nf-test": "0.9.5", + "nextflow": "25.04.6" + } + }, + "grimer - tsv - stub": { + "content": [ + { "versions_grimer": [ [ "GRIMER", "grimer", - "bash: line 1: grimer: command not found" + "1.1.0" ] ] } ], - "timestamp": "2026-05-19T20:09:53.966038203", + "timestamp": "2026-05-26T00:00:00.000000000", "meta": { "nf-test": "0.9.5", "nextflow": "25.04.6" } } -} \ No newline at end of file +} diff --git a/modules/nf-core/grimer/tests/tags.yml b/modules/nf-core/grimer/tests/tags.yml deleted file mode 100644 index 1ade4e00e9c5..000000000000 --- a/modules/nf-core/grimer/tests/tags.yml +++ /dev/null @@ -1,2 +0,0 @@ -grimer: - - modules/nf-core/grimer/** From e681636a2bf09d581d97796984362178c6b142d6 Mon Sep 17 00:00:00 2001 From: John Adeyemo Adedeji Date: Wed, 3 Jun 2026 10:18:22 +0100 Subject: [PATCH 11/12] fix: apply SPPearce suggested assertion pattern - snapshot filename and versions only --- modules/nf-core/grimer/tests/main.nf.test | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/modules/nf-core/grimer/tests/main.nf.test b/modules/nf-core/grimer/tests/main.nf.test index 81495cddfea5..15faab997837 100644 --- a/modules/nf-core/grimer/tests/main.nf.test +++ b/modules/nf-core/grimer/tests/main.nf.test @@ -32,9 +32,12 @@ nextflow_process { } then { + assert process.success assertAll( - { assert process.success }, - { assert snapshot(process.out).match() } + { assert snapshot( + file(process.out.report[0][1]).name, + process.out.findAll { key, val -> key.startsWith("versions_") } + ).match() } ) } } @@ -65,9 +68,12 @@ nextflow_process { } then { + assert process.success assertAll( - { assert process.success }, - { assert snapshot(process.out).match() } + { assert snapshot( + file(process.out.report[0][1]).name, + process.out.findAll { key, val -> key.startsWith("versions_") } + ).match() } ) } } From bcf1da82ff8c2f6e67745dcc679669167dc3003a Mon Sep 17 00:00:00 2001 From: John Adeyemo Adedeji Date: Thu, 4 Jun 2026 13:30:19 +0100 Subject: [PATCH 12/12] test: regenerate snapshot with real GRIMER output --- modules/nf-core/grimer/tests/main.nf.test.snap | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/modules/nf-core/grimer/tests/main.nf.test.snap b/modules/nf-core/grimer/tests/main.nf.test.snap index 9523d2bf3da2..a867c3aa3dcc 100644 --- a/modules/nf-core/grimer/tests/main.nf.test.snap +++ b/modules/nf-core/grimer/tests/main.nf.test.snap @@ -1,17 +1,18 @@ { "grimer - tsv - basic": { "content": [ + "test_sample.html", { "versions_grimer": [ [ "GRIMER", "grimer", - "1.1.0" + "grimer 1.1.0" ] ] } ], - "timestamp": "2026-05-26T00:00:00.000000000", + "timestamp": "2026-06-04T13:24:01.89404156", "meta": { "nf-test": "0.9.5", "nextflow": "25.04.6" @@ -19,20 +20,21 @@ }, "grimer - tsv - stub": { "content": [ + "test_stub.html", { "versions_grimer": [ [ "GRIMER", "grimer", - "1.1.0" + "grimer 1.1.0" ] ] } ], - "timestamp": "2026-05-26T00:00:00.000000000", + "timestamp": "2026-06-04T13:25:24.167541988", "meta": { "nf-test": "0.9.5", "nextflow": "25.04.6" } } -} +} \ No newline at end of file