From 8055c5d1c3920ae1f579a428bdd181f7beb2d302 Mon Sep 17 00:00:00 2001 From: "Robert A. Petit III" Date: Fri, 18 Feb 2022 17:23:44 -0700 Subject: [PATCH] add module for rgi (#1321) * add module for rgi * fix extension * fix test yaml * Update main.nf * Update main.nf --- modules/rgi/main/main.nf | 37 ++++++++++++++++++++ modules/rgi/main/meta.yml | 47 ++++++++++++++++++++++++++ tests/config/pytest_modules.yml | 4 +++ tests/modules/rgi/main/main.nf | 15 ++++++++ tests/modules/rgi/main/nextflow.config | 5 +++ tests/modules/rgi/main/test.yml | 12 +++++++ 6 files changed, 120 insertions(+) create mode 100644 modules/rgi/main/main.nf create mode 100644 modules/rgi/main/meta.yml create mode 100644 tests/modules/rgi/main/main.nf create mode 100644 tests/modules/rgi/main/nextflow.config create mode 100644 tests/modules/rgi/main/test.yml diff --git a/modules/rgi/main/main.nf b/modules/rgi/main/main.nf new file mode 100644 index 00000000..bf00d333 --- /dev/null +++ b/modules/rgi/main/main.nf @@ -0,0 +1,37 @@ +process RGI_MAIN { + tag "$meta.id" + label 'process_medium' + + conda (params.enable_conda ? "bioconda::rgi=5.2.1" : null) + container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? + 'https://depot.galaxyproject.org/singularity/rgi:5.2.1--pyha8f3691_2': + 'quay.io/biocontainers/rgi:5.2.1--pyha8f3691_2' }" + + input: + tuple val(meta), path(fasta) + + output: + tuple val(meta), path("*.json"), emit: json + tuple val(meta), path("*.txt") , 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}" + """ + rgi \\ + main \\ + $args \\ + --num_threads $task.cpus \\ + --output_file $prefix \\ + --input_sequence $fasta + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + rgi: \$(rgi main --version) + END_VERSIONS + """ +} diff --git a/modules/rgi/main/meta.yml b/modules/rgi/main/meta.yml new file mode 100644 index 00000000..cd97ff92 --- /dev/null +++ b/modules/rgi/main/meta.yml @@ -0,0 +1,47 @@ +name: rgi_main +description: Predict antibiotic resistance from protein or nucleotide data +keywords: + - bacteria + - fasta + - antibiotic resistance +tools: + - rgi: + description: This tool provides a preliminary annotation of your DNA sequence(s) based upon the data available in The Comprehensive Antibiotic Resistance Database (CARD). Hits to genes tagged with Antibiotic Resistance ontology terms will be highlighted. As CARD expands to include more pathogens, genomes, plasmids, and ontology terms this tool will grow increasingly powerful in providing first-pass detection of antibiotic resistance associated genes. See license at CARD website + homepage: https://card.mcmaster.ca + documentation: https://github.com/arpcard/rgi + tool_dev_url: https://github.com/arpcard/rgi + doi: "10.1093/nar/gkz935" + licence: ['https://card.mcmaster.ca/about'] + +input: + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + - fasta: + type: file + description: Nucleotide or protein sequences in FASTA format + pattern: "*.{fasta,fasta.gz,fa,fa.gz,fna,fna.gz,faa,faa.gz}" + +output: + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + - versions: + type: file + description: File containing software versions + pattern: "versions.yml" + - json: + type: file + description: JSON formatted file with RGI results + pattern: "*.{json}" + - tsv: + type: file + description: Tab-delimited file with RGI results + pattern: "*.{txt}" + +authors: + - "@rpetit3" diff --git a/tests/config/pytest_modules.yml b/tests/config/pytest_modules.yml index 8ed68dca..9aa4c754 100644 --- a/tests/config/pytest_modules.yml +++ b/tests/config/pytest_modules.yml @@ -1261,6 +1261,10 @@ raxmlng: - modules/raxmlng/** - tests/modules/raxmlng/** +rgi/main: + - modules/rgi/main/** + - tests/modules/rgi/main/** + rmarkdownnotebook: - modules/rmarkdownnotebook/** - tests/modules/rmarkdownnotebook/** diff --git a/tests/modules/rgi/main/main.nf b/tests/modules/rgi/main/main.nf new file mode 100644 index 00000000..9182a154 --- /dev/null +++ b/tests/modules/rgi/main/main.nf @@ -0,0 +1,15 @@ +#!/usr/bin/env nextflow + +nextflow.enable.dsl = 2 + +include { RGI_MAIN } from '../../../../modules/rgi/main/main.nf' + +workflow test_rgi_main { + + input = [ + [ id:'test', single_end:false ], // meta map + file(params.test_data['haemophilus_influenzae']['genome']['genome_fna_gz'], checkIfExists: true) + ] + + RGI_MAIN ( input ) +} diff --git a/tests/modules/rgi/main/nextflow.config b/tests/modules/rgi/main/nextflow.config new file mode 100644 index 00000000..50f50a7a --- /dev/null +++ b/tests/modules/rgi/main/nextflow.config @@ -0,0 +1,5 @@ +process { + + publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" } + +} \ No newline at end of file diff --git a/tests/modules/rgi/main/test.yml b/tests/modules/rgi/main/test.yml new file mode 100644 index 00000000..65d4ad9f --- /dev/null +++ b/tests/modules/rgi/main/test.yml @@ -0,0 +1,12 @@ +- name: rgi main + command: nextflow run ./tests/modules/rgi/main -entry test_rgi_main -c ./tests/config/nextflow.config -c ./tests/modules/rgi/main/nextflow.config + tags: + - rgi + - rgi/main + files: + - path: output/rgi/test.json + contains: ["NZ_LS483480", "orf_end", "perc_identity", "Pulvomycin"] + - path: output/rgi/test.txt + contains: ["NZ_LS483480", "ORF_ID", "Model_type", "Pulvomycin"] + - path: output/rgi/versions.yml + md5sum: 614a45d9d59680d4e743498773cf830a