1
0
Fork 0
mirror of https://github.com/MillironX/taxprofiler.git synced 2024-11-23 21:49:56 +00:00

Try putting MillironX's krona in subworkflow

This commit is contained in:
James Fellows Yates 2022-06-20 21:36:16 +02:00
parent 0e44098125
commit bb7323ef1d
4 changed files with 96 additions and 21 deletions

View file

@ -293,7 +293,16 @@ process {
]
}
withName: KRONA_IMPORTKRAKEN {
withName: KRAKENTOOLS_KREPORT2KRONA {
ext.prefix = params.perform_runmerging ? { "${meta.id}-${meta.db_name}" } : { "${meta.id}-${meta.run_accession}-${meta.db_name}" }
}
withName: KRONA_KRAKENCLEANUP {
ext.prefix = params.perform_runmerging ? { "${meta.id}-${meta.db_name}" } : { "${meta.id}-${meta.run_accession}-${meta.db_name}" }
}
withName: KRONA_KTIMPORTTEXT {
ext.prefix = { "${meta.tool}-${meta.db_name}" }
publishDir = [
path: { "${params.outdir}/krona" },
mode: params.publish_dir_mode,

View file

@ -0,0 +1,66 @@
//
// Remove host reads via alignment and export off-target reads
//
include { KRAKENTOOLS_KREPORT2KRONA } from '../../modules/nf-core/modules/krakentools/kreport2krona/main'
include { KRONA_CLEANUP as KRONA_KRAKENCLEANUP } from '../../modules/local/krona_cleanup'
include { KRONA_KTIMPORTTEXT } from '../../modules/nf-core/modules/krona/ktimporttext/main'
include { CENTRIFUGE_KREPORT } from '../../modules/nf-core/modules/centrifuge/kreport/main'
workflow POSTPROCESSING_KRONA {
take:
krona_input
databases
main:
ch_versions = Channel.empty()
ch_input_for_ktimporttext = Channel.empty()
ch_files_for_krona = krona_input
.branch {
// malt:
kraken2: it[0]['tool'] == 'kraken2'
centrifuge: it[0]['tool'] == 'centrifuge'
//metaphlan3:
//kaiju:
//diamond:
}
ch_databases = databases
.branch{
centrifuge: it[0]['tool'] == 'centrifuge'
}
// TODO PUSH BACK CENTRIFUGE_KREPORT TO PROFILING.NF WHERE DATABASE ALREADY IS?
ch_input_for_centrifuge_kreport = ch_files_for_krona.centrifuge
.dump(tag: "db_for_kreport_pre")
.join(ch_databases, by: 0)
.dump(tag: "db_for_kreport_post")
// Kraken
KRAKENTOOLS_KREPORT2KRONA ( ch_files_for_krona.kraken2 )
KRONA_KRAKENCLEANUP ( KRAKENTOOLS_KREPORT2KRONA.out.txt )
ch_kraken_for_krona = KRONA_KRAKENCLEANUP.out.txt
.map{
[[id: it[0].tool + "-" + it[0].db_name, db_name: it[0].db_name, tool: it[0].tool ], it[1]]
}
.groupTuple()
ch_input_for_ktimporttext = ch_input_for_ktimporttext.mix( ch_kraken_for_krona )
ch_versions = ch_versions.mix( KRAKENTOOLS_KREPORT2KRONA.out.versions.first() )
ch_versions = ch_versions.mix( KRONA_KRAKENCLEANUP.out.versions.first() )
KRONA_KTIMPORTTEXT (ch_input_for_ktimporttext)
ch_versions = ch_versions.mix( KRONA_KTIMPORTTEXT.out.versions.first() )
// Centrifuge
//CENTRIFUGE_KREPORT (krona_input.centrifuge, ch_input_for_centrifuge.db)
// ch_versions = ch_versions.mix( /CENTRIFUGE_KREPORT.out.versions.first() )
emit:
versions = ch_versions // channel: [ versions.yml ]
}

View file

@ -5,11 +5,7 @@
include { MALT_RUN } from '../../modules/nf-core/modules/malt/run/main'
include { MEGAN_RMA2INFO } from '../../modules/nf-core/modules/megan/rma2info/main'
include { KRAKEN2_KRAKEN2 } from '../../modules/nf-core/modules/kraken2/kraken2/main'
include { KRAKENTOOLS_KREPORT2KRONA } from '../../modules/nf-core/modules/krakentools/kreport2krona/main'
include { KRONA_CLEANUP as KRONA_KRAKENCLEANUP } from '../../modules/local/krona_cleanup'
include { KRONA_KTIMPORTTEXT as KRONA_IMPORTKRAKEN } from '../../modules/nf-core/modules/krona/ktimporttext/main'
include { CENTRIFUGE_CENTRIFUGE } from '../../modules/nf-core/modules/centrifuge/centrifuge/main'
include { CENTRIFUGE_KREPORT } from '../../modules/nf-core/modules/centrifuge/kreport/main'
include { METAPHLAN3 } from '../../modules/nf-core/modules/metaphlan3/main'
include { KAIJU_KAIJU } from '../../modules/nf-core/modules/kaiju/kaiju/main'
include { KAIJU_KAIJU2TABLE } from '../../modules/nf-core/modules/kaiju/kaiju2table/main'
@ -24,8 +20,8 @@ workflow PROFILING {
main:
ch_versions = Channel.empty()
ch_multiqc_files = Channel.empty()
ch_raw_profiles = Channel.empty()
ch_visualizations = Channel.empty()
ch_raw_profiles = Channel.empty()
ch_output_for_krona = Channel.empty()
/*
COMBINE READS WITH POSSIBLE DATABASES
@ -128,17 +124,11 @@ workflow PROFILING {
}
KRAKEN2_KRAKEN2 ( ch_input_for_kraken2.reads, ch_input_for_kraken2.db, params.kraken2_save_reads, params.kraken2_save_readclassification )
KRAKENTOOLS_KREPORT2KRONA ( KRAKEN2_KRAKEN2.out.report )
KRONA_KRAKENCLEANUP ( KRAKENTOOLS_KREPORT2KRONA.out.txt )
KRONA_IMPORTKRAKEN( KRONA_KRAKENCLEANUP.out.txt.map{[[id: it[0].db_name], it[1]]}.groupTuple() )
ch_multiqc_files = ch_multiqc_files.mix( KRAKEN2_KRAKEN2.out.report.collect{it[1]}.ifEmpty([]) )
ch_visualizations = ch_visualizations.mix( KRONA_IMPORTKRAKEN.out.html )
ch_versions = ch_versions.mix( KRAKEN2_KRAKEN2.out.versions.first() )
ch_versions = ch_versions.mix( KRAKENTOOLS_KREPORT2KRONA.out.versions.first() )
ch_versions = ch_versions.mix( KRONA_KRAKENCLEANUP.out.versions.first() )
ch_versions = ch_versions.mix( KRONA_IMPORTKRAKEN.out.versions.first() )
ch_raw_profiles = ch_raw_profiles.mix( KRAKEN2_KRAKEN2.out.report )
ch_multiqc_files = ch_multiqc_files.mix( KRAKEN2_KRAKEN2.out.report.collect{it[1]}.ifEmpty([]) )
ch_output_for_krona = ch_output_for_krona.mix( KRAKEN2_KRAKEN2.out.report )
ch_versions = ch_versions.mix( KRAKEN2_KRAKEN2.out.versions.first() )
ch_raw_profiles = ch_raw_profiles.mix( KRAKEN2_KRAKEN2.out.report )
}
@ -156,9 +146,11 @@ workflow PROFILING {
}
CENTRIFUGE_CENTRIFUGE ( ch_input_for_centrifuge.reads, ch_input_for_centrifuge.db, params.centrifuge_save_reads, params.centrifuge_save_reads, params.centrifuge_save_reads )
CENTRIFUGE_KREPORT (CENTRIFUGE_CENTRIFUGE.out.results, ch_input_for_centrifuge.db)
ch_versions = ch_versions.mix( CENTRIFUGE_CENTRIFUGE.out.versions.first() )
ch_raw_profiles = ch_raw_profiles.mix( CENTRIFUGE_KREPORT.out.kreport )
// TODO PUSH BACK CENTRIFUGE_KREPORT HERE WHERE DATABASE ALREADY IS?
ch_output_for_krona = ch_output_for_krona.mix( CENTRIFUGE_CENTRIFUGE.out.report )
ch_versions = ch_versions.mix( CENTRIFUGE_CENTRIFUGE.out.versions.first() )
ch_raw_profiles = ch_raw_profiles.mix( CENTRIFUGE_CENTRIFUGE.out.report )
}
@ -221,5 +213,5 @@ workflow PROFILING {
profiles = ch_raw_profiles // channel: [ val(meta), [ reads ] ] - should be text files or biom
versions = ch_versions // channel: [ versions.yml ]
mqc = ch_multiqc_files
visualizations = ch_visualizations
krona = ch_output_for_krona
}

View file

@ -62,6 +62,7 @@ include { SHORTREAD_HOSTREMOVAL } from '../subworkflows/local/shortread_
include { LONGREAD_HOSTREMOVAL } from '../subworkflows/local/longread_hostremoval'
include { SHORTREAD_COMPLEXITYFILTERING } from '../subworkflows/local/shortread_complexityfiltering'
include { PROFILING } from '../subworkflows/local/profiling'
include { POSTPROCESSING_KRONA } from '../subworkflows/local/postprocessing_krona'
/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ -209,6 +210,13 @@ workflow TAXPROFILER {
PROFILING ( ch_reads_runmerged, DB_CHECK.out.dbs )
ch_versions = ch_versions.mix( PROFILING.out.versions )
/*
SUBWORKFLOW: KRONA VISUALISATION
*/
POSTPROCESSING_KRONA ( PROFILING.out.krona, DB_CHECK.out.dbs )
ch_versions = ch_versions.mix( POSTPROCESSING_KRONA.out.versions )
/*
MODULE: MultiQC
*/