From 168177978a38863c16d0cca91964dd810f779f58 Mon Sep 17 00:00:00 2001 From: "James A. Fellows Yates" Date: Wed, 19 Jun 2024 14:44:45 +0200 Subject: [PATCH 1/6] Add missing optional input channel to abricate --- modules/nf-core/abricate/run/main.nf | 19 ++++++++++++++++++- modules/nf-core/abricate/run/meta.yml | 4 ++++ .../nf-core/abricate/run/tests/main.nf.test | 1 + 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/modules/nf-core/abricate/run/main.nf b/modules/nf-core/abricate/run/main.nf index 5ec8a9a787c..e2bebe0730d 100644 --- a/modules/nf-core/abricate/run/main.nf +++ b/modules/nf-core/abricate/run/main.nf @@ -9,6 +9,7 @@ process ABRICATE_RUN { input: tuple val(meta), path(assembly) + path databasedir output: tuple val(meta), path("*.txt"), emit: report @@ -20,11 +21,27 @@ process ABRICATE_RUN { script: def args = task.ext.args ?: '' def prefix = task.ext.prefix ?: "${meta.id}" + def datadir = databasedir ? '--datadir ${databasedir}' : '' """ abricate \\ $assembly \\ $args \\ - --threads $task.cpus > ${prefix}.txt + $datadir \\ + --threads $task.cpus \\ + > ${prefix}.txt + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + abricate: \$(echo \$(abricate --version 2>&1) | sed 's/^.*abricate //' ) + END_VERSIONS + """ + + stub: + def args = task.ext.args ?: '' + def prefix = task.ext.prefix ?: "${meta.id}" + def datadir = databasedir ? '--datadir ${databasedir}' : '' + """ + touch ${prefix}.txt cat <<-END_VERSIONS > versions.yml "${task.process}": diff --git a/modules/nf-core/abricate/run/meta.yml b/modules/nf-core/abricate/run/meta.yml index 9c5f21775ee..52969af9cc2 100644 --- a/modules/nf-core/abricate/run/meta.yml +++ b/modules/nf-core/abricate/run/meta.yml @@ -21,6 +21,10 @@ input: type: file description: FASTA, GenBank or EMBL formatted file pattern: "*.{fa,fasta,fna,fa.gz,fasta.gz,fna.gz,gbk,gbk.gz,embl,embl.gz}" + - databasedir: + type: directory + description: Location of local copy of database files, possibly with custom databases set up with `abricate --setupdb` + pattern: "*/" output: - meta: type: map diff --git a/modules/nf-core/abricate/run/tests/main.nf.test b/modules/nf-core/abricate/run/tests/main.nf.test index 07767adf9c7..3022f23f366 100644 --- a/modules/nf-core/abricate/run/tests/main.nf.test +++ b/modules/nf-core/abricate/run/tests/main.nf.test @@ -20,6 +20,7 @@ nextflow_process { [ id:'test', single_end:false ], // meta map file(params.test_data['bacteroides_fragilis']['genome']['genome_fna_gz'], checkIfExists: true) ] + input[1] = [] """ } } From e348bd086f49de66b53314bc82b990736259e44b Mon Sep 17 00:00:00 2001 From: "James A. Fellows Yates" Date: Wed, 19 Jun 2024 21:09:59 +0200 Subject: [PATCH 2/6] Update abricate module to include missing optional input path --- modules/nf-core/abricate/run/meta.yml | 2 +- .../nf-core/abricate/run/tests/main.nf.test | 29 ++++++++++++- .../abricate/run/tests/main.nf.test.snap | 43 ++++++++++++++++++- 3 files changed, 70 insertions(+), 4 deletions(-) diff --git a/modules/nf-core/abricate/run/meta.yml b/modules/nf-core/abricate/run/meta.yml index 52969af9cc2..927c21f60f9 100644 --- a/modules/nf-core/abricate/run/meta.yml +++ b/modules/nf-core/abricate/run/meta.yml @@ -23,7 +23,7 @@ input: pattern: "*.{fa,fasta,fna,fa.gz,fasta.gz,fna.gz,gbk,gbk.gz,embl,embl.gz}" - databasedir: type: directory - description: Location of local copy of database files, possibly with custom databases set up with `abricate --setupdb` + description: Optional location of local copy of database files, possibly with custom databases set up with `abricate --setupdb` pattern: "*/" output: - meta: diff --git a/modules/nf-core/abricate/run/tests/main.nf.test b/modules/nf-core/abricate/run/tests/main.nf.test index 3022f23f366..0184c46f64e 100644 --- a/modules/nf-core/abricate/run/tests/main.nf.test +++ b/modules/nf-core/abricate/run/tests/main.nf.test @@ -8,7 +8,34 @@ nextflow_process { tag "abricate" tag "abricate/run" - test("Should run without failures") { + test("bacteroides_fragilis - genome") { + + when { + params { + outdir = "$outputDir" + } + process { + """ + input[0] = [ + [ id:'test', single_end:false ], // meta map + file(params.test_data['bacteroides_fragilis']['genome']['genome_fna_gz'], checkIfExists: true) + ] + input[1] = [] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + } + + test("bacteroides_fragilis - genome - stub") { + + options "-stub" when { params { diff --git a/modules/nf-core/abricate/run/tests/main.nf.test.snap b/modules/nf-core/abricate/run/tests/main.nf.test.snap index e8779c24a7d..9f598c4a3d5 100644 --- a/modules/nf-core/abricate/run/tests/main.nf.test.snap +++ b/modules/nf-core/abricate/run/tests/main.nf.test.snap @@ -1,5 +1,40 @@ { - "Should run without failures": { + "bacteroides_fragilis - genome - stub": { + "content": [ + { + "0": [ + [ + { + "id": "test", + "single_end": false + }, + "test.txt:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "1": [ + "versions.yml:md5,2204fb00277c287f5f3d82e28964aa03" + ], + "report": [ + [ + { + "id": "test", + "single_end": false + }, + "test.txt:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "versions": [ + "versions.yml:md5,2204fb00277c287f5f3d82e28964aa03" + ] + } + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "24.04.2" + }, + "timestamp": "2024-06-19T21:06:27.483697023" + }, + "bacteroides_fragilis - genome": { "content": [ { "0": [ @@ -28,6 +63,10 @@ ] } ], - "timestamp": "2023-10-15T10:06:00.77835847" + "meta": { + "nf-test": "0.8.4", + "nextflow": "24.04.2" + }, + "timestamp": "2024-06-19T21:06:20.036490495" } } \ No newline at end of file From ea86f537d963d57e6adfe28b73ba694c91c3d9ef Mon Sep 17 00:00:00 2001 From: "James A. Fellows Yates" Date: Wed, 19 Jun 2024 21:20:34 +0200 Subject: [PATCH 3/6] Update modules/nf-core/abricate/run/tests/main.nf.test Co-authored-by: Carson J Miller <68351153+CarsonJM@users.noreply.github.com> --- modules/nf-core/abricate/run/tests/main.nf.test | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/nf-core/abricate/run/tests/main.nf.test b/modules/nf-core/abricate/run/tests/main.nf.test index 0184c46f64e..877bc3fa437 100644 --- a/modules/nf-core/abricate/run/tests/main.nf.test +++ b/modules/nf-core/abricate/run/tests/main.nf.test @@ -8,7 +8,7 @@ nextflow_process { tag "abricate" tag "abricate/run" - test("bacteroides_fragilis - genome") { + test("bacteroides_fragilis - genome.fa.gz") { when { params { From 9b89077c58532ed8af143cbe96af2e17bdb30dc3 Mon Sep 17 00:00:00 2001 From: "James A. Fellows Yates" Date: Wed, 19 Jun 2024 21:20:45 +0200 Subject: [PATCH 4/6] Fix linting --- modules/nf-core/abricate/summary/tests/main.nf.test | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/nf-core/abricate/summary/tests/main.nf.test b/modules/nf-core/abricate/summary/tests/main.nf.test index f504f99b71f..99a7f634dd6 100644 --- a/modules/nf-core/abricate/summary/tests/main.nf.test +++ b/modules/nf-core/abricate/summary/tests/main.nf.test @@ -7,6 +7,7 @@ nextflow_process { tag "modules_nfcore" tag "abricate" tag "abricate/summary" + tag "abricate/run" test("Should run without failures") { From 81e2995c7475d863405a584492010b0d18a7bdb1 Mon Sep 17 00:00:00 2001 From: "James A. Fellows Yates" Date: Wed, 19 Jun 2024 21:22:58 +0200 Subject: [PATCH 5/6] Update modules/nf-core/abricate/run/main.nf --- modules/nf-core/abricate/run/main.nf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/nf-core/abricate/run/main.nf b/modules/nf-core/abricate/run/main.nf index e2bebe0730d..b0d8a68a1cc 100644 --- a/modules/nf-core/abricate/run/main.nf +++ b/modules/nf-core/abricate/run/main.nf @@ -21,7 +21,7 @@ process ABRICATE_RUN { script: def args = task.ext.args ?: '' def prefix = task.ext.prefix ?: "${meta.id}" - def datadir = databasedir ? '--datadir ${databasedir}' : '' + def datadir = databasedir ? "--datadir ${databasedir}" : '' """ abricate \\ $assembly \\ From 2e601ffe2f85e4195187d9fc5588c2461c0548f5 Mon Sep 17 00:00:00 2001 From: "James A. Fellows Yates" Date: Wed, 19 Jun 2024 21:27:49 +0200 Subject: [PATCH 6/6] Get downstream module test --- modules/nf-core/abricate/summary/tests/main.nf.test | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/nf-core/abricate/summary/tests/main.nf.test b/modules/nf-core/abricate/summary/tests/main.nf.test index 99a7f634dd6..6e22191504c 100644 --- a/modules/nf-core/abricate/summary/tests/main.nf.test +++ b/modules/nf-core/abricate/summary/tests/main.nf.test @@ -22,6 +22,7 @@ nextflow_process { tuple([ id:'test2', single_end:false ], file(params.test_data['haemophilus_influenzae']['genome']['genome_fna_gz'], checkIfExists: true)) ]) + input[1] = [] """ } }