mirror of
https://github.com/MillironX/taxprofiler.git
synced 2024-11-14 06:53:09 +00:00
feat: integrate Bracken into the profiling pipeline
This commit is contained in:
parent
4f728648f5
commit
ca38d002de
4 changed files with 52 additions and 9 deletions
|
@ -277,7 +277,7 @@ process {
|
|||
}
|
||||
|
||||
withName: KRAKEN2_KRAKEN2 {
|
||||
ext.args = { "${meta.db_params}" }
|
||||
ext.args = params.kraken2_save_minimizers ? { "${meta.db_params} --report-minimizer-data" } : { "${meta.db_params}" }
|
||||
ext.prefix = params.perform_runmerging ? { "${meta.id}-${meta.db_name}" } : { "${meta.id}-${meta.run_accession}-${meta.db_name}" }
|
||||
publishDir = [
|
||||
path: { "${params.outdir}/kraken2/${meta.db_name}/" },
|
||||
|
@ -286,6 +286,15 @@ process {
|
|||
]
|
||||
}
|
||||
|
||||
withName: BRACKEN_BRACKEN {
|
||||
errorStrategy = 'ignore'
|
||||
publishDir = [
|
||||
path: { "${params.outdir}/bracken/${meta.db_name}/" },
|
||||
mode: params.publish_dir_mode,
|
||||
pattern: '*.tsv'
|
||||
]
|
||||
}
|
||||
|
||||
withName: KRAKENTOOLS_COMBINEKREPORTS {
|
||||
ext.prefix = { "kraken2_${meta.id}_combined_reports" }
|
||||
publishDir = [
|
||||
|
|
|
@ -1,13 +1,11 @@
|
|||
process KRAKEN_STANDARD_REPORT {
|
||||
tag "$meta.id"
|
||||
label 'process_low'
|
||||
label 'process_single'
|
||||
|
||||
conda (params.enable_conda ? 'conda-forge::sed=4.8' : null)
|
||||
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
|
||||
container 'https://containers.biocontainers.pro/s3/SingImgsRepo/biocontainers/v1.2.0_cv2/biocontainers_v1.2.0_cv2.img'
|
||||
} else {
|
||||
container 'biocontainers/biocontainers:v1.2.0_cv2'
|
||||
}
|
||||
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
|
||||
'https://containers.biocontainers.pro/s3/SingImgsRepo/biocontainers/v1.2.0_cv2/biocontainers_v1.2.0_cv2.img' :
|
||||
'biocontainers/biocontainers:v1.2.0_cv2' }"
|
||||
|
||||
input:
|
||||
tuple val(meta), path(report)
|
||||
|
@ -15,10 +13,14 @@ process KRAKEN_STANDARD_REPORT {
|
|||
output:
|
||||
tuple val(meta), path(result), emit: report
|
||||
|
||||
when:
|
||||
task.ext.when == null || task.ext.when
|
||||
|
||||
script:
|
||||
result = "${report.baseName}_standardized.kraken2.report.txt"
|
||||
def prefix = task.ext.prefix ?: "${meta.id}"
|
||||
result = "${prefix}_standardized.kraken2.report.txt"
|
||||
"""
|
||||
cut -f1-3,6-8 "${report}" > "${result}"
|
||||
cut -f1-3,6-8 '${report}' > '${result}'
|
||||
"""
|
||||
}
|
||||
|
||||
|
|
|
@ -114,6 +114,10 @@ params {
|
|||
run_kraken2 = false
|
||||
kraken2_save_reads = false // added directly to module in profiling.nf
|
||||
kraken2_save_readclassification = false // added directly to module in profiling.nf
|
||||
kraken2_save_minimizers = false
|
||||
|
||||
// Bracken
|
||||
run_bracken = true
|
||||
|
||||
// centrifuge
|
||||
run_centrifuge = false
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
include { MALT_RUN } from '../../modules/nf-core/malt/run/main'
|
||||
include { MEGAN_RMA2INFO as MEGAN_RMA2INFO_TSV } from '../../modules/nf-core/megan/rma2info/main'
|
||||
include { KRAKEN2_KRAKEN2 } from '../../modules/nf-core/kraken2/kraken2/main'
|
||||
include { BRACKEN_BRACKEN } from '../../modules/nf-core/bracken/bracken/main'
|
||||
include { CENTRIFUGE_CENTRIFUGE } from '../../modules/nf-core/centrifuge/centrifuge/main'
|
||||
include { CENTRIFUGE_KREPORT } from '../../modules/nf-core/centrifuge/kreport/main'
|
||||
include { METAPHLAN3_METAPHLAN3 } from '../../modules/nf-core/metaphlan3/metaphlan3/main'
|
||||
|
@ -133,6 +134,33 @@ workflow PROFILING {
|
|||
|
||||
}
|
||||
|
||||
if ( params.run_kraken2 && params.run_bracken ) {
|
||||
|
||||
def ch_input_for_bracken
|
||||
|
||||
if (params.kraken2_save_minimizers) {
|
||||
ch_input_for_bracken = KRAKEN_STANDARD_REPORT(KRAKEN2_KRAKEN2.out.report).report
|
||||
} else {
|
||||
ch_input_for_bracken = KRAKEN2_KRAKEN2.out.report
|
||||
}
|
||||
|
||||
ch_input_for_bracken = ch_input_for_bracken
|
||||
.combine(
|
||||
databases.filter { meta, db ->
|
||||
meta['tool'] == 'bracken'
|
||||
}
|
||||
)
|
||||
.multiMap { meta, report, db_meta, db ->
|
||||
report: [meta + db_meta, report]
|
||||
db: db
|
||||
}
|
||||
|
||||
BRACKEN_BRACKEN(ch_input_for_bracken.report, ch_input_for_bracken.db)
|
||||
ch_versions = ch_versions.mix(BRACKEN_BRACKEN.out.versions.first())
|
||||
ch_raw_profiles = ch_raw_profiles.mix(BRACKEN_BRACKEN.out.reports)
|
||||
|
||||
}
|
||||
|
||||
if ( params.run_centrifuge ) {
|
||||
|
||||
ch_input_for_centrifuge = ch_input_for_profiling.centrifuge
|
||||
|
|
Loading…
Reference in a new issue