diff --git a/modules/nf-core/abricate/run/main.nf b/modules/nf-core/abricate/run/main.nf index 5ec8a9a787c..b0d8a68a1cc 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..927c21f60f9 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: Optional 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..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("Should run without failures") { + test("bacteroides_fragilis - genome.fa.gz") { when { params { @@ -20,6 +20,34 @@ nextflow_process { [ 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 { + 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] = [] """ } } 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 diff --git a/modules/nf-core/abricate/summary/tests/main.nf.test b/modules/nf-core/abricate/summary/tests/main.nf.test index f504f99b71f..6e22191504c 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") { @@ -21,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] = [] """ } }