Add KAIJU2KRONA module (#1800)

Co-authored-by: James A. Fellows Yates <jfy133@gmail.com>
This commit is contained in:
Thomas A. Christensen II 2022-06-23 11:38:50 -05:00 committed by GitHub
parent 7daba6a13f
commit 2f0b192404
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 120 additions and 0 deletions

View 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
"""
}

View 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"

View file

@ -1137,6 +1137,10 @@ kaiju/kaiju:
- modules/kaiju/kaiju/** - modules/kaiju/kaiju/**
- tests/modules/kaiju/kaiju/** - tests/modules/kaiju/kaiju/**
kaiju/kaiju2krona:
- modules/kaiju/kaiju2krona/**
- tests/modules/kaiju/kaiju2krona/**
kaiju/kaiju2table: kaiju/kaiju2table:
- modules/kaiju/kaiju2table/** - modules/kaiju/kaiju2table/**
- tests/modules/kaiju/kaiju2table/** - tests/modules/kaiju/kaiju2table/**

View file

@ -0,0 +1,20 @@
#!/usr/bin/env nextflow
nextflow.enable.dsl = 2
include { UNTAR } from '../../../../modules/untar/main.nf'
include { KAIJU_KAIJU } from '../../../../modules/kaiju/kaiju/main.nf'
include { KAIJU_KAIJU2KRONA } from '../../../../modules/kaiju/kaiju2krona/main.nf'
workflow test_kaiju_kaiju2krona {
input = [
[ id:'test', single_end:true ], // meta map
file(params.test_data['sarscov2']['illumina']['test_1_fastq_gz'], checkIfExists: true)
]
db = [ [], file(params.test_data['sarscov2']['genome']['kaiju_tar_gz'], checkIfExists: true) ]
UNTAR ( db )
KAIJU_KAIJU ( input, UNTAR.out.untar.map{ it[1] } )
KAIJU_KAIJU2KRONA ( KAIJU_KAIJU.out.results , UNTAR.out.untar.map{ it[1] } )
}

View file

@ -0,0 +1,5 @@
process {
publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" }
}

View file

@ -0,0 +1,8 @@
- name: kaiju kaiju2krona test_kaiju_kaiju2krona
command: nextflow run ./tests/modules/kaiju/kaiju2krona -entry test_kaiju_kaiju2krona -c ./tests/config/nextflow.config -c ./tests/modules/kaiju/kaiju2krona/nextflow.config
tags:
- kaiju/kaiju2krona
- kaiju
files:
- path: output/kaiju/test.txt
md5sum: 68b2309d37767e444193fa6cea7c0494