From 98d318c0e0dfe97c3a9e7c241bb2e54557b3ccd4 Mon Sep 17 00:00:00 2001 From: JIANHONG OU Date: Sun, 24 Apr 2022 07:55:17 -0400 Subject: [PATCH] init --- modules/motus/profile/main.nf | 41 +++++++++++++++ modules/motus/profile/meta.yml | 55 +++++++++++++++++++++ tests/config/pytest_modules.yml | 4 ++ tests/modules/motus/profile/main.nf | 26 ++++++++++ tests/modules/motus/profile/nextflow.config | 5 ++ tests/modules/motus/profile/test.yml | 14 ++++++ 6 files changed, 145 insertions(+) create mode 100644 modules/motus/profile/main.nf create mode 100644 modules/motus/profile/meta.yml create mode 100644 tests/modules/motus/profile/main.nf create mode 100644 tests/modules/motus/profile/nextflow.config create mode 100644 tests/modules/motus/profile/test.yml diff --git a/modules/motus/profile/main.nf b/modules/motus/profile/main.nf new file mode 100644 index 00000000..3cf5961c --- /dev/null +++ b/modules/motus/profile/main.nf @@ -0,0 +1,41 @@ +process MOTUS_PROFILE { + tag "$meta.id" + label 'process_high' + + 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: + tuple val(meta), path(reads) + + output: + tuple val(meta), path("*.out"), emit: out + tuple val(meta), path("*.bam"), optional: true, emit: bam + 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 inputs = "$reads[0]".toLowerCase().endsWith('.bam') ? + "-i ${reads}" : + meta.single_end ? + "-s $reads" : "-f ${reads[0]} -r ${reads[1]}" + """ + motus profile \\ + $args \\ + $inputs \\ + -t $task.cpus \\ + -n ${prefix} \\ + -o ${prefix}.out + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + mOTUs: \$(echo \$(motus -h 2>&1) | sed 's/^.*Version: //; s/References.*\$//') + END_VERSIONS + """ +} diff --git a/modules/motus/profile/meta.yml b/modules/motus/profile/meta.yml new file mode 100644 index 00000000..94f6a9fc --- /dev/null +++ b/modules/motus/profile/meta.yml @@ -0,0 +1,55 @@ +name: "motus_profile" +description: Taxonomic meta-omics profiling using universal marker genes +keywords: + - classify + - metagenomics + - fastq + - taxonomic profiling +tools: + - "motus": + description: "Marker gene-based OTU (mOTU) profiling" + 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']" + +## TODO nf-core: Add a description of all of the variables used as input +input: + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + - reads: + type: file + description: | + List of input fastq/fasta files of size 1 and 2 for single-end and paired-end data, + respectively. + pattern: "*.{fastq,fq,fasta,fa,fastq.gz,fq.gz,fasta.gz,fa.gz}" + - db: + type: derectory + description: | + mOTUs database downloaded by `motus downloadDB` + +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" + - out: + type: file + description: Results with taxonomic classification of each read + pattern: "*.out" + - bam: + type: file + description: Sorted BAM file + pattern: "*.{bam}" + +authors: + - "@jianhong" diff --git a/tests/config/pytest_modules.yml b/tests/config/pytest_modules.yml index cd4913cf..028d236a 100644 --- a/tests/config/pytest_modules.yml +++ b/tests/config/pytest_modules.yml @@ -1194,6 +1194,10 @@ mosdepth: - modules/mosdepth/** - tests/modules/mosdepth/** +motus/profile: + - modules/motus/profile/** + - tests/modules/motus/profile/** + msisensor/msi: - modules/msisensor/msi/** - tests/modules/msisensor/msi/** diff --git a/tests/modules/motus/profile/main.nf b/tests/modules/motus/profile/main.nf new file mode 100644 index 00000000..54f51bd8 --- /dev/null +++ b/tests/modules/motus/profile/main.nf @@ -0,0 +1,26 @@ +#!/usr/bin/env nextflow + +nextflow.enable.dsl = 2 + +include { MOTUS_PROFILE } from '../../../../modules/motus/profile/main.nf' + +workflow test_motus_profile_single_end { + + input = [ + [ id:'test', single_end:false ], // meta map + file(params.test_data['sarscov2']['illumina']['test_1_fastq_gz'], checkIfExists: true) + ] + + MOTUS_PROFILE ( input ) +} + +workflow test_motus_profile_paired_end { + + input = [ + [ id:'test', single_end:false ], // meta map + [ file(params.test_data['sarscov2']['illumina']['test_1_fastq_gz'], checkIfExists: true), + file(params.test_data['sarscov2']['illumina']['test_2_fastq_gz'], checkIfExists: true) ] + ] + MOTUS_PROFILE ( input ) + +} diff --git a/tests/modules/motus/profile/nextflow.config b/tests/modules/motus/profile/nextflow.config new file mode 100644 index 00000000..50f50a7a --- /dev/null +++ b/tests/modules/motus/profile/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/profile/test.yml b/tests/modules/motus/profile/test.yml new file mode 100644 index 00000000..c4c69bb6 --- /dev/null +++ b/tests/modules/motus/profile/test.yml @@ -0,0 +1,14 @@ +## TODO nf-core: Please run the following command to build this file: +# nf-core modules create-test-yml motus/profile +- name: "motus profile" + command: nextflow run ./tests/modules/motus/profile -entry test_motus_profile -c ./tests/config/nextflow.config -c ./tests/modules/motus/profile/nextflow.config + tags: + - "motus" + # + - "motus/profile" + # + files: + - path: "output/motus/test.bam" + md5sum: e667c7caad0bc4b7ac383fd023c654fc + - path: output/motus/versions.yml + md5sum: a01fe51bc4c6a3a6226fbf77b2c7cf3b