add kimporttext module (#1560)

* add kimporttext module

* fix the Prettier error.

* fix the Prettier error.

* fix the test.yml

* fix the test.yml

* Update modules/krona/ktimporttext/meta.yml

Co-authored-by: James A. Fellows Yates <jfy133@gmail.com>

* Update modules/krona/ktimporttext/meta.yml

Co-authored-by: James A. Fellows Yates <jfy133@gmail.com>

* Update modules/krona/ktimporttext/meta.yml

Co-authored-by: James A. Fellows Yates <jfy133@gmail.com>

* Update modules/krona/ktimporttext/meta.yml

Co-authored-by: James A. Fellows Yates <jfy133@gmail.com>

* Update modules/krona/ktimporttext/meta.yml

Co-authored-by: James A. Fellows Yates <jfy133@gmail.com>

* update the test files;
simplify the main script of krona/ktimporttext.

* update the test file url for krona ktimporttext

Co-authored-by: James A. Fellows Yates <jfy133@gmail.com>
This commit is contained in:
JIANHONG OU 2022-04-28 08:16:26 -04:00 committed by GitHub
parent 57cb730e78
commit cdefbec669
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 143 additions and 0 deletions

View file

@ -0,0 +1,34 @@
process KRONA_KTIMPORTTEXT {
tag "$meta.id"
label 'process_low'
conda (params.enable_conda ? "bioconda::krona=2.8.1" : null)
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/krona:2.8.1--pl5321hdfd78af_1':
'quay.io/biocontainers/krona:2.8.1--pl5321hdfd78af_1' }"
input:
tuple val(meta), path(report)
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}"
"""
ktImportText \\
$args \\
-o ${prefix}.html \\
$report
cat <<-END_VERSIONS > versions.yml
"${task.process}":
krona: \$( echo \$(ktImportText 2>&1) | sed 's/^.*KronaTools //g; s/- ktImportText.*\$//g')
END_VERSIONS
"""
}

View file

@ -0,0 +1,47 @@
name: "krona_ktimporttext"
description: Creates a Krona chart from text files listing quantities and lineages.
keywords:
- plot
- taxonomy
- interactive
- html
- visualisation
- krona chart
- metagenomics
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: https://github.com/marbl/Krona
doi: 10.1186/1471-2105-12-385
licence: https://raw.githubusercontent.com/marbl/Krona/master/KronaTools/LICENSE.txt
input:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test']
- report:
type: file
description: "Tab-delimited text file. Each line should be a number followed by a list of wedges to contribute to (starting from the highest level). If no wedges are listed (and just a quantity is given), it will contribute to the top level. If the same lineage is listed more than once, the values will be added. Quantities can be omitted if -q is specified. Lines beginning with '#' will be ignored."
pattern: "*.{txt}"
output:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test' ]
- 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:
- "@jianhong"

View file

@ -1050,6 +1050,10 @@ krona/ktimporttaxonomy:
- modules/krona/ktimporttaxonomy/** - modules/krona/ktimporttaxonomy/**
- tests/modules/krona/ktimporttaxonomy/** - tests/modules/krona/ktimporttaxonomy/**
krona/ktimporttext:
- modules/krona/ktimporttext/**
- tests/modules/krona/ktimporttext/**
last/dotplot: last/dotplot:
- modules/last/dotplot/** - modules/last/dotplot/**
- tests/modules/last/dotplot/** - tests/modules/last/dotplot/**

View file

@ -109,6 +109,9 @@ params {
test_sequencing_summary = "${test_data_dir}/genomics/sarscov2/nanopore/sequencing_summary/test.sequencing_summary.txt" test_sequencing_summary = "${test_data_dir}/genomics/sarscov2/nanopore/sequencing_summary/test.sequencing_summary.txt"
} }
'metagenome' {
kraken_report = "${test_data_dir}/genomics/sarscov2/metagenome/test_1.kraken2.report.txt"
}
} }
'homo_sapiens' { 'homo_sapiens' {
'genome' { 'genome' {

View file

@ -0,0 +1,31 @@
#!/usr/bin/env nextflow
nextflow.enable.dsl = 2
include { KRONA_KTIMPORTTEXT } from '../../../../modules/krona/ktimporttext/main.nf'
workflow test_krona_ktimporttext_multi {
input = [
[ id:'test', single_end:false ], // meta map
[
file('https://raw.githubusercontent.com/nf-core/test-datasets/modules/data/delete_me/krona/ktimporttext.txt', checkIfExists: true), // krona default test file
file(params.test_data['sarscov2']['metagenome']['kraken_report'], checkIfExists: true), //Kraken2 report file
file('https://raw.githubusercontent.com/nf-core/test-datasets/modules/data/delete_me/krona/kaiju_out4krona.txt', checkIfExists: true) // Kaiju output 4 krona
]
]
KRONA_KTIMPORTTEXT ( input )
}
workflow test_krona_ktimporttext_single {
input = [
[ id:'test', single_end:false ], // meta map
[
file('http://krona.sourceforge.net/examples/text.txt', checkIfExists: true) // krona default test file
]
]
KRONA_KTIMPORTTEXT ( input )
}

View file

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

View file

@ -0,0 +1,19 @@
- name: krona ktimporttext test_krona_ktimporttext_multi
command: nextflow run tests/modules/krona/ktimporttext -entry test_krona_ktimporttext_multi -c tests/config/nextflow.config
tags:
- krona
- krona/ktimporttext
files:
- path: output/krona/test.html
contains:
- "DOCTYPE html PUBLIC"
- name: krona ktimporttext test_krona_ktimporttext_single
command: nextflow run tests/modules/krona/ktimporttext -entry test_krona_ktimporttext_single -c tests/config/nextflow.config
tags:
- krona
- krona/ktimporttext
files:
- path: output/krona/test.html
contains:
- "DOCTYPE html PUBLIC"