Skip to content

Commit

Permalink
Update hamronization/abricate (#4851)
Browse files Browse the repository at this point in the history
* abricate --migrate_pytest

* Complete nf-test + add stub

* Fix linting

* Fix linting

* Update test names

* Update stub test

* Stage proper input files for stub tests

* Remove `echo <command>` from main.nf
  • Loading branch information
jasmezz authored Feb 7, 2024
1 parent 0af92e0 commit be5430a
Show file tree
Hide file tree
Showing 10 changed files with 154 additions and 39 deletions.
2 changes: 1 addition & 1 deletion modules/nf-core/hamronization/abricate/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ channels:
- bioconda
- defaults
dependencies:
- bioconda::hamronization=1.1.1
- bioconda::hamronization=1.1.4
14 changes: 12 additions & 2 deletions modules/nf-core/hamronization/abricate/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ process HAMRONIZATION_ABRICATE {

conda "${moduleDir}/environment.yml"
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/hamronization:1.1.1--pyhdfd78af_0':
'biocontainers/hamronization:1.1.1--pyhdfd78af_0' }"
'https://depot.galaxyproject.org/singularity/hamronization:1.1.4--pyhdfd78af_0':
'biocontainers/hamronization:1.1.4--pyhdfd78af_0' }"

input:
tuple val(meta), path(report)
Expand Down Expand Up @@ -34,6 +34,16 @@ process HAMRONIZATION_ABRICATE {
--reference_database_version ${reference_db_version} \\
> ${prefix}.${format}
cat <<-END_VERSIONS > versions.yml
"${task.process}":
hamronization: \$(echo \$(hamronize --version 2>&1) | cut -f 2 -d ' ' )
END_VERSIONS
"""

stub:
def prefix = task.ext.prefix ?: "${meta.id}"
"""
touch ${prefix}.${format}
cat <<-END_VERSIONS > versions.yml
"${task.process}":
Expand Down
8 changes: 4 additions & 4 deletions modules/nf-core/hamronization/abricate/meta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ tools:
homepage: "https://github.com/pha4ge/hAMRonization/"
documentation: "https://github.com/pha4ge/hAMRonization/"
tool_dev_url: "https://github.com/pha4ge/hAMRonization"
licence: "['GNU Lesser General Public v3 (LGPL v3)']"
licence: ["GNU Lesser General Public v3 (LGPL v3)"]
input:
- meta:
type: map
Expand All @@ -23,15 +23,15 @@ input:
description: Output TSV or CSV file from ABRicate
pattern: "*.{csv,tsv}"
- format:
type: value
type: string
description: Type of report file to be produced
pattern: "tsv|json"
- software_version:
type: value
type: string
description: Version of ABRicate used
pattern: "[0-9].[0-9].[0-9]"
- reference_db_version:
type: value
type: string
description: Database version of ABRicate used
pattern: "[0-9][0-9][0-9][0-9]-[A-Z][a-z][a-z]-[0-9][0-9]"
output:
Expand Down
55 changes: 55 additions & 0 deletions modules/nf-core/hamronization/abricate/tests/main.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
nextflow_process {

name "Test Process HAMRONIZATION_ABRICATE"
script "../main.nf"
process "HAMRONIZATION_ABRICATE"

tag "modules"
tag "modules_nfcore"
tag "hamronization"
tag "hamronization/abricate"

test("hamronization/abricate - bacteroides_fragilis - genome_abricate_tsv") {

when {
process {
"""
input[0] = [ [ id:"test" ], file(params.test_data['bacteroides_fragilis']['hamronization']['genome_abricate_tsv'], checkIfExists: true) ]
input[1] = 'tsv'
input[2] = '1.0.1'
input[3] = '2021-Mar-27'
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(process.out).match() }
)
}
}

test("hamronization/abricate - bacteroides_fragilis - genome_abricate_tsv - stub") {

options "-stub"

when {
process {
"""
input[0] = [ [ id:"test" ], file(params.test_data['bacteroides_fragilis']['hamronization']['genome_abricate_tsv'], checkIfExists: true) ]
input[1] = 'tsv'
input[2] = '1.0.1'
input[3] = '2021-Mar-27'
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(process.out).match() }
)
}
}
}
80 changes: 80 additions & 0 deletions modules/nf-core/hamronization/abricate/tests/main.nf.test.snap

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions modules/nf-core/hamronization/abricate/tests/tags.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
hamronization/abricate:
- "modules/nf-core/hamronization/abricate/**"
3 changes: 0 additions & 3 deletions tests/config/pytest_modules.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1032,9 +1032,6 @@ gunc/run:
gvcftools/extractvariants:
- modules/nf-core/gvcftools/extractvariants/**
- tests/modules/nf-core/gvcftools/extractvariants/**
hamronization/abricate:
- modules/nf-core/hamronization/abricate/**
- tests/modules/nf-core/hamronization/abricate/**
hamronization/amrfinderplus:
- modules/nf-core/hamronization/amrfinderplus/**
- tests/modules/nf-core/hamronization/amrfinderplus/**
Expand Down
15 changes: 0 additions & 15 deletions tests/modules/nf-core/hamronization/abricate/main.nf

This file was deleted.

5 changes: 0 additions & 5 deletions tests/modules/nf-core/hamronization/abricate/nextflow.config

This file was deleted.

9 changes: 0 additions & 9 deletions tests/modules/nf-core/hamronization/abricate/test.yml

This file was deleted.

0 comments on commit be5430a

Please sign in to comment.