From 05e9d92444d4689c172d2df3176bf180482fa5aa Mon Sep 17 00:00:00 2001 From: James Fellows Yates Date: Tue, 13 Sep 2022 16:47:19 +0200 Subject: [PATCH] Add centrigue kreports --- conf/modules.config | 13 +++++++-- .../local/standardisation_profiles.nf | 27 ++++++++++++++++--- 2 files changed, 35 insertions(+), 5 deletions(-) diff --git a/conf/modules.config b/conf/modules.config index f31eff5..2dd163f 100644 --- a/conf/modules.config +++ b/conf/modules.config @@ -295,7 +295,7 @@ process { } withName: KRAKENTOOLS_COMBINEKREPORTS { - ext.prefix = { "${meta.id}_combined_reports" } + ext.prefix = { "kraken2_${meta.id}_combined_reports" } publishDir = [ path: { "${params.outdir}/kraken2/" }, mode: params.publish_dir_mode, @@ -367,6 +367,15 @@ process { ] } + withName: KRAKENTOOLS_COMBINEKREPORTS_CENTRIFUGE { + ext.prefix = { "centrifuge_${meta.id}_combined_reports" } + publishDir = [ + path: { "${params.outdir}/centrifuge/" }, + mode: params.publish_dir_mode, + pattern: '*.{txt}' + ] + } + withName: KAIJU_KAIJU { ext.prefix = params.perform_runmerging ? { "${meta.id}-${meta.db_name}" } : { "${meta.id}-${meta.run_accession}-${meta.db_name}" } publishDir = [ @@ -378,7 +387,7 @@ process { } withName: KAIJU_KAIJU2TABLE { - ext.prefix = { "${meta.id}_combined_reports" } + ext.prefix = { "kaiju_${meta.id}_combined_reports" } publishDir = [ path: { "${params.outdir}/kaiju/" }, mode: params.publish_dir_mode, diff --git a/subworkflows/local/standardisation_profiles.nf b/subworkflows/local/standardisation_profiles.nf index 14fb718..269a22c 100644 --- a/subworkflows/local/standardisation_profiles.nf +++ b/subworkflows/local/standardisation_profiles.nf @@ -2,9 +2,10 @@ // Standardise output files e.g. aggregation // -include { KAIJU_KAIJU2TABLE } from '../../modules/nf-core/modules/kaiju/kaiju2table/main' -include { KRAKENTOOLS_COMBINEKREPORTS } from '../../modules/nf-core/modules/krakentools/combinekreports/main' -include { MOTUS_MERGE } from '../../modules/nf-core/modules/motus/merge/main' +include { KRAKENTOOLS_COMBINEKREPORTS as KRAKENTOOLS_COMBINEKREPORTS_CENTRIFUGE } from '../../modules/nf-core/modules/krakentools/combinekreports/main' +include { KAIJU_KAIJU2TABLE } from '../../modules/nf-core/modules/kaiju/kaiju2table/main' +include { KRAKENTOOLS_COMBINEKREPORTS } from '../../modules/nf-core/modules/krakentools/combinekreports/main' +include { MOTUS_MERGE } from '../../modules/nf-core/modules/motus/merge/main' workflow STANDARDISATION_PROFILES { take: @@ -25,6 +26,7 @@ workflow STANDARDISATION_PROFILES { .branch { motus: it[0]['tool'] == 'motus' kraken2: it[0]['tool'] == 'kraken2' + centrifuge: it[0]['tool'] == 'centrifuge' unknown: true } @@ -45,6 +47,23 @@ workflow STANDARDISATION_PROFILES { Standardise and aggregate */ + // CENTRIFUGE + + // Collect and replace id for db_name for prefix + // Have to sort by size to ensure first file actually has hits otherwise + // the script fails + ch_profiles_for_centrifuge = ch_input_profiles.centrifuge + .map { [it[0]['db_name'], it[1]] } + .groupTuple(sort: {-it.size()} ) + .map { + [[id:it[0]], it[1]] + } + + KRAKENTOOLS_COMBINEKREPORTS_CENTRIFUGE ( ch_profiles_for_centrifuge ) + ch_standardised_tables = ch_standardised_tables.mix( KRAKENTOOLS_COMBINEKREPORTS_CENTRIFUGE.out.txt ) + ch_multiqc_files = ch_multiqc_files.mix( KRAKENTOOLS_COMBINEKREPORTS_CENTRIFUGE.out.txt ) + ch_versions = ch_versions.mix( KRAKENTOOLS_COMBINEKREPORTS_CENTRIFUGE.out.versions ) + // Kaiju // Collect and replace id for db_name for prefix @@ -63,6 +82,8 @@ workflow STANDARDISATION_PROFILES { // Kraken2 // Collect and replace id for db_name for prefix + // Have to sort by size to ensure first file actually has hits otherwise + // the script fails ch_profiles_for_kraken2 = ch_input_profiles.kraken2 .map { [it[0]['db_name'], it[1]] } .groupTuple(sort: {-it.size()} )