mirror of
https://github.com/MillironX/taxprofiler.git
synced 2024-12-22 15:08:17 +00:00
Merge pull request #97 from nf-core/malt-to-krona
Add Krona support for MALT
This commit is contained in:
commit
8082c7d108
11 changed files with 219 additions and 2 deletions
|
@ -273,7 +273,7 @@ process {
|
|||
]
|
||||
}
|
||||
|
||||
withName: MEGAN_RMA2INFO {
|
||||
withName: 'NFCORE_TAXPROFILER:TAXPROFILER:PROFILING:MEGAN_RMA2INFO' {
|
||||
ext.args = "-c2c Taxonomy"
|
||||
ext.prefix = { "${meta.id}" }
|
||||
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 {
|
||||
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 = [
|
||||
path: { "${params.outdir}/krona" },
|
||||
mode: params.publish_dir_mode,
|
||||
|
|
|
@ -39,6 +39,7 @@ params {
|
|||
run_diamond = true
|
||||
run_motus = false
|
||||
run_krona = true
|
||||
krona_taxonomy_directory = 'https://raw.githubusercontent.com/nf-core/test-datasets/modules/data/genomics/sarscov2/metagenome/krona_taxonomy.tab'
|
||||
malt_save_reads = true
|
||||
kraken2_save_reads = true
|
||||
centrifuge_save_reads = true
|
||||
|
|
|
@ -39,6 +39,9 @@
|
|||
"filtlong": {
|
||||
"git_sha": "089f761f0bf79c4a486f1df9b6205f650196a2c1"
|
||||
},
|
||||
"gunzip": {
|
||||
"git_sha": "9aadd9a6d3f5964476582319b3a1c54a3e3fe7c9"
|
||||
},
|
||||
"kaiju/kaiju": {
|
||||
"git_sha": "8856f127c58f6af479128be8b8df4d42e442ddbe"
|
||||
},
|
||||
|
@ -54,6 +57,9 @@
|
|||
"krakentools/kreport2krona": {
|
||||
"git_sha": "8b2a473f586bed003e72d2b183acc43fc0ddc422"
|
||||
},
|
||||
"krona/ktimporttaxonomy": {
|
||||
"git_sha": "0e9fd9370ad1845870b8a9c63fcc47d999a1739e"
|
||||
},
|
||||
"krona/ktimporttext": {
|
||||
"git_sha": "cdefbec66999c0b49d8bfeea9d6f9d19056635a2"
|
||||
},
|
||||
|
|
34
modules/nf-core/modules/gunzip/main.nf
generated
Normal file
34
modules/nf-core/modules/gunzip/main.nf
generated
Normal 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
34
modules/nf-core/modules/gunzip/meta.yml
generated
Normal 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"
|
41
modules/nf-core/modules/krona/ktimporttaxonomy/main.nf
generated
Normal file
41
modules/nf-core/modules/krona/ktimporttaxonomy/main.nf
generated
Normal file
|
@ -0,0 +1,41 @@
|
|||
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, stageAs: 'taxonomy.tab'
|
||||
|
||||
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.
|
||||
"""
|
||||
TAXONOMY=\$(find -L . -name '*.tab' -exec dirname {} \\;)
|
||||
echo \$TAXONOMY
|
||||
|
||||
ktImportTaxonomy \\
|
||||
$args \\
|
||||
-o ${prefix}.html \\
|
||||
-tax \$TAXONOMY/ \\
|
||||
$report
|
||||
|
||||
cat <<-END_VERSIONS > versions.yml
|
||||
"${task.process}":
|
||||
krona: $VERSION
|
||||
END_VERSIONS
|
||||
"""
|
||||
}
|
48
modules/nf-core/modules/krona/ktimporttaxonomy/meta.yml
generated
Normal file
48
modules/nf-core/modules/krona/ktimporttaxonomy/meta.yml
generated
Normal file
|
@ -0,0 +1,48 @@
|
|||
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 a Krona taxonomy .tab file normally downloaded and generated by
|
||||
krona/ktUpdateTaxonomy. Custom taxonomy files can have any name, but
|
||||
must end in `.tab`.
|
||||
pattern: "*tab"
|
||||
- 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"
|
|
@ -131,6 +131,7 @@ params {
|
|||
|
||||
// krona
|
||||
run_krona = false
|
||||
krona_taxonomy_directory = null
|
||||
}
|
||||
|
||||
// Load base.config by default for all pipelines
|
||||
|
|
|
@ -441,6 +441,10 @@
|
|||
},
|
||||
"run_krona": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"krona_taxonomy_directory": {
|
||||
"type": "string",
|
||||
"default": null
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,10 +2,13 @@
|
|||
// 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 { KRAKENTOOLS_KREPORT2KRONA } from '../../modules/nf-core/modules/krakentools/kreport2krona/main'
|
||||
include { KRONA_CLEANUP } from '../../modules/local/krona_cleanup'
|
||||
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 {
|
||||
take:
|
||||
|
@ -30,6 +33,7 @@ workflow VISUALIZATION_KRONA {
|
|||
ch_input_classifications = classifications
|
||||
.branch {
|
||||
kaiju: it[0]['tool'] == 'kaiju'
|
||||
malt: it[0]['tool'] == 'malt'
|
||||
unknown: true
|
||||
}
|
||||
|
||||
|
@ -72,12 +76,29 @@ workflow VISUALIZATION_KRONA {
|
|||
Convert Krona text files into html Krona visualizations
|
||||
*/
|
||||
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()
|
||||
.dump(tag: "text")
|
||||
KRONA_KTIMPORTTEXT( ch_krona_text_for_import )
|
||||
ch_krona_html = ch_krona_html.mix( KRONA_KTIMPORTTEXT.out.html )
|
||||
ch_versions = ch_versions.mix( KRONA_KTIMPORTTEXT.out.versions.first() )
|
||||
|
||||
/*
|
||||
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:
|
||||
html = ch_krona_html
|
||||
versions = ch_versions
|
||||
|
|
|
@ -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.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
|
||||
|
|
Loading…
Reference in a new issue