forked from nf-core/modules
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* ADD argnorm module * ENH correct pattern for 'hamronized' input * ENH specify hamronization command in script * ENH don't pass 'hamronized' as val * Fixed trailing whitespace * "single_end" is not relevant in this module * alignment * "db_args" to avoid any confusion with the input channel * Added a test to check $tool is provided * Implemented the stub mode * Added a test for the missing database * Reordered the arguments to match the script --------- Co-authored-by: Matthieu Muffato <[email protected]>
- Loading branch information
1 parent
c274982
commit e4fc46a
Showing
8 changed files
with
436 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
name: "argnorm" | ||
channels: | ||
- conda-forge | ||
- bioconda | ||
- defaults | ||
dependencies: | ||
- "bioconda::argnorm=0.5.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
process ARGNORM { | ||
tag "$meta.id" | ||
label 'process_low' | ||
// WARN: Version information not provided by tool on CLI. Please update version string below when bumping container versions. | ||
conda "${moduleDir}/environment.yml" | ||
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? | ||
'https://depot.galaxyproject.org/singularity/argnorm:0.5.0--pyhdfd78af_0': | ||
'biocontainers/argnorm:0.5.0--pyhdfd78af_0' }" | ||
|
||
input: | ||
tuple val(meta), path(input_tsv) | ||
val tool | ||
val db | ||
|
||
output: | ||
tuple val(meta), path("*.tsv"), emit: tsv | ||
path "versions.yml" , emit: versions | ||
|
||
when: | ||
task.ext.when == null || task.ext.when | ||
|
||
script: | ||
def args = task.ext.args ?: '' | ||
def prefix = task.ext.prefix ?: "${meta.id}" | ||
def VERSION = '0.5.0' // WARN: Version information not provided by tool on CLI. Please update this string when bumping container versions. | ||
def db_args = db ? "--db ${db}" : "" | ||
if (!tool) { | ||
error 'Tool not provided.' | ||
} | ||
if ((tool in ["abricate"]) && !db) { | ||
error "$tool requires a database but <db> not provided." | ||
} | ||
|
||
""" | ||
argnorm \\ | ||
$tool \\ | ||
-i $input_tsv \\ | ||
-o $prefix \\ | ||
$db_args \\ | ||
$args | ||
cat <<-END_VERSIONS > versions.yml | ||
"${task.process}": | ||
argnorm: $VERSION | ||
END_VERSIONS | ||
""" | ||
|
||
stub: | ||
def args = task.ext.args ?: '' | ||
def prefix = task.ext.prefix ?: "${meta.id}" | ||
def VERSION = '0.5.0' // WARN: Version information not provided by tool on CLI. Please update this string when bumping container versions. | ||
if (!tool) { | ||
error 'Tool not provided.' | ||
} | ||
if ((tool in ["abricate"]) && !db) { | ||
error "$tool requires a database but <db> not provided." | ||
} | ||
|
||
""" | ||
touch ${prefix} | ||
cat <<-END_VERSIONS > versions.yml | ||
"${task.process}": | ||
argnorm: $VERSION | ||
END_VERSIONS | ||
""" | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
name: "argnorm" | ||
description: Normalize antibiotic resistance genes (ARGs) using the ARO ontology (developed by CARD). | ||
keywords: | ||
- amr | ||
- antimicrobial resistance | ||
- arg | ||
- antimicrobial resistance genes | ||
- genomics | ||
- metagenomics | ||
- normalization | ||
- drug categorization | ||
tools: | ||
- "argnorm": | ||
description: "Normalize antibiotic resistance genes (ARGs) using the ARO ontology (developed by CARD)." | ||
homepage: "https://argnorm.readthedocs.io/en/latest/" | ||
documentation: "https://argnorm.readthedocs.io/en/latest/" | ||
tool_dev_url: "https://github.com/BigDataBiology/argNorm" | ||
licence: ["MIT"] | ||
|
||
input: | ||
- meta: | ||
type: map | ||
description: | | ||
Groovy Map containing sample information | ||
e.g. `[ id:'sample1', single_end:false ]` | ||
- input_tsv: | ||
type: file | ||
description: ARG annotation output | ||
pattern: "*.tsv" | ||
|
||
- tool: | ||
type: string | ||
description: ARG annotation tool used | ||
pattern: "argsoap|abricate|deeparg|resfinder|amrfinderplus" | ||
|
||
- db: | ||
type: string | ||
description: Database used for ARG annotation | ||
pattern: "sarg|ncbi|resfinder|deeparg|megares|argannot|resfinderfg" | ||
|
||
output: | ||
- meta: | ||
type: map | ||
description: | | ||
Groovy Map containing sample information | ||
e.g. `[ id:'sample1', single_end:false ]` | ||
- tsv: | ||
type: file | ||
description: Normalized argNorm output | ||
pattern: "*.tsv" | ||
- versions: | ||
type: file | ||
description: File containing software versions | ||
pattern: "versions.yml" | ||
|
||
authors: | ||
- "@Vedanth-Ramji" | ||
maintainers: | ||
- "@Vedanth-Ramji" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
process { | ||
withName: ARGNORM { | ||
ext.args = '--hamronized' | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
process { | ||
withName: ARGNORM { | ||
ext.args = '' | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,155 @@ | ||
nextflow_process { | ||
name "Test Process ARGNORM" | ||
script "../main.nf" | ||
process "ARGNORM" | ||
|
||
tag "modules" | ||
tag "modules_nfcore" | ||
tag "argnorm" | ||
|
||
test("argnorm - amrfinderplus_ncbi_raw - tsv") { | ||
config './argnorm_raw.config' | ||
|
||
when { | ||
process { | ||
""" | ||
input[0] = [ | ||
[ id:'argnorm_raw.tsv' ], // meta map | ||
file("https://raw.githubusercontent.com/nf-core/test-datasets/modules/data/delete_me/amrfinderplus/test_output.tsv", checkIfExists: true) | ||
] | ||
input[1] = 'amrfinderplus' | ||
input[2] = 'ncbi' | ||
""" | ||
} | ||
} | ||
|
||
then { | ||
assertAll( | ||
{ assert process.success }, | ||
{ assert snapshot(process.out).match() } | ||
) | ||
} | ||
} | ||
|
||
test("argnorm - amrfinderplus_ncbi_hamronized - tsv") { | ||
config './argnorm_hamronized.config' | ||
|
||
when { | ||
process { | ||
""" | ||
input[0] = [ | ||
[ id:'argnorm_hamronized.tsv' ], // meta map | ||
file("https://raw.githubusercontent.com/BigDataBiology/argNorm/main/examples/hamronized/amrfinderplus.ncbi.orfs.tsv", checkIfExists: true) | ||
] | ||
input[1] = 'amrfinderplus' | ||
input[2] = 'ncbi' | ||
""" | ||
} | ||
} | ||
|
||
then { | ||
assertAll( | ||
{ assert process.success }, | ||
{ assert snapshot(process.out).match() } | ||
) | ||
} | ||
} | ||
|
||
test("argnorm - missing tool") { | ||
|
||
when { | ||
process { | ||
""" | ||
input[0] = [ | ||
[ id:'argnorm_raw.tsv' ], // meta map | ||
file("https://raw.githubusercontent.com/nf-core/test-datasets/modules/data/delete_me/amrfinderplus/test_output.tsv", checkIfExists: true) | ||
] | ||
input[1] = [] | ||
input[2] = [] | ||
""" | ||
} | ||
} | ||
|
||
then { | ||
assertAll( | ||
{ assert !process.success }, | ||
{ assert process.stdout.toString().contains("Tool not provided") } | ||
) | ||
} | ||
} | ||
|
||
test("argnorm - missing db") { | ||
|
||
when { | ||
process { | ||
""" | ||
input[0] = [ | ||
[ id:'argnorm_raw.tsv' ], // meta map | ||
file("https://raw.githubusercontent.com/nf-core/test-datasets/modules/data/delete_me/amrfinderplus/test_output.tsv", checkIfExists: true) | ||
] | ||
input[1] = "abricate" | ||
input[2] = [] | ||
""" | ||
} | ||
} | ||
|
||
then { | ||
assertAll( | ||
{ assert !process.success }, | ||
{ assert process.stdout.toString().contains("abricate requires a database but <db> not provided.") } | ||
) | ||
} | ||
} | ||
|
||
test("argnorm - amrfinderplus_ncbi_hamronized - tsv - stub") { | ||
options "-stub" | ||
config './argnorm_hamronized.config' | ||
|
||
when { | ||
process { | ||
""" | ||
input[0] = [ | ||
[ id:'argnorm_hamronized_stub.tsv' ], // meta map | ||
file("https://raw.githubusercontent.com/BigDataBiology/argNorm/main/examples/hamronized/amrfinderplus.ncbi.orfs.tsv", checkIfExists: true) | ||
] | ||
input[1] = 'amrfinderplus' | ||
input[2] = 'ncbi' | ||
""" | ||
} | ||
} | ||
|
||
then { | ||
assertAll( | ||
{ assert process.success }, | ||
{ assert snapshot(process.out).match() } | ||
) | ||
} | ||
} | ||
|
||
test("argnorm - amrfinderplus_ncbi - tsv - stub") { | ||
|
||
options "-stub" | ||
config './argnorm_raw.config' | ||
|
||
when { | ||
process { | ||
""" | ||
input[0] = [ | ||
[ id:'argnorm_raw_stub.tsv' ], // meta map | ||
file("https://raw.githubusercontent.com/BigDataBiology/argNorm/main/examples/raw/amrfinderplus.ncbi.orfs.tsv", checkIfExists: true) | ||
] | ||
input[1] = 'amrfinderplus' | ||
input[2] = 'ncbi' | ||
""" | ||
} | ||
} | ||
|
||
then { | ||
assertAll( | ||
{ assert process.success }, | ||
{ assert snapshot(process.out).match() } | ||
) | ||
} | ||
} | ||
|
||
} |
Oops, something went wrong.