1
0
Fork 0
mirror of https://github.com/MillironX/taxprofiler.git synced 2024-09-21 08:12:03 +00:00

Merge pull request #188 from nf-core/bracken-mergetables

Add Bracken mergetables
This commit is contained in:
James A. Fellows Yates 2022-12-12 11:26:19 +01:00 committed by GitHub
commit be85cb408c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 110 additions and 5 deletions

View file

@ -321,12 +321,21 @@ process {
]
}
withName: KRAKENTOOLS_COMBINEKREPORTS {
withName: BRACKEN_COMBINEBRACKENOUTPUTS {
ext.prefix = { "bracken_${meta.id}_combined_reports" }
publishDir = [
path: { "${params.outdir}/bracken/" },
mode: params.publish_dir_mode,
pattern: '*.{txt}'
]
}
withName: KRAKENTOOLS_COMBINEKREPORTS_KRAKEN {
ext.prefix = { "kraken2_${meta.id}_combined_reports" }
publishDir = [
path: { "${params.outdir}/kraken2/" },
mode: params.publish_dir_mode,
pattern: '*.{txt}'
pattern: '*.txt'
]
}

View file

@ -30,6 +30,11 @@
"git_sha": "8cab56516076b23c6f8eb1ac20ba4ce9692c85e1",
"installed_by": ["modules"]
},
"bracken/combinebrackenoutputs": {
"branch": "master",
"git_sha": "9c87d5fdad182590a370ea43a4ecebd200a6f6fb",
"installed_by": ["modules"]
},
"cat/fastq": {
"branch": "master",
"git_sha": "5e34754d42cd2d5d248ca8673c0a53cdf5624905",

View file

@ -0,0 +1,37 @@
process BRACKEN_COMBINEBRACKENOUTPUTS {
tag "$meta.id"
label 'process_low'
conda (params.enable_conda ? "bioconda::bracken=2.7" : null)
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/bracken:2.7--py39hc16433a_0':
'quay.io/biocontainers/bracken:2.7--py39hc16433a_0' }"
input:
tuple val(meta), path(input)
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}"
// WARN: Version information not provided by tool on CLI.
// Please update version string below when bumping container versions.
def VERSION = '2.7'
"""
combine_bracken_outputs.py \\
$args \\
--files ${input} \\
-o ${prefix}.txt
cat <<-END_VERSIONS > versions.yml
"${task.process}":
combine_bracken_output: ${VERSION}
END_VERSIONS
"""
}

View file

@ -0,0 +1,41 @@
name: "bracken_combinebrackenoutputs"
description: Combine output of metagenomic samples analyzed by bracken.
keywords:
- sort
tools:
- "bracken":
description: Bracken (Bayesian Reestimation of Abundance with KrakEN) is a highly accurate statistical method that computes the abundance of species in DNA sequences from a metagenomics sample.
homepage: https://ccb.jhu.edu/software/bracken/
documentation: https://ccb.jhu.edu/software/bracken/index.shtml?t=manual
tool_dev_url: https://github.com/jenniferlu717/Bracken
doi: "10.7717/peerj-cs.104"
licence: ["GPL v3"]
input:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- input:
type: file
description: List of output files from bracken
pattern: "*"
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: Combined output in table format
pattern: "*.txt"
authors:
- "@jfy133"

View file

@ -2,6 +2,7 @@
// Standardise output files e.g. aggregation
//
include { BRACKEN_COMBINEBRACKENOUTPUTS } from '../../modules/nf-core/bracken/combinebrackenoutputs/main'
include { KAIJU_KAIJU2TABLE } from '../../modules/nf-core/kaiju/kaiju2table/main'
include { KRAKENTOOLS_COMBINEKREPORTS as KRAKENTOOLS_COMBINEKREPORTS_KRAKEN } from '../../modules/nf-core/krakentools/combinekreports/main'
include { KRAKENTOOLS_COMBINEKREPORTS as KRAKENTOOLS_COMBINEKREPORTS_CENTRIFUGE } from '../../modules/nf-core/krakentools/combinekreports/main'
@ -25,10 +26,11 @@ workflow STANDARDISATION_PROFILES {
*/
ch_input_profiles = profiles
.branch {
motus: it[0]['tool'] == 'motus'
kraken2: it[0]['tool'] == 'kraken2'
bracken: it[0]['tool'] == 'bracken'
centrifuge: it[0]['tool'] == 'centrifuge'
kraken2: it[0]['tool'] == 'kraken2'
metaphlan3: it[0]['tool'] == 'metaphlan3'
motus: it[0]['tool'] == 'motus'
unknown: true
}
@ -49,7 +51,18 @@ workflow STANDARDISATION_PROFILES {
Standardise and aggregate
*/
// CENTRIFUGE
// Bracken
ch_profiles_for_bracken = ch_input_profiles.bracken
.map { [it[0]['db_name'], it[1]] }
.groupTuple()
.map {
[[id:it[0]], it[1]]
}
BRACKEN_COMBINEBRACKENOUTPUTS ( ch_profiles_for_bracken )
// CENTRIFUGE
// Collect and replace id for db_name for prefix
// Have to sort by size to ensure first file actually has hits otherwise