From fb5c5d310abfdd4267eb5bd5f3d90596db597097 Mon Sep 17 00:00:00 2001 From: JIANHONG OU Date: Thu, 5 May 2022 13:38:46 -0400 Subject: [PATCH] update motus module. --- modules/motus/profile/main.nf | 13 +++++++++---- modules/motus/profile/meta.yml | 9 +++------ tests/modules/motus/profile/main.nf | 6 +++--- tests/modules/motus/profile/test.yml | 27 +++++++++++++++------------ 4 files changed, 30 insertions(+), 25 deletions(-) diff --git a/modules/motus/profile/main.nf b/modules/motus/profile/main.nf index 23ee2531..99004ee6 100644 --- a/modules/motus/profile/main.nf +++ b/modules/motus/profile/main.nf @@ -10,7 +10,6 @@ process MOTUS_PROFILE { input: tuple val(meta), path(reads) path db - path bam output: tuple val(meta), path("*.out"), emit: out @@ -28,20 +27,26 @@ process MOTUS_PROFILE { meta.single_end ? "-s $reads" : "-f ${reads[0]} -r ${reads[1]}" def refdb = db ? "-db ${db}" : "" - def intermediateBam = bam ? "-I $bam" : "" """ motus profile \\ $args \\ $inputs \\ $refdb \\ - $intermediateBam \\ -t $task.cpus \\ -n $prefix \\ -o ${prefix}.out + ## 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. + if [ "$refdb" == "" ]; then + VERSION=\$(echo \$(motus -h 2>&1) | sed 's/^.*Version: //; s/References.*\$//') + else + VERSION=\$(grep motus $refdb/db_mOTU_versions | sed 's/motus\\t//g') + fi cat <<-END_VERSIONS > versions.yml "${task.process}": - mOTUs: \$(echo \$(motus -h 2>&1) | sed 's/^.*Version: //; s/References.*\$//') + mOTUs: \$VERSION END_VERSIONS """ } diff --git a/modules/motus/profile/meta.yml b/modules/motus/profile/meta.yml index 98b24c45..2e4a7997 100644 --- a/modules/motus/profile/meta.yml +++ b/modules/motus/profile/meta.yml @@ -25,16 +25,13 @@ input: 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}" + Or the intermediate bam file mapped by bwa to the mOTUs database or + the output bam file from motus profile + pattern: "*.{fastq,fq,fasta,fa,fastq.gz,fq.gz,fasta.gz,fa.gz,.bam}" - db: type: derectory description: | mOTUs database downloaded by `motus downloadDB` - - bam: - type: file - description: | - The intermediate bam file mapped by bwa to the mOTUs database or - the output bam file from motus profile output: - meta: diff --git a/tests/modules/motus/profile/main.nf b/tests/modules/motus/profile/main.nf index e6fdc23b..d06c73ab 100644 --- a/tests/modules/motus/profile/main.nf +++ b/tests/modules/motus/profile/main.nf @@ -8,13 +8,13 @@ include { MOTUS_PROFILE } from '../../../../modules/motus/profile/main.nf' workflow test_motus_profile_single_end { input = [ - [ id:'test', single_end:false ], // meta map + [ id:'test', single_end:true ], // meta map file(params.test_data['sarscov2']['illumina']['test_1_fastq_gz'], checkIfExists: true) ] MOTUS_DOWNLOADDB(file('https://raw.githubusercontent.com/motu-tool/mOTUs/master/motus/downloadDB.py')) - MOTUS_PROFILE ( input, MOTUS_DOWNLOADDB.out.db, []) + MOTUS_PROFILE ( input, MOTUS_DOWNLOADDB.out.db) } workflow test_motus_profile_paired_end { @@ -27,5 +27,5 @@ workflow test_motus_profile_paired_end { MOTUS_DOWNLOADDB(file('https://raw.githubusercontent.com/motu-tool/mOTUs/master/motus/downloadDB.py')) - MOTUS_PROFILE ( input, MOTUS_DOWNLOADDB.out.db, []) + MOTUS_PROFILE ( input, MOTUS_DOWNLOADDB.out.db) } diff --git a/tests/modules/motus/profile/test.yml b/tests/modules/motus/profile/test.yml index c4c69bb6..f163adb4 100644 --- a/tests/modules/motus/profile/test.yml +++ b/tests/modules/motus/profile/test.yml @@ -1,14 +1,17 @@ -## 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 +- name: motus profile test_motus_profile_single_end + command: nextflow run tests/modules/motus/profile -entry test_motus_profile_single_end -c tests/config/nextflow.config tags: - - "motus" - # - - "motus/profile" - # + - motus + - motus/profile files: - - path: "output/motus/test.bam" - md5sum: e667c7caad0bc4b7ac383fd023c654fc - - path: output/motus/versions.yml - md5sum: a01fe51bc4c6a3a6226fbf77b2c7cf3b + - path: output/motus/test.out + contains: ["#consensus_taxonomy\ttest"] + +- name: motus profile test_motus_profile_paired_end + command: nextflow run tests/modules/motus/profile -entry test_motus_profile_paired_end -c tests/config/nextflow.config + tags: + - motus + - motus/profile + files: + - path: output/motus/test.out + contains: ["#consensus_taxonomy\ttest"]