1
0
Fork 0
mirror of https://github.com/MillironX/taxprofiler.git synced 2024-11-25 19:49:55 +00:00

refactor: handle combined kraken2+bracken tool column

This commit is contained in:
Moritz E. Beber 2022-10-19 16:21:36 +02:00
parent c7c7a7f678
commit b73b479860

View file

@ -41,7 +41,7 @@ workflow PROFILING {
.combine(databases)
.branch {
malt: it[2]['tool'] == 'malt'
kraken2: it[2]['tool'] == 'kraken2'
kraken2: it[2]['tool'].contains('kraken2')
metaphlan3: it[2]['tool'] == 'metaphlan3'
centrifuge: it[2]['tool'] == 'centrifuge'
kaiju: it[2]['tool'] == 'kaiju'
@ -131,34 +131,41 @@ workflow PROFILING {
ch_multiqc_files = ch_multiqc_files.mix( KRAKEN2_KRAKEN2.out.report )
ch_versions = ch_versions.mix( KRAKEN2_KRAKEN2.out.versions.first() )
ch_raw_classifications = ch_raw_classifications.mix( KRAKEN2_KRAKEN2.out.classified_reads_assignment )
ch_raw_profiles = ch_raw_profiles.mix( KRAKEN2_KRAKEN2.out.report )
ch_raw_profiles = ch_raw_profiles.mix(
KRAKEN2_KRAKEN2.out.report
// Set the tool to be strictly 'kraken2' instead of potentially 'kraken2+bracken' for downstream use.
.map { meta, report -> [meta + [tool: 'kraken2'], report]}
)
}
if ( params.run_kraken2 && params.run_bracken ) {
def ch_input_for_bracken
def ch_input_for_bracken = KRAKEN2_KRAKEN2.out.report
.filter { meta, report -> meta['tool'].contains('bracken') }
if (params.kraken2_save_minimizers) {
ch_input_for_bracken = KRAKEN2_STANDARD_REPORT(KRAKEN2_KRAKEN2.out.report).report
} else {
ch_input_for_bracken = KRAKEN2_KRAKEN2.out.report
ch_input_for_bracken = KRAKEN2_STANDARD_REPORT(ch_input_for_bracken).report
}
ch_input_for_bracken = ch_input_for_bracken
.combine(
databases.filter { meta, db ->
meta['tool'] == 'bracken'
meta['tool'].contains('bracken')
}
)
.multiMap { meta, report, db_meta, db ->
report: [meta + db_meta, report]
report: [meta, report]
db: db
}
BRACKEN_BRACKEN(ch_input_for_bracken.report, ch_input_for_bracken.db)
ch_versions = ch_versions.mix(BRACKEN_BRACKEN.out.versions.first())
ch_raw_profiles = ch_raw_profiles.mix(BRACKEN_BRACKEN.out.reports)
ch_raw_profiles = ch_raw_profiles.mix(
BRACKEN_BRACKEN.out.reports
// Set the tool to be strictly 'bracken' instead of potentially 'kraken2+bracken' for downstream use.
.map { meta, report -> [meta + [tool: 'bracken'], report]}
)
}