diff --git a/modules/nf-core/argnorm/environment.yml b/modules/nf-core/argnorm/environment.yml new file mode 100644 index 000000000000..771b87c9f08a --- /dev/null +++ b/modules/nf-core/argnorm/environment.yml @@ -0,0 +1,7 @@ +name: "argnorm" +channels: + - conda-forge + - bioconda + - defaults +dependencies: + - "bioconda::argnorm=0.5.0" diff --git a/modules/nf-core/argnorm/main.nf b/modules/nf-core/argnorm/main.nf new file mode 100644 index 000000000000..dde28b78ffaa --- /dev/null +++ b/modules/nf-core/argnorm/main.nf @@ -0,0 +1,40 @@ +process ARGNORM { + tag "$meta.id" + label 'process_low' + + 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(db) + val(hamronized) + val(tool) + + 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' + """ + argnorm \\ + $tool \\ + -i $input_tsv \\ + -o $prefix \\ + --db $db \\ + $hamronized + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + argnorm: $VERSION + END_VERSIONS + """ +} diff --git a/modules/nf-core/argnorm/meta.yml b/modules/nf-core/argnorm/meta.yml new file mode 100644 index 000000000000..5fdc6fe6d382 --- /dev/null +++ b/modules/nf-core/argnorm/meta.yml @@ -0,0 +1,65 @@ +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" + + - db: + type: string + description: Database used for ARG annotation + pattern: "sarg|ncbi|resfinder|deeparg|megares|argannot|resfinderfg" + + - hamronized: + type: string + description: Indicate ARG annotation output has been processed by hAMRonization + pattern: "|--hamronized" + + - tool: + type: string + description: ARG annotation tool used + pattern: "argsoap|abricate|deeparg|resfinder|amrfinderplus" + +output: + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1', single_end:false ]` + - versions: + type: file + description: File containing software versions + pattern: "versions.yml" + - tsv: + type: file + description: Normalized argNorm output + pattern: "*.tsv" + +authors: + - "@Vedanth-Ramji" +maintainers: + - "@Vedanth-Ramji" diff --git a/modules/nf-core/argnorm/tests/main.nf.test b/modules/nf-core/argnorm/tests/main.nf.test new file mode 100644 index 000000000000..95bb597445d4 --- /dev/null +++ b/modules/nf-core/argnorm/tests/main.nf.test @@ -0,0 +1,108 @@ +nextflow_process { + name "Test Process ARGNORM" + script "../main.nf" + process "ARGNORM" + + tag "modules" + tag "modules_nfcore" + tag "argnorm" + + test("argnorm - amrfinderplus_ncbi_raw - tsv") { + when { + process { + """ + input[0] = [ + [ id:'test.tsv', single_end:false ], // meta map + file("https://raw.githubusercontent.com/nf-core/test-datasets/modules/data/delete_me/amrfinderplus/test_output.tsv", checkIfExists: true) + ] + input[1] = 'ncbi' + input[2] = 'amrfinderplus' + input[3] = '' + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + } + + test("argnorm - amrfinderplus_ncbi_hamronized - tsv") { + when { + process { + """ + input[0] = [ + [ id:'test.tsv', single_end:false ], // meta map + file("https://raw.githubusercontent.com/BigDataBiology/argNorm/main/examples/hamronized/amrfinderplus.ncbi.orfs.tsv", checkIfExists: true) + ] + input[1] = 'ncbi' + input[2] = 'amrfinderplus' + input[3] = '--hamronized' + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + } + + test("argnorm - amrfinderplus_ncbi_hamronized - tsv - stub") { + options "-stub" + + when { + process { + """ + input[0] = [ + [ id:'test.tsv', single_end:false ], // meta map + file("https://raw.githubusercontent.com/BigDataBiology/argNorm/main/examples/hamronized/amrfinderplus.ncbi.orfs.tsv", checkIfExists: true) + ] + input[1] = 'ncbi' + input[2] = 'amrfinderplus' + input[3] = '--hamronized' + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + } + + test("argnorm - amrfinderplus_ncbi - tsv - stub") { + + options "-stub" + + when { + process { + """ + input[0] = [ + [ id:'test.tsv', single_end:false ], // meta map + file("https://raw.githubusercontent.com/BigDataBiology/argNorm/main/examples/raw/amrfinderplus.ncbi.orfs.tsv", checkIfExists: true) + ] + input[1] = 'ncbi' + input[2] = 'amrfinderplus' + input[3] = '' + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + + } + +} diff --git a/modules/nf-core/argnorm/tests/main.nf.test.snap b/modules/nf-core/argnorm/tests/main.nf.test.snap new file mode 100644 index 000000000000..6492df6cf2b1 --- /dev/null +++ b/modules/nf-core/argnorm/tests/main.nf.test.snap @@ -0,0 +1,142 @@ +{ + "argnorm - amrfinderplus_ncbi_raw - tsv": { + "content": [ + { + "0": [ + [ + { + "id": "test.tsv", + "single_end": false + }, + "test.tsv:md5,f870c239182592a065d9f80732b39bba" + ] + ], + "1": [ + "versions.yml:md5,e200075d98a6f59137f105efceea0426" + ], + "tsv": [ + [ + { + "id": "test.tsv", + "single_end": false + }, + "test.tsv:md5,f870c239182592a065d9f80732b39bba" + ] + ], + "versions": [ + "versions.yml:md5,e200075d98a6f59137f105efceea0426" + ] + } + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "24.04.2" + }, + "timestamp": "2024-07-02T14:56:50.742114812" + }, + "argnorm - amrfinderplus_ncbi_hamronized - tsv": { + "content": [ + { + "0": [ + [ + { + "id": "test.tsv", + "single_end": false + }, + "test.tsv:md5,1f9a3820f09fd6a818af372dfe5cf322" + ] + ], + "1": [ + "versions.yml:md5,e200075d98a6f59137f105efceea0426" + ], + "tsv": [ + [ + { + "id": "test.tsv", + "single_end": false + }, + "test.tsv:md5,1f9a3820f09fd6a818af372dfe5cf322" + ] + ], + "versions": [ + "versions.yml:md5,e200075d98a6f59137f105efceea0426" + ] + } + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "24.04.2" + }, + "timestamp": "2024-07-02T14:57:19.694510786" + }, + "argnorm - amrfinderplus_ncbi_hamronized - tsv - stub": { + "content": [ + { + "0": [ + [ + { + "id": "test.tsv", + "single_end": false + }, + "test.tsv:md5,1f9a3820f09fd6a818af372dfe5cf322" + ] + ], + "1": [ + "versions.yml:md5,e200075d98a6f59137f105efceea0426" + ], + "tsv": [ + [ + { + "id": "test.tsv", + "single_end": false + }, + "test.tsv:md5,1f9a3820f09fd6a818af372dfe5cf322" + ] + ], + "versions": [ + "versions.yml:md5,e200075d98a6f59137f105efceea0426" + ] + } + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "24.04.2" + }, + "timestamp": "2024-07-02T14:57:47.422476341" + }, + "argnorm - amrfinderplus_ncbi - tsv - stub": { + "content": [ + { + "0": [ + [ + { + "id": "test.tsv", + "single_end": false + }, + "test.tsv:md5,e41b52c1213d8833c37472e3efb24db4" + ] + ], + "1": [ + "versions.yml:md5,e200075d98a6f59137f105efceea0426" + ], + "tsv": [ + [ + { + "id": "test.tsv", + "single_end": false + }, + "test.tsv:md5,e41b52c1213d8833c37472e3efb24db4" + ] + ], + "versions": [ + "versions.yml:md5,e200075d98a6f59137f105efceea0426" + ] + } + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "24.04.2" + }, + "timestamp": "2024-07-02T14:58:14.950164297" + } +} \ No newline at end of file diff --git a/modules/nf-core/argnorm/tests/tags.yml b/modules/nf-core/argnorm/tests/tags.yml new file mode 100644 index 000000000000..a2b6e8d0d8ca --- /dev/null +++ b/modules/nf-core/argnorm/tests/tags.yml @@ -0,0 +1,2 @@ +argnorm: + - "modules/nf-core/argnorm/**"