From 2d38566eca4cc15142b2ffa7c11837569b39aece Mon Sep 17 00:00:00 2001 From: "James A. Fellows Yates" Date: Tue, 12 Apr 2022 08:35:36 +0200 Subject: [PATCH] Add MEGAN/RMA2INFO (#1513) * fix: remove left-over unnecessary code * Add megan/rma2info * Attempt at fixing test * Right yml formatting * Get the versios reporting correct --- modules/megan/rma2info/main.nf | 38 +++++++++++++++ modules/megan/rma2info/meta.yml | 51 ++++++++++++++++++++ tests/config/pytest_modules.yml | 4 ++ tests/modules/megan/rma2info/main.nf | 16 ++++++ tests/modules/megan/rma2info/nextflow.config | 9 ++++ tests/modules/megan/rma2info/test.yml | 12 +++++ 6 files changed, 130 insertions(+) create mode 100644 modules/megan/rma2info/main.nf create mode 100644 modules/megan/rma2info/meta.yml create mode 100644 tests/modules/megan/rma2info/main.nf create mode 100644 tests/modules/megan/rma2info/nextflow.config create mode 100644 tests/modules/megan/rma2info/test.yml diff --git a/modules/megan/rma2info/main.nf b/modules/megan/rma2info/main.nf new file mode 100644 index 00000000..80d1975d --- /dev/null +++ b/modules/megan/rma2info/main.nf @@ -0,0 +1,38 @@ +process MEGAN_RMA2INFO { + tag "$meta.id" + label 'process_low' + + conda (params.enable_conda ? "bioconda::megan=6.21.7" : null) + container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? + 'https://depot.galaxyproject.org/singularity/megan:6.21.7--h9ee0642_0': + 'quay.io/biocontainers/megan:6.21.7--h9ee0642_0' }" + + input: + tuple val(meta), path(rma6) + val(megan_summary) + + output: + tuple val(meta), path("*.txt.gz") , emit: txt + tuple val(meta), path("*.megan"), optional: true, emit: megan_summary + 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 summary = megan_summary ? "-es ${prefix}.megan" : "" + """ + rma2info \\ + -i ${rma6} \\ + -o ${prefix}.txt.gz \\ + ${summary} \\ + $args + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + megan: \$(echo \$(rma2info 2>&1) | grep version | sed 's/.*version //g;s/, built.*//g') + END_VERSIONS + """ +} diff --git a/modules/megan/rma2info/meta.yml b/modules/megan/rma2info/meta.yml new file mode 100644 index 00000000..0f2d5a9b --- /dev/null +++ b/modules/megan/rma2info/meta.yml @@ -0,0 +1,51 @@ +name: "megan_rma2info" +description: Analyses an RMA file and exports information in text format +keywords: + - megan + - rma6 + - classification + - conversion +tools: + - "megan": + description: "A tool for studying the taxonomic content of a set of DNA reads" + homepage: "https://uni-tuebingen.de/fakultaeten/mathematisch-naturwissenschaftliche-fakultaet/fachbereiche/informatik/lehrstuehle/algorithms-in-bioinformatics/software/megan6/" + documentation: "https://software-ab.informatik.uni-tuebingen.de/download/megan6/welcome.html" + tool_dev_url: "https://github.com/husonlab/megan-ce" + doi: "10.1371/journal.pcbi.1004957" + licence: "['GPL >=3']" + +input: + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + - rma6: + type: file + description: RMA6 file from MEGAN or MALT + pattern: "*.rma6" + - megan_summary: + type: boolean + description: Specify whether to generate an MEGAN summary file + +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" + - txt: + type: file + description: Compressed text file + pattern: "*.txt.gz" + - megan_summary: + type: file + description: Optionally generated MEGAN summary file + pattern: "*.megan" + +authors: + - "@jfy133" diff --git a/tests/config/pytest_modules.yml b/tests/config/pytest_modules.yml index c0e84cbc..94bf4e91 100644 --- a/tests/config/pytest_modules.yml +++ b/tests/config/pytest_modules.yml @@ -1138,6 +1138,10 @@ megahit: - modules/megahit/** - tests/modules/megahit/** +megan/rma2info: + - modules/megan/rma2info/** + - tests/modules/megan/rma2info/** + meningotype: - modules/meningotype/** - tests/modules/meningotype/** diff --git a/tests/modules/megan/rma2info/main.nf b/tests/modules/megan/rma2info/main.nf new file mode 100644 index 00000000..edbe9a49 --- /dev/null +++ b/tests/modules/megan/rma2info/main.nf @@ -0,0 +1,16 @@ +#!/usr/bin/env nextflow + +nextflow.enable.dsl = 2 + +include { MEGAN_RMA2INFO } from '../../../../modules/megan/rma2info/main.nf' + +workflow test_megan_rma2info { + + input = [ + [ id:'test', single_end:false ], // meta map + file('https://github.com/nf-core/test-datasets/raw/a7e61654553887475a2f7178108587ecd9b54608/data/delete_me/malt/test.rma6', checkIfExists: true) + ] + megan_summary = true + + MEGAN_RMA2INFO ( input, megan_summary ) +} diff --git a/tests/modules/megan/rma2info/nextflow.config b/tests/modules/megan/rma2info/nextflow.config new file mode 100644 index 00000000..3fd8dcdb --- /dev/null +++ b/tests/modules/megan/rma2info/nextflow.config @@ -0,0 +1,9 @@ +process { + + publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" } + + withName: MEGAN_RMA2INFO { + ext.args = "-c2c Taxonomy" + } + +} diff --git a/tests/modules/megan/rma2info/test.yml b/tests/modules/megan/rma2info/test.yml new file mode 100644 index 00000000..dc845bea --- /dev/null +++ b/tests/modules/megan/rma2info/test.yml @@ -0,0 +1,12 @@ +- name: megan rma2info test_megan_rma2info + command: nextflow run tests/modules/megan/rma2info -entry test_megan_rma2info -c tests/config/nextflow.config + tags: + - megan + - megan/rma2info + files: + - path: output/megan/test.megan + contains: + - "@Creator" + - path: output/megan/test.txt.gz + md5sum: 5c3b876aa0abef12158bcd7c3702740f + - path: output/megan/versions.yml