Update MOTUS/MERGE (#2068)

* Update main.nf

* Update meta.yml

* Re-add logos as not staged in a way that works with MultiQC config files

* Add meta to mOTUs merge

* Put tests back to use downloaded db

* Apply suggestions from code review

* Fix test text string

* md5sum -> contains

* Update nextflow.config
This commit is contained in:
James A. Fellows Yates 2022-09-15 19:45:43 +02:00 committed by GitHub
parent d90c291f18
commit 8372df6fb2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 51 additions and 18 deletions

View file

@ -1,6 +1,7 @@
VERSION = '3.0.1' VERSION = '3.0.1'
process MOTUS_MERGE { process MOTUS_MERGE {
tag "$meta.id"
label 'process_low' label 'process_low'
conda (params.enable_conda ? "bioconda::motus=3.0.1" : null) conda (params.enable_conda ? "bioconda::motus=3.0.1" : null)
@ -9,14 +10,14 @@ process MOTUS_MERGE {
'quay.io/biocontainers/motus:3.0.1--pyhdfd78af_0' }" 'quay.io/biocontainers/motus:3.0.1--pyhdfd78af_0' }"
input: input:
path input tuple val(meta), path(input)
path db // to stop docker saying it can't find it... would have to have the module in upstream steps anyway path db // to stop docker saying it can't find it... would have to have the module in upstream steps anyway
path profile_version_yml, stageAs: 'profile_version.yml' path profile_version_yml, stageAs: 'profile_version.yml'
val biom_format val biom_format
output: output:
path("*.txt") , optional: true, emit: txt tuple val(meta), path("*.txt") , optional: true, emit: txt
path("*.biom"), optional: true, emit: biom tuple val(meta), path("*.biom"), optional: true, emit: biom
path "versions.yml" , emit: versions path "versions.yml" , emit: versions
when: when:
@ -24,16 +25,16 @@ process MOTUS_MERGE {
script: script:
def args = task.ext.args ?: '' def args = task.ext.args ?: ''
def prefix = 'motus_merged' def prefix = task.ext.prefix ?: "${meta.id}"
def cmd_input = input.size() > 1 ? "-i ${input.join(',')}" : input.isDirectory() ? "-d ${input}" : "-i ${input}" def cmd_input = input.size() > 1 ? "-i ${input.join(',')}" : input.isDirectory() ? "-d ${input}" : "-i ${input}"
def output = biom_format ? "-B -o ${prefix}.biom" : "-o ${prefix}.txt" def suffix = task.ext.args?.contains("-B") ? "biom" : "txt"
""" """
motus \\ motus \\
merge \\ merge \\
-db $db \\ -db $db \\
${cmd_input} \\ ${cmd_input} \\
$args \\ $args \\
${output} -o ${prefix}.${suffix}
## Take version from the mOTUs/profile module output, as cannot reconstruct ## Take version from the mOTUs/profile module output, as cannot reconstruct
## version without having database staged in this directory. ## version without having database staged in this directory.

View file

@ -5,6 +5,7 @@ nextflow.enable.dsl = 2
include { MOTUS_DOWNLOADDB } from '../../../../modules/motus/downloaddb/main.nf' include { MOTUS_DOWNLOADDB } from '../../../../modules/motus/downloaddb/main.nf'
include { MOTUS_PROFILE } from '../../../../modules/motus/profile/main.nf' include { MOTUS_PROFILE } from '../../../../modules/motus/profile/main.nf'
include { MOTUS_MERGE } from '../../../../modules/motus/merge/main.nf' include { MOTUS_MERGE } from '../../../../modules/motus/merge/main.nf'
include { MOTUS_MERGE as MOTUS_MERGE_BIOM } from '../../../../modules/motus/merge/main.nf'
workflow test_motus_merge { workflow test_motus_merge {
@ -23,7 +24,28 @@ workflow test_motus_merge {
MOTUS_DOWNLOADDB ( file('https://raw.githubusercontent.com/motu-tool/mOTUs/master/motus/downloadDB.py') ) 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 )
MOTUS_MERGE ( MOTUS_PROFILE.out.out.map{it[1]}.collect(), MOTUS_DOWNLOADDB.out.db, MOTUS_PROFILE.out.versions.first(), false ) MOTUS_MERGE ( MOTUS_PROFILE.out.out.map{ [[id:"test"], it[1]] }.groupTuple(), MOTUS_DOWNLOADDB.out.db, MOTUS_PROFILE.out.versions.first(), false )
}
workflow test_motus_merge_biom {
input = Channel.fromList(
[
[
[ id:'test', single_end:true ], // meta map
file(params.test_data['sarscov2']['illumina']['test_1_fastq_gz'], checkIfExists: true)
],
[
[ id:'test2', 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_MERGE_BIOM ( MOTUS_PROFILE.out.out.map{ [[id:"test"], it[1]] }.groupTuple(), MOTUS_DOWNLOADDB.out.db, MOTUS_PROFILE.out.versions.first(), false )
} }

View file

@ -2,4 +2,7 @@ process {
publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" } publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" }
withName: MOTUS_MERGE_BIOM {
ext.args = "-B"
}
} }

View file

@ -4,9 +4,16 @@
- motus - motus
- motus/merge - motus/merge
files: files:
- path: output/motus/motus_merged.txt - path: output/motus/test.txt
contains: ["#consensus_taxonomy"] contains:
- path: output/motus/test.out - "consensus_taxonomy"
contains: ["#consensus_taxonomy"]
- path: output/motus/test2.out - name: motus merge test_motus_merge_biom
contains: ["#consensus_taxonomy"] command: nextflow run ./tests/modules/motus/merge -entry test_motus_merge_biom -c ./tests/config/nextflow.config -c ./tests/modules/motus/merge/nextflow.config
tags:
- motus
- motus/merge
files:
- path: output/motus/test.biom
contains:
- "Biological Observation Matrix 1.0.0"