From 4e7857e2edbfed4776c0775859084b045316b5d8 Mon Sep 17 00:00:00 2001 From: James Fellows Yates Date: Fri, 16 Sep 2022 08:36:34 +0200 Subject: [PATCH 1/3] Standardise mOTUs table merge --- conf/modules.config | 2 ++ modules.json | 6 +++--- modules/nf-core/modules/motus/merge/main.nf | 13 +++++++------ subworkflows/local/standardisation_profiles.nf | 13 ++++++++++++- 4 files changed, 24 insertions(+), 10 deletions(-) diff --git a/conf/modules.config b/conf/modules.config index 2dd163f..3bd9a32 100644 --- a/conf/modules.config +++ b/conf/modules.config @@ -418,6 +418,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 242e8e8..3149225 100644 --- a/modules.json +++ b/modules.json @@ -99,7 +99,7 @@ }, "metaphlan3/metaphlan3": { "branch": "master", - "git_sha": "940d7fe9d63962e0e2ba0987e2893fb0aff832e3" + "git_sha": "978087354eb72ac1f6e18a3f790fad9bc4d05840" }, "minimap2/align": { "branch": "master", @@ -107,11 +107,11 @@ }, "minimap2/index": { "branch": "master", - "git_sha": "e745e167c1020928ef20ea1397b6b4d230681b4d" + "git_sha": "73e062cf5e0ef346f65d73009b1b656299359fc5" }, "motus/merge": { "branch": "master", - "git_sha": "b02e648c221e1da17cb589eefe297e61ec9e9c49" + "git_sha": "8372df6fb2a7638adacae070860685373be61e1f" }, "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..dcab92f 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,14 @@ 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 +25,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/subworkflows/local/standardisation_profiles.nf b/subworkflows/local/standardisation_profiles.nf index 269a22c..a82b59d 100644 --- a/subworkflows/local/standardisation_profiles.nf +++ b/subworkflows/local/standardisation_profiles.nf @@ -96,10 +96,21 @@ workflow STANDARDISATION_PROFILES { ch_multiqc_files = ch_multiqc_files.mix( KRAKENTOOLS_COMBINEKREPORTS.out.txt ) ch_versions = ch_versions.mix( KRAKENTOOLS_COMBINEKREPORTS.out.versions ) + // mOTUs + // 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 { From 2c83b367a7eebbda6ff64539925e321de10befa5 Mon Sep 17 00:00:00 2001 From: "James A. Fellows Yates" Date: Fri, 16 Sep 2022 09:28:42 +0200 Subject: [PATCH 2/3] Apply suggestions from code review --- modules.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules.json b/modules.json index 3149225..913c795 100644 --- a/modules.json +++ b/modules.json @@ -99,7 +99,7 @@ }, "metaphlan3/metaphlan3": { "branch": "master", - "git_sha": "978087354eb72ac1f6e18a3f790fad9bc4d05840" + "git_sha": "940d7fe9d63962e0e2ba0987e2893fb0aff832e3" }, "minimap2/align": { "branch": "master", @@ -107,7 +107,7 @@ }, "minimap2/index": { "branch": "master", - "git_sha": "73e062cf5e0ef346f65d73009b1b656299359fc5" + "git_sha": "e745e167c1020928ef20ea1397b6b4d230681b4d" }, "motus/merge": { "branch": "master", From c5cc21d29e0cc06482be02450210d85c33ea85bd Mon Sep 17 00:00:00 2001 From: James Fellows Yates Date: Fri, 16 Sep 2022 10:25:24 +0200 Subject: [PATCH 3/3] Update motus merge module to remove unused channel --- modules.json | 2 +- modules/nf-core/modules/motus/merge/main.nf | 1 - modules/nf-core/modules/motus/merge/meta.yml | 3 --- subworkflows/local/standardisation_profiles.nf | 2 +- 4 files changed, 2 insertions(+), 6 deletions(-) diff --git a/modules.json b/modules.json index 3149225..64fc39e 100644 --- a/modules.json +++ b/modules.json @@ -111,7 +111,7 @@ }, "motus/merge": { "branch": "master", - "git_sha": "8372df6fb2a7638adacae070860685373be61e1f" + "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 dcab92f..a050c7a 100644 --- a/modules/nf-core/modules/motus/merge/main.nf +++ b/modules/nf-core/modules/motus/merge/main.nf @@ -13,7 +13,6 @@ process MOTUS_MERGE { 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: tuple val(meta), path("*.txt") , optional: true, emit: txt 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 a82b59d..9a867d1 100644 --- a/subworkflows/local/standardisation_profiles.nf +++ b/subworkflows/local/standardisation_profiles.nf @@ -109,7 +109,7 @@ workflow STANDARDISATION_PROFILES { [[id:it[0]], it[1]] } - MOTUS_MERGE ( ch_profiles_for_motus, ch_input_databases.motus.map{it[1]}, motu_version, [] ) + 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 )