mirror of
https://github.com/MillironX/taxprofiler.git
synced 2024-11-26 01:19:54 +00:00
Merge remote-tracking branch 'origin/dev' into malt-to-krona
This commit is contained in:
commit
27f174d17e
7 changed files with 136 additions and 14 deletions
|
@ -351,6 +351,10 @@ process {
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
withName: KAIJU_KAIJU2KRONA {
|
||||||
|
ext.args = '-v -u'
|
||||||
|
}
|
||||||
|
|
||||||
withName: DIAMOND_BLASTX {
|
withName: DIAMOND_BLASTX {
|
||||||
ext.args = { "${meta.db_params}" }
|
ext.args = { "${meta.db_params}" }
|
||||||
ext.prefix = params.perform_runmerging ? { "${meta.id}-${meta.db_name}" } : { "${meta.id}-${meta.run_accession}-${meta.db_name}" }
|
ext.prefix = params.perform_runmerging ? { "${meta.id}-${meta.db_name}" } : { "${meta.id}-${meta.run_accession}-${meta.db_name}" }
|
||||||
|
|
|
@ -42,6 +42,9 @@
|
||||||
"kaiju/kaiju": {
|
"kaiju/kaiju": {
|
||||||
"git_sha": "8856f127c58f6af479128be8b8df4d42e442ddbe"
|
"git_sha": "8856f127c58f6af479128be8b8df4d42e442ddbe"
|
||||||
},
|
},
|
||||||
|
"kaiju/kaiju2krona": {
|
||||||
|
"git_sha": "2f0b19240430de6807b1232e6d9d0e8084e8a28f"
|
||||||
|
},
|
||||||
"kaiju/kaiju2table": {
|
"kaiju/kaiju2table": {
|
||||||
"git_sha": "538dbac98ba9c8f799536cd5a617195501439457"
|
"git_sha": "538dbac98ba9c8f799536cd5a617195501439457"
|
||||||
},
|
},
|
||||||
|
|
39
modules/nf-core/modules/kaiju/kaiju2krona/main.nf
generated
Normal file
39
modules/nf-core/modules/kaiju/kaiju2krona/main.nf
generated
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
process KAIJU_KAIJU2KRONA {
|
||||||
|
tag "$meta.id"
|
||||||
|
label 'process_low'
|
||||||
|
|
||||||
|
conda (params.enable_conda ? "bioconda::kaiju=1.8.2" : null)
|
||||||
|
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
|
||||||
|
'https://depot.galaxyproject.org/singularity/kaiju:1.8.2--h5b5514e_1':
|
||||||
|
'quay.io/biocontainers/kaiju:1.8.2--h5b5514e_1' }"
|
||||||
|
|
||||||
|
input:
|
||||||
|
tuple val(meta), path(tsv)
|
||||||
|
path(db)
|
||||||
|
|
||||||
|
output:
|
||||||
|
tuple val(meta), path("*.txt"), emit: txt
|
||||||
|
path "versions.yml" , emit: versions
|
||||||
|
|
||||||
|
when:
|
||||||
|
task.ext.when == null || task.ext.when
|
||||||
|
|
||||||
|
script:
|
||||||
|
def args = task.ext.args ?: ''
|
||||||
|
def prefix = task.ext.prefix ?: "${meta.id}"
|
||||||
|
"""
|
||||||
|
dbnodes=`find -L ${db} -name "*nodes.dmp"`
|
||||||
|
dbnames=`find -L ${db} -name "*names.dmp"`
|
||||||
|
kaiju2krona \\
|
||||||
|
$args \\
|
||||||
|
-t \$dbnodes \\
|
||||||
|
-n \$dbnames \\
|
||||||
|
-i ${tsv} \\
|
||||||
|
-o ${prefix}.txt
|
||||||
|
|
||||||
|
cat <<-END_VERSIONS > versions.yml
|
||||||
|
"${task.process}":
|
||||||
|
kaiju: \$(echo \$( kaiju -h 2>&1 | sed -n 1p | sed 's/^.*Kaiju //' ))
|
||||||
|
END_VERSIONS
|
||||||
|
"""
|
||||||
|
}
|
44
modules/nf-core/modules/kaiju/kaiju2krona/meta.yml
generated
Normal file
44
modules/nf-core/modules/kaiju/kaiju2krona/meta.yml
generated
Normal file
|
@ -0,0 +1,44 @@
|
||||||
|
name: kaiju_kaiju2krona
|
||||||
|
description: Convert Kaiju's tab-separated output file into a tab-separated text file which can be imported into Krona.
|
||||||
|
keywords:
|
||||||
|
- taxonomy
|
||||||
|
- visualisation
|
||||||
|
- krona chart
|
||||||
|
- metagenomics
|
||||||
|
tools:
|
||||||
|
- "kaiju":
|
||||||
|
description: Fast and sensitive taxonomic classification for metagenomics
|
||||||
|
homepage: https://kaiju.binf.ku.dk/
|
||||||
|
documentation: https://github.com/bioinformatics-centre/kaiju/blob/master/README.md
|
||||||
|
tool_dev_url: https://github.com/bioinformatics-centre/kaiju
|
||||||
|
doi: "10.1038/ncomms11257"
|
||||||
|
licence: ["GNU GPL v3"]
|
||||||
|
|
||||||
|
input:
|
||||||
|
- meta:
|
||||||
|
type: map
|
||||||
|
description: |
|
||||||
|
Groovy Map containing sample information
|
||||||
|
e.g. [ id:'test', single_end:false ]
|
||||||
|
- tsv:
|
||||||
|
type: file
|
||||||
|
description: Kaiju tab-separated output file
|
||||||
|
pattern: "*.{tsv,txt}"
|
||||||
|
|
||||||
|
output:
|
||||||
|
- meta:
|
||||||
|
type: map
|
||||||
|
description: |
|
||||||
|
Groovy Map containing sample information
|
||||||
|
e.g. [ id:'test', single_end:false ]
|
||||||
|
- versions:
|
||||||
|
type: file
|
||||||
|
description: File containing software versions
|
||||||
|
pattern: "versions.yml"
|
||||||
|
- txt:
|
||||||
|
type: file
|
||||||
|
description: Krona text-based input file converted from Kaiju report
|
||||||
|
pattern: "*.{txt,krona}"
|
||||||
|
|
||||||
|
authors:
|
||||||
|
- "@MillironX"
|
|
@ -21,6 +21,7 @@ workflow PROFILING {
|
||||||
main:
|
main:
|
||||||
ch_versions = Channel.empty()
|
ch_versions = Channel.empty()
|
||||||
ch_multiqc_files = Channel.empty()
|
ch_multiqc_files = Channel.empty()
|
||||||
|
ch_raw_classifications = Channel.empty()
|
||||||
ch_raw_profiles = Channel.empty()
|
ch_raw_profiles = Channel.empty()
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -110,6 +111,7 @@ workflow PROFILING {
|
||||||
MEGAN_RMA2INFO (ch_maltrun_for_megan, params.malt_generate_megansummary )
|
MEGAN_RMA2INFO (ch_maltrun_for_megan, params.malt_generate_megansummary )
|
||||||
ch_multiqc_files = ch_multiqc_files.mix( MALT_RUN.out.log.collect{it[1]}.ifEmpty([]) )
|
ch_multiqc_files = ch_multiqc_files.mix( MALT_RUN.out.log.collect{it[1]}.ifEmpty([]) )
|
||||||
ch_versions = ch_versions.mix( MALT_RUN.out.versions.first(), MEGAN_RMA2INFO.out.versions.first() )
|
ch_versions = ch_versions.mix( MALT_RUN.out.versions.first(), MEGAN_RMA2INFO.out.versions.first() )
|
||||||
|
ch_raw_classifications = ch_raw_classifications.mix( ch_maltrun_for_megan )
|
||||||
ch_raw_profiles = ch_raw_profiles.mix( MEGAN_RMA2INFO.out.txt )
|
ch_raw_profiles = ch_raw_profiles.mix( MEGAN_RMA2INFO.out.txt )
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -126,6 +128,7 @@ workflow PROFILING {
|
||||||
KRAKEN2_KRAKEN2 ( ch_input_for_kraken2.reads, ch_input_for_kraken2.db, params.kraken2_save_reads, params.kraken2_save_readclassification )
|
KRAKEN2_KRAKEN2 ( ch_input_for_kraken2.reads, ch_input_for_kraken2.db, params.kraken2_save_reads, params.kraken2_save_readclassification )
|
||||||
ch_multiqc_files = ch_multiqc_files.mix( KRAKEN2_KRAKEN2.out.report.collect{it[1]}.ifEmpty([]) )
|
ch_multiqc_files = ch_multiqc_files.mix( KRAKEN2_KRAKEN2.out.report.collect{it[1]}.ifEmpty([]) )
|
||||||
ch_versions = ch_versions.mix( KRAKEN2_KRAKEN2.out.versions.first() )
|
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 )
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -146,6 +149,7 @@ 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_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)
|
CENTRIFUGE_KREPORT (CENTRIFUGE_CENTRIFUGE.out.results, ch_input_for_centrifuge.db)
|
||||||
ch_versions = ch_versions.mix( CENTRIFUGE_CENTRIFUGE.out.versions.first() )
|
ch_versions = ch_versions.mix( CENTRIFUGE_CENTRIFUGE.out.versions.first() )
|
||||||
|
ch_raw_classifications = ch_raw_classifications.mix( CENTRIFUGE_CENTRIFUGE.out.results )
|
||||||
ch_raw_profiles = ch_raw_profiles.mix( CENTRIFUGE_KREPORT.out.kreport )
|
ch_raw_profiles = ch_raw_profiles.mix( CENTRIFUGE_KREPORT.out.kreport )
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -182,6 +186,7 @@ workflow PROFILING {
|
||||||
KAIJU_KAIJU2TABLE (KAIJU_KAIJU.out.results, ch_input_for_kaiju.db, params.kaiju_taxon_name)
|
KAIJU_KAIJU2TABLE (KAIJU_KAIJU.out.results, ch_input_for_kaiju.db, params.kaiju_taxon_name)
|
||||||
ch_multiqc_files = ch_multiqc_files.mix( KAIJU_KAIJU2TABLE.out.summary.collect{it[1]}.ifEmpty([]) )
|
ch_multiqc_files = ch_multiqc_files.mix( KAIJU_KAIJU2TABLE.out.summary.collect{it[1]}.ifEmpty([]) )
|
||||||
ch_versions = ch_versions.mix( KAIJU_KAIJU.out.versions.first() )
|
ch_versions = ch_versions.mix( KAIJU_KAIJU.out.versions.first() )
|
||||||
|
ch_raw_classifications = ch_raw_classifications.mix( KAIJU_KAIJU.out.results )
|
||||||
ch_raw_profiles = ch_raw_profiles.mix( KAIJU_KAIJU2TABLE.out.summary )
|
ch_raw_profiles = ch_raw_profiles.mix( KAIJU_KAIJU2TABLE.out.summary )
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -206,8 +211,8 @@ workflow PROFILING {
|
||||||
}
|
}
|
||||||
|
|
||||||
emit:
|
emit:
|
||||||
|
classifications = ch_raw_classifications
|
||||||
profiles = ch_raw_profiles // channel: [ val(meta), [ reads ] ] - should be text files or biom
|
profiles = ch_raw_profiles // channel: [ val(meta), [ reads ] ] - should be text files or biom
|
||||||
versions = ch_versions // channel: [ versions.yml ]
|
versions = ch_versions // channel: [ versions.yml ]
|
||||||
mqc = ch_multiqc_files
|
mqc = ch_multiqc_files
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,13 +2,16 @@
|
||||||
// Create Krona visualizations
|
// Create Krona visualizations
|
||||||
//
|
//
|
||||||
|
|
||||||
|
include { KAIJU_KAIJU2KRONA } from '../../modules/nf-core/modules/kaiju/kaiju2krona/main'
|
||||||
include { KRAKENTOOLS_KREPORT2KRONA } from '../../modules/nf-core/modules/krakentools/kreport2krona/main'
|
include { KRAKENTOOLS_KREPORT2KRONA } from '../../modules/nf-core/modules/krakentools/kreport2krona/main'
|
||||||
include { KRONA_CLEANUP } from '../../modules/local/krona_cleanup'
|
include { KRONA_CLEANUP } from '../../modules/local/krona_cleanup'
|
||||||
include { KRONA_KTIMPORTTEXT } from '../../modules/nf-core/modules/krona/ktimporttext/main'
|
include { KRONA_KTIMPORTTEXT } from '../../modules/nf-core/modules/krona/ktimporttext/main'
|
||||||
|
|
||||||
workflow VISUALIZATION_KRONA {
|
workflow VISUALIZATION_KRONA {
|
||||||
take:
|
take:
|
||||||
|
classifications
|
||||||
profiles
|
profiles
|
||||||
|
databases
|
||||||
|
|
||||||
main:
|
main:
|
||||||
ch_krona_text = Channel.empty()
|
ch_krona_text = Channel.empty()
|
||||||
|
@ -24,6 +27,11 @@ workflow VISUALIZATION_KRONA {
|
||||||
kraken2: it[0]['tool'] == 'kraken2'
|
kraken2: it[0]['tool'] == 'kraken2'
|
||||||
unknown: true
|
unknown: true
|
||||||
}
|
}
|
||||||
|
ch_input_classifications = classifications
|
||||||
|
.branch {
|
||||||
|
kaiju: it[0]['tool'] == 'kaiju'
|
||||||
|
unknown: true
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Convert Kraken2 formatted reports into Krona text files
|
Convert Kraken2 formatted reports into Krona text files
|
||||||
|
@ -34,6 +42,25 @@ workflow VISUALIZATION_KRONA {
|
||||||
ch_krona_text = ch_krona_text.mix( KRAKENTOOLS_KREPORT2KRONA.out.txt )
|
ch_krona_text = ch_krona_text.mix( KRAKENTOOLS_KREPORT2KRONA.out.txt )
|
||||||
ch_versions = ch_versions.mix( KRAKENTOOLS_KREPORT2KRONA.out.versions.first() )
|
ch_versions = ch_versions.mix( KRAKENTOOLS_KREPORT2KRONA.out.versions.first() )
|
||||||
|
|
||||||
|
/*
|
||||||
|
Combine Kaiju profiles with their databases
|
||||||
|
*/
|
||||||
|
ch_input_for_kaiju2krona = ch_input_classifications.kaiju
|
||||||
|
.map{ [it[0]['db_name'], it[0], it[1]] }
|
||||||
|
.combine( databases.map{ [it[0]['db_name'], it[1]] }, by: 0 )
|
||||||
|
.multiMap{
|
||||||
|
it ->
|
||||||
|
profiles: [it[1], it[2]]
|
||||||
|
db: it[3]
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Convert Kaiju formatted reports into Krona text files
|
||||||
|
*/
|
||||||
|
KAIJU_KAIJU2KRONA( ch_input_for_kaiju2krona.profiles, ch_input_for_kaiju2krona.db )
|
||||||
|
ch_krona_text = ch_krona_text.mix( KAIJU_KAIJU2KRONA.out.txt )
|
||||||
|
ch_versions = ch_versions.mix( KAIJU_KAIJU2KRONA.out.versions.first() )
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Remove taxonomy level annotations from the Krona text files
|
Remove taxonomy level annotations from the Krona text files
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -214,7 +214,7 @@ workflow TAXPROFILER {
|
||||||
SUBWORKFLOW: VISUALIZATION_KRONA
|
SUBWORKFLOW: VISUALIZATION_KRONA
|
||||||
*/
|
*/
|
||||||
if ( params.run_krona ) {
|
if ( params.run_krona ) {
|
||||||
VISUALIZATION_KRONA ( PROFILING.out.profiles )
|
VISUALIZATION_KRONA ( PROFILING.out.classifications, PROFILING.out.profiles, DB_CHECK.out.dbs )
|
||||||
ch_versions = ch_versions.mix( VISUALIZATION_KRONA.out.versions )
|
ch_versions = ch_versions.mix( VISUALIZATION_KRONA.out.versions )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue