From 9b50036e9b09451285673fcc906038cb1a40b9da Mon Sep 17 00:00:00 2001 From: JIANHONG OU Date: Fri, 6 May 2022 08:56:42 -0400 Subject: [PATCH] add test_bam and -m parameter for motus_profile --- modules/motus/profile/main.nf | 6 ++++-- modules/motus/profile/meta.yml | 12 ++++++++++-- tests/modules/motus/profile/main.nf | 12 ++++++++++++ tests/modules/motus/profile/test.yml | 9 +++++++++ 4 files changed, 35 insertions(+), 4 deletions(-) diff --git a/modules/motus/profile/main.nf b/modules/motus/profile/main.nf index 8b893d5a..9fd65384 100644 --- a/modules/motus/profile/main.nf +++ b/modules/motus/profile/main.nf @@ -14,6 +14,7 @@ process MOTUS_PROFILE { output: tuple val(meta), path("*.out"), emit: out tuple val(meta), path("*.bam"), optional: true, emit: bam + tuple val(meta), path("*.mgc"), optional: true, emit: mgc path "versions.yml" , emit: versions when: @@ -24,8 +25,9 @@ process MOTUS_PROFILE { def prefix = task.ext.prefix ?: "${meta.id}" def inputs = "$reads[0]".getExtension == ('.bam') ? "-i ${reads}" : - meta.single_end ? - "-s $reads" : "-f ${reads[0]} -r ${reads[1]}" + meta.mgc ? "-m $reads" : + meta.single_end ? + "-s $reads" : "-f ${reads[0]} -r ${reads[1]}" def refdb = db ? "-db ${db}" : "" """ motus profile \\ diff --git a/modules/motus/profile/meta.yml b/modules/motus/profile/meta.yml index e52d4bd5..ff8f990d 100644 --- a/modules/motus/profile/meta.yml +++ b/modules/motus/profile/meta.yml @@ -20,14 +20,18 @@ input: description: | Groovy Map containing sample information e.g. [ id:'test', single_end:false ] + If input file is the mgc read counts table, the mgc should be set to `true` + e.g. [ id:'test', single_end:false, mgc:true ] - reads: type: file description: | List of input fastq/fasta files of size 1 and 2 for single-end and paired-end data, respectively. 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}" + the output bam file from motus profile. + Or the intermediate mgc read counts table. Please note if mgc table is input, + the `mgc` in metadata must be `true`. + pattern: "*.{fastq,fq,fasta,fa,fastq.gz,fq.gz,fasta.gz,fa.gz,.bam,.tsv,.txt,.mgc}" - db: type: directory description: | @@ -51,6 +55,10 @@ output: type: file description: Optional intermediate sorted BAM file from BWA pattern: "*.{bam}" + - mgc: + type: file + description: Optional intermediate mgc read count table file saved with `-M`. + pattern: "*.{mgc}" authors: - "@jianhong" diff --git a/tests/modules/motus/profile/main.nf b/tests/modules/motus/profile/main.nf index 525b3f6d..d9806fd3 100644 --- a/tests/modules/motus/profile/main.nf +++ b/tests/modules/motus/profile/main.nf @@ -29,3 +29,15 @@ workflow test_motus_profile_paired_end { MOTUS_PROFILE ( input, MOTUS_DOWNLOADDB.out.db) } + +workflow test_motus_profile_bam { + + input = [ + [ id:'test', single_end:false ], // meta map + [ file(params.test_data['sarscov2']['illumina']['test_paired_end_sorted_bam'], checkIfExists: true) ] + ] + + MOTUS_DOWNLOADDB(file('https://raw.githubusercontent.com/motu-tool/mOTUs/master/motus/downloadDB.py')) + + MOTUS_PROFILE ( input, MOTUS_DOWNLOADDB.out.db) +} diff --git a/tests/modules/motus/profile/test.yml b/tests/modules/motus/profile/test.yml index f163adb4..9b80312d 100644 --- a/tests/modules/motus/profile/test.yml +++ b/tests/modules/motus/profile/test.yml @@ -15,3 +15,12 @@ files: - path: output/motus/test.out contains: ["#consensus_taxonomy\ttest"] + +- name: motus profile test_motus_profile_bam + command: nextflow run tests/modules/motus/profile -entry test_motus_profile_bam -c tests/config/nextflow.config + tags: + - motus + - motus/profile + files: + - path: output/motus/test.out + contains: ["#consensus_taxonomy\ttest"]