From ee04fc27377391c39cacd79641301f87af48cc4d Mon Sep 17 00:00:00 2001 From: JIANHONG OU Date: Thu, 14 Apr 2022 12:56:42 -0400 Subject: [PATCH] add module motus_downloaddb --- modules/motus/downloaddb/main.nf | 39 +++++++++++++++++++ modules/motus/downloaddb/meta.yml | 35 +++++++++++++++++ tests/config/pytest_modules.yml | 4 ++ tests/modules/motus/downloaddb/main.nf | 12 ++++++ .../modules/motus/downloaddb/nextflow.config | 5 +++ tests/modules/motus/downloaddb/test.yml | 9 +++++ 6 files changed, 104 insertions(+) create mode 100644 modules/motus/downloaddb/main.nf create mode 100644 modules/motus/downloaddb/meta.yml create mode 100644 tests/modules/motus/downloaddb/main.nf create mode 100644 tests/modules/motus/downloaddb/nextflow.config create mode 100644 tests/modules/motus/downloaddb/test.yml diff --git a/modules/motus/downloaddb/main.nf b/modules/motus/downloaddb/main.nf new file mode 100644 index 00000000..02e5c22d --- /dev/null +++ b/modules/motus/downloaddb/main.nf @@ -0,0 +1,39 @@ +process MOTUS_DOWNLOADDB { + label 'process_low' + + conda (params.enable_conda ? "bioconda::motus=3.0.1" : null) + container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? + 'https://depot.galaxyproject.org/singularity/motus:3.0.1--pyhdfd78af_0': + 'quay.io/biocontainers/motus:3.0.1--pyhdfd78af_0' }" + + input: + path motus_downloaddb + + output: + path "db_mOTU" , emit: db + path "versions.yml" , emit: versions + + when: + task.ext.when == null || task.ext.when + + script: + def args = task.ext.args ?: '' + """ + ## must copy file to working directory, + ## otherwise the reference_db will be download to bin folder + ## other than current directory + cp $motus_downloaddb ${motus_downloaddb.simpleName}_copy.py + python ${motus_downloaddb.simpleName}_copy.py \\ + -t $task.cpus + ## clean up + rm ${motus_downloaddb.simpleName}_copy.py + + ## mOTUs version number is not available from command line. + ## mOTUs save the version number in index database folder. + ## mOTUs will check the database version is same version as exec version. + cat <<-END_VERSIONS > versions.yml + "${task.process}": + mOTUs: \$(grep motus db_mOTU/db_mOTU_versions | sed 's/motus\\t//g') + END_VERSIONS + """ +} diff --git a/modules/motus/downloaddb/meta.yml b/modules/motus/downloaddb/meta.yml new file mode 100644 index 00000000..8557b2ed --- /dev/null +++ b/modules/motus/downloaddb/meta.yml @@ -0,0 +1,35 @@ +name: "motus_downloaddb" +description: Download the mOTUs database +keywords: + - classify + - metagenomics + - fastq + - taxonomic profiling +tools: + - "motus": + description: "The mOTU profiler is a computational tool that estimates relative taxonomic abundance of known and currently unknown microbial community members using metagenomic shotgun sequencing data." + homepage: "None" + documentation: "https://github.com/motu-tool/mOTUs/wiki" + tool_dev_url: "https://github.com/motu-tool/mOTUs" + doi: "10.1038/s41467-019-08844-4" + licence: "['GPL v3']" + +input: + - motus_downloaddb: + type: file + description: | + the mOTUs downloadDB source file + pattern: "*{.py}" + +output: + - versions: + type: file + description: File containing software versions + pattern: "versions.yml" + - db: + type: file + description: The mOTUs database + pattern: "db_mOTU" + +authors: + - "@jianhong" diff --git a/tests/config/pytest_modules.yml b/tests/config/pytest_modules.yml index cd4913cf..b11f5516 100644 --- a/tests/config/pytest_modules.yml +++ b/tests/config/pytest_modules.yml @@ -1194,6 +1194,10 @@ mosdepth: - modules/mosdepth/** - tests/modules/mosdepth/** +motus/downloaddb: + - modules/motus/downloaddb/** + - tests/modules/motus/downloaddb/** + msisensor/msi: - modules/msisensor/msi/** - tests/modules/msisensor/msi/** diff --git a/tests/modules/motus/downloaddb/main.nf b/tests/modules/motus/downloaddb/main.nf new file mode 100644 index 00000000..f7680ca9 --- /dev/null +++ b/tests/modules/motus/downloaddb/main.nf @@ -0,0 +1,12 @@ +#!/usr/bin/env nextflow + +nextflow.enable.dsl = 2 + +include { MOTUS_DOWNLOADDB } from '../../../../modules/motus/downloaddb/main.nf' + +workflow test_motus_downloaddb { + + input = file('https://raw.githubusercontent.com/motu-tool/mOTUs/master/motus/downloadDB.py') + + MOTUS_DOWNLOADDB ( input ) +} diff --git a/tests/modules/motus/downloaddb/nextflow.config b/tests/modules/motus/downloaddb/nextflow.config new file mode 100644 index 00000000..50f50a7a --- /dev/null +++ b/tests/modules/motus/downloaddb/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/motus/downloaddb/test.yml b/tests/modules/motus/downloaddb/test.yml new file mode 100644 index 00000000..ada5383a --- /dev/null +++ b/tests/modules/motus/downloaddb/test.yml @@ -0,0 +1,9 @@ +- name: motus downloaddb test_motus_downloaddb + command: nextflow run tests/modules/motus/downloaddb -entry test_motus_downloaddb -c tests/config/nextflow.config + tags: + - motus + - motus/downloaddb + files: + - path: output/motus/db_mOTU/db_mOTU_versions + - path: output/motus/versions.yml + md5sum: b9b843b2435b01bb430ee8780b5c639e