diff --git a/conf/modules.config b/conf/modules.config index f64c423..6099422 100644 --- a/conf/modules.config +++ b/conf/modules.config @@ -427,6 +427,8 @@ process { } withName: MOTUS_MERGE { + ext.args = { params.generate_biom_output ? "-B" : "" } + ext.prefix = { "motus_${meta.id}_combined_reports" } publishDir = [ path: { "${params.outdir}/motus/" }, mode: params.publish_dir_mode diff --git a/modules.json b/modules.json index 0634112..f174b6f 100644 --- a/modules.json +++ b/modules.json @@ -115,7 +115,7 @@ }, "motus/merge": { "branch": "master", - "git_sha": "b02e648c221e1da17cb589eefe297e61ec9e9c49" + "git_sha": "54ff289487244bf15543ecfa62bd4df49be72b73" }, "motus/profile": { "branch": "master", diff --git a/modules/nf-core/modules/motus/merge/main.nf b/modules/nf-core/modules/motus/merge/main.nf index 01ca5a2..a050c7a 100644 --- a/modules/nf-core/modules/motus/merge/main.nf +++ b/modules/nf-core/modules/motus/merge/main.nf @@ -1,6 +1,7 @@ VERSION = '3.0.1' process MOTUS_MERGE { + tag "$meta.id" label 'process_low' conda (params.enable_conda ? "bioconda::motus=3.0.1" : null) @@ -9,14 +10,13 @@ process MOTUS_MERGE { 'quay.io/biocontainers/motus:3.0.1--pyhdfd78af_0' }" 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 profile_version_yml, stageAs: 'profile_version.yml' - val biom_format output: - path("*.txt") , optional: true, emit: txt - path("*.biom"), optional: true, emit: biom + tuple val(meta), path("*.txt") , optional: true, emit: txt + tuple val(meta), path("*.biom"), optional: true, emit: biom path "versions.yml" , emit: versions when: @@ -24,16 +24,16 @@ process MOTUS_MERGE { script: 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 output = biom_format ? "-B -o ${prefix}.biom" : "-o ${prefix}.txt" + def suffix = task.ext.args?.contains("-B") ? "biom" : "txt" """ motus \\ merge \\ -db $db \\ ${cmd_input} \\ $args \\ - ${output} + -o ${prefix}.${suffix} ## Take version from the mOTUs/profile module output, as cannot reconstruct ## version without having database staged in this directory. diff --git a/modules/nf-core/modules/motus/merge/meta.yml b/modules/nf-core/modules/motus/merge/meta.yml index c9c7711..02d11d0 100644 --- a/modules/nf-core/modules/motus/merge/meta.yml +++ b/modules/nf-core/modules/motus/merge/meta.yml @@ -35,9 +35,6 @@ input: this itself without having the motus database present and configured with the tool so here we take it from what is already reported by the upstream module. pattern: "versions.yml" - - biom_format: - type: boolean - description: Whether to save output OTU table in biom format output: - versions: diff --git a/subworkflows/local/standardisation_profiles.nf b/subworkflows/local/standardisation_profiles.nf index c8c364d..7a441ff 100644 --- a/subworkflows/local/standardisation_profiles.nf +++ b/subworkflows/local/standardisation_profiles.nf @@ -117,7 +117,16 @@ workflow STANDARDISATION_PROFILES { // mOTUs has a 'single' database, and cannot create custom ones. // Therefore removing db info here, and publish merged at root mOTUs results // directory - MOTUS_MERGE ( ch_input_profiles.motus.map{it[1]}.collect(), ch_input_databases.motus.map{it[1]}, motu_version, params.generate_biom_output ) + + ch_profiles_for_motus = ch_input_profiles.motus + .map { [it[0]['db_name'], it[1]] } + .groupTuple() + .map { + [[id:it[0]], it[1]] + } + + MOTUS_MERGE ( ch_profiles_for_motus, ch_input_databases.motus.map{it[1]}, motu_version ) + if ( params.generate_biom_output ) { ch_standardised_tables = ch_standardised_tables.mix ( MOTUS_MERGE.out.biom ) } else {