1
0
Fork 0
mirror of https://github.com/MillironX/taxprofiler.git synced 2024-11-22 14:19:56 +00:00

Add support for MALT display in Krona, tweaks other krona modules to dispaly tool name in output file

This commit is contained in:
James Fellows Yates 2022-06-30 18:33:11 +02:00
parent 27f174d17e
commit 02c06b9f7b
8 changed files with 206 additions and 3 deletions

View file

@ -273,7 +273,7 @@ process {
] ]
} }
withName: MEGAN_RMA2INFO { withName: 'NFCORE_TAXPROFILER:TAXPROFILER:PROFILING:MEGAN_RMA2INFO' {
ext.args = "-c2c Taxonomy" ext.args = "-c2c Taxonomy"
ext.prefix = { "${meta.id}" } ext.prefix = { "${meta.id}" }
publishDir = [ publishDir = [
@ -293,7 +293,32 @@ process {
] ]
} }
withName: KRONA_CLEANUP {
ext.prefix = params.perform_runmerging ? { "${meta.id}-${meta.db_name}" } : { "${meta.id}-${meta.run_accession}-${meta.db_name}" }
publishDir = [
path: { "${params.outdir}/krona" },
mode: params.publish_dir_mode,
pattern: '*.{html}'
]
}
withName: KRONA_KTIMPORTTEXT { withName: KRONA_KTIMPORTTEXT {
ext.prefix = { "${meta.tool}-${meta.id}" }
publishDir = [
path: { "${params.outdir}/krona" },
mode: params.publish_dir_mode,
pattern: '*.{html}'
]
}
withName: 'NFCORE_TAXPROFILER:TAXPROFILER:VISUALIZATION_KRONA:MEGAN_RMA2INFO' {
ext.args = { "--read2class Taxonomy" }
ext.prefix = { "${meta.id}-${meta.db_name}" }
}
withName: KRONA_KTIMPORTTAXONOMY {
ext.args = "-i"
ext.prefix = { "${meta.tool}-${meta.id}" }
publishDir = [ publishDir = [
path: { "${params.outdir}/krona" }, path: { "${params.outdir}/krona" },
mode: params.publish_dir_mode, mode: params.publish_dir_mode,

View file

@ -39,6 +39,9 @@
"filtlong": { "filtlong": {
"git_sha": "089f761f0bf79c4a486f1df9b6205f650196a2c1" "git_sha": "089f761f0bf79c4a486f1df9b6205f650196a2c1"
}, },
"gunzip": {
"git_sha": "9aadd9a6d3f5964476582319b3a1c54a3e3fe7c9"
},
"kaiju/kaiju": { "kaiju/kaiju": {
"git_sha": "8856f127c58f6af479128be8b8df4d42e442ddbe" "git_sha": "8856f127c58f6af479128be8b8df4d42e442ddbe"
}, },
@ -54,6 +57,9 @@
"krakentools/kreport2krona": { "krakentools/kreport2krona": {
"git_sha": "8b2a473f586bed003e72d2b183acc43fc0ddc422" "git_sha": "8b2a473f586bed003e72d2b183acc43fc0ddc422"
}, },
"krona/ktimporttaxonomy": {
"git_sha": "233fa70811a03a4cecb2ece483b5c8396e2cee1d"
},
"krona/ktimporttext": { "krona/ktimporttext": {
"git_sha": "cdefbec66999c0b49d8bfeea9d6f9d19056635a2" "git_sha": "cdefbec66999c0b49d8bfeea9d6f9d19056635a2"
}, },

34
modules/nf-core/modules/gunzip/main.nf generated Normal file
View file

@ -0,0 +1,34 @@
process GUNZIP {
tag "$archive"
label 'process_low'
conda (params.enable_conda ? "conda-forge::sed=4.7" : null)
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/ubuntu:20.04' :
'ubuntu:20.04' }"
input:
tuple val(meta), path(archive)
output:
tuple val(meta), path("$gunzip"), emit: gunzip
path "versions.yml" , emit: versions
when:
task.ext.when == null || task.ext.when
script:
def args = task.ext.args ?: ''
gunzip = archive.toString() - '.gz'
"""
gunzip \\
-f \\
$args \\
$archive
cat <<-END_VERSIONS > versions.yml
"${task.process}":
gunzip: \$(echo \$(gunzip --version 2>&1) | sed 's/^.*(gzip) //; s/ Copyright.*\$//')
END_VERSIONS
"""
}

34
modules/nf-core/modules/gunzip/meta.yml generated Normal file
View file

@ -0,0 +1,34 @@
name: gunzip
description: Compresses and decompresses files.
keywords:
- gunzip
- compression
tools:
- gunzip:
description: |
gzip is a file format and a software application used for file compression and decompression.
documentation: https://www.gnu.org/software/gzip/manual/gzip.html
licence: ["GPL-3.0-or-later"]
input:
- meta:
type: map
description: |
Optional groovy Map containing meta information
e.g. [ id:'test', single_end:false ]
- archive:
type: file
description: File to be compressed/uncompressed
pattern: "*.*"
output:
- gunzip:
type: file
description: Compressed/uncompressed file
pattern: "*.*"
- versions:
type: file
description: File containing software versions
pattern: "versions.yml"
authors:
- "@joseespinosa"
- "@drpatelh"
- "@jfy133"

View file

@ -0,0 +1,38 @@
process KRONA_KTIMPORTTAXONOMY {
tag "${meta.id}"
label 'process_high'
// WARN: Version information not provided by tool on CLI. Please update version string below when bumping container versions.
conda (params.enable_conda ? "bioconda::krona=2.8" : null)
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/krona:2.8--pl5262hdfd78af_2' :
'quay.io/biocontainers/krona:2.8--pl5262hdfd78af_2' }"
input:
tuple val(meta), path(report)
path taxonomy
output:
tuple val(meta), path ('*.html'), emit: html
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}"
def VERSION = '2.8' // WARN: Version information not provided by tool on CLI. Please update this string when bumping container versions.
"""
ktImportTaxonomy \\
$args \\
-o ${prefix}.html \\
-tax $taxonomy \\
$report
cat <<-END_VERSIONS > versions.yml
"${task.process}":
krona: $VERSION
END_VERSIONS
"""
}

View file

@ -0,0 +1,47 @@
name: krona_ktimporttaxonomy
description: KronaTools Import Taxonomy imports taxonomy classifications and produces an interactive Krona plot.
keywords:
- plot
- taxonomy
- interactive
- html
- visualisation
- krona chart
tools:
- krona:
description: Krona Tools is a set of scripts to create Krona charts from several Bioinformatics tools as well as from text and XML files.
homepage: https://github.com/marbl/Krona/wiki/KronaTools
documentation: http://manpages.ubuntu.com/manpages/impish/man1/ktImportTaxonomy.1.html
tool_dev_url:
doi: https://doi.org/10.1186/1471-2105-12-385
licence:
input:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test']
- database:
type: file
description: |
Path to the taxonomy database .tab file downloaded by krona/ktUpdateTaxonomy
The file will be saved under a folder named "taxonomy" as "taxonomy/taxonomy.tab".
The parent folder will be passed as argument to ktImportTaxonomy.
- report:
type: file
description: "A tab-delimited file with taxonomy IDs and (optionally) query IDs, magnitudes, and scores. Query IDs are taken from column 1, taxonomy IDs from column 2, and scores from column 3. Lines beginning with # will be ignored."
pattern: "*.{tsv}"
output:
- versions:
type: file
description: File containing software versions
pattern: "versions.yml"
- html:
type: file
description: A html file containing an interactive krona plot.
pattern: "*.{html}"
authors:
- "@mjakobs"

View file

@ -2,10 +2,13 @@
// Create Krona visualizations // Create Krona visualizations
// //
include { MEGAN_RMA2INFO } from '../../modules/nf-core/modules/megan/rma2info/main'
include { KAIJU_KAIJU2KRONA } from '../../modules/nf-core/modules/kaiju/kaiju2krona/main' 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'
include { KRONA_KTIMPORTTAXONOMY } from '../../modules/nf-core/modules/krona/ktimporttaxonomy/main'
include { GUNZIP } from '../../modules/nf-core/modules/gunzip/main'
workflow VISUALIZATION_KRONA { workflow VISUALIZATION_KRONA {
take: take:
@ -30,6 +33,7 @@ workflow VISUALIZATION_KRONA {
ch_input_classifications = classifications ch_input_classifications = classifications
.branch { .branch {
kaiju: it[0]['tool'] == 'kaiju' kaiju: it[0]['tool'] == 'kaiju'
malt: it[0]['tool'] == 'malt'
unknown: true unknown: true
} }
@ -72,15 +76,28 @@ workflow VISUALIZATION_KRONA {
Convert Krona text files into html Krona visualizations Convert Krona text files into html Krona visualizations
*/ */
ch_krona_text_for_import = ch_cleaned_krona_text ch_krona_text_for_import = ch_cleaned_krona_text
.map{[[id: it[0]['db_name']], it[1]]} .map{[[id: it[0]['db_name'], tool: it[0]['tool']], it[1]]}
.groupTuple() .groupTuple()
.dump(tag: "text")
KRONA_KTIMPORTTEXT( ch_krona_text_for_import ) KRONA_KTIMPORTTEXT( ch_krona_text_for_import )
ch_krona_html = ch_krona_html.mix( KRONA_KTIMPORTTEXT.out.html ) ch_krona_html = ch_krona_html.mix( KRONA_KTIMPORTTEXT.out.html )
ch_versions = ch_versions.mix( KRONA_KTIMPORTTEXT.out.versions.first() ) ch_versions = ch_versions.mix( KRONA_KTIMPORTTEXT.out.versions.first() )
/* /*
Convert Krona Convert MALT/MEGAN RMA2INFO files into html Krona visualisations
*/ */
if ( params.krona_taxonomy_directory ) {
MEGAN_RMA2INFO ( ch_input_classifications.malt, false )
GUNZIP ( MEGAN_RMA2INFO.out.txt )
ch_krona_taxonomy_for_input = GUNZIP.out.gunzip
.map{[[id: it[0]['db_name'], tool: it[0]['tool']], it[1]]}
.groupTuple()
.dump(tag: "taxonomy")
KRONA_KTIMPORTTAXONOMY ( ch_krona_taxonomy_for_input, file(params.krona_taxonomy_directory, checkExists: true) )
ch_krona_html.mix( KRONA_KTIMPORTTAXONOMY.out.html )
ch_versions = ch_versions.mix( MEGAN_RMA2INFO.out.versions.first() )
ch_versions = ch_versions.mix( KRONA_KTIMPORTTAXONOMY.out.versions.first() )
}
emit: emit:
html = ch_krona_html html = ch_krona_html

View file

@ -35,6 +35,8 @@ if (params.longread_hostremoval_index ) { ch_longread_reference_index = fi
if (params.diamond_save_reads ) log.warn "[nf-core/taxprofiler] DIAMOND only allows output of a single format. As --diamond_save_reads supplied, only aligned reads in SAM format will be produced, no taxonomic profiles will be available." if (params.diamond_save_reads ) log.warn "[nf-core/taxprofiler] DIAMOND only allows output of a single format. As --diamond_save_reads supplied, only aligned reads in SAM format will be produced, no taxonomic profiles will be available."
if (params.run_malt && params.run_krona && !params.krona_taxonomy_directory) log.warn "[nf-core/taxprofiler] Krona can only be run on MALT output if path to Krona taxonomy database supplied to --krona_taxonomy_directory. Krona will not be executed in this run for MALT."
/* /*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
CONFIG FILES CONFIG FILES