Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Abricate to include (missing) additional optional input channel and add stub #5849

Merged
merged 9 commits into from
Jun 19, 2024
19 changes: 18 additions & 1 deletion modules/nf-core/abricate/run/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ process ABRICATE_RUN {

input:
tuple val(meta), path(assembly)
path databasedir

output:
tuple val(meta), path("*.txt"), emit: report
Expand All @@ -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}' : ''
jfy133 marked this conversation as resolved.
Show resolved Hide resolved
"""
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}":
Expand Down
4 changes: 4 additions & 0 deletions modules/nf-core/abricate/run/meta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
30 changes: 29 additions & 1 deletion modules/nf-core/abricate/run/tests/main.nf.test
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ nextflow_process {
tag "abricate"
tag "abricate/run"

test("Should run without failures") {
test("bacteroides_fragilis - genome") {
jfy133 marked this conversation as resolved.
Show resolved Hide resolved

when {
params {
Expand All @@ -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] = []
"""
}
}
Expand Down
43 changes: 41 additions & 2 deletions modules/nf-core/abricate/run/tests/main.nf.test.snap
Original file line number Diff line number Diff line change
@@ -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": [
Expand Down Expand Up @@ -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"
}
}
Loading