Add bracken/combinebrackenoutputs (#2022)

* Add combinebrackenoutputs

* Prettier and relax tests contains

* Apply suggestions from code review

Co-authored-by: Robert A. Petit III <robbie.petit@gmail.com>

Co-authored-by: Robert A. Petit III <robbie.petit@gmail.com>
This commit is contained in:
James A. Fellows Yates 2022-09-07 09:18:21 +02:00 committed by GitHub
parent fe3e18eaee
commit d27b7a6fda
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 110 additions and 0 deletions

View file

@ -0,0 +1,36 @@
process BRACKEN_COMBINEBRACKENOUTPUTS {
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:
path input
output:
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 ?: "bracken_combined.txt"
// 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}
cat <<-END_VERSIONS > versions.yml
"${task.process}":
combine_bracken_output: ${VERSION}
END_VERSIONS
"""
}

View file

@ -0,0 +1,31 @@
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:
- input:
type: file
description: List of output files from bracken
pattern: "*"
output:
- 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

@ -397,6 +397,10 @@ bracken/bracken:
- modules/bracken/bracken/** - modules/bracken/bracken/**
- tests/modules/bracken/bracken/** - tests/modules/bracken/bracken/**
bracken/combinebrackenoutputs:
- modules/bracken/combinebrackenoutputs/**
- tests/modules/bracken/combinebrackenoutputs/**
busco: busco:
- modules/busco/** - modules/busco/**
- tests/modules/busco/** - tests/modules/busco/**

View file

@ -0,0 +1,25 @@
#!/usr/bin/env nextflow
nextflow.enable.dsl = 2
include { UNTAR } from '../../../../modules/untar/main.nf'
include { KRAKEN2_KRAKEN2 } from '../../../../modules/kraken2/kraken2/main.nf'
include { BRACKEN_BRACKEN } from '../../../../modules/bracken/bracken/main.nf'
include { BRACKEN_COMBINEBRACKENOUTPUTS } from '../../../../modules/bracken/combinebrackenoutputs/main.nf'
workflow test_bracken_combinebrackenoutputs {
input = Channel.of(
[[ id:'test', single_end:false, threshold:0, taxonomic_level:'G', read_length:100 ], [ file(params.test_data['sarscov2']['illumina']['test_1_fastq_gz'], checkIfExists: true), file(params.test_data['sarscov2']['illumina']['test_2_fastq_gz'], checkIfExists: true) ]],
[[ id:'test2', single_end:false, threshold:0, taxonomic_level:'G', read_length:100 ], [ file(params.test_data['sarscov2']['illumina']['test_1_fastq_gz'], checkIfExists: true), file(params.test_data['sarscov2']['illumina']['test_2_fastq_gz'], checkIfExists: true) ]],
)
db = file(params.test_data['sarscov2']['genome']['kraken2_bracken_tar_gz'], checkIfExists: true)
ch_db = UNTAR ( [[:], db] ).untar
.map { it[1] }
KRAKEN2_KRAKEN2 ( input, ch_db, false, false )
BRACKEN_BRACKEN ( KRAKEN2_KRAKEN2.out.report, ch_db )
BRACKEN_COMBINEBRACKENOUTPUTS ( BRACKEN_BRACKEN.out.reports.map{it[1]}.collect() )
}

View file

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

View file

@ -0,0 +1,9 @@
- name: bracken combinebrackenoutputs test_bracken_combinebrackenoutputs
command: nextflow run ./tests/modules/bracken/combinebrackenoutputs -entry test_bracken_combinebrackenoutputs -c ./tests/config/nextflow.config -c ./tests/modules/bracken/combinebrackenoutputs/nextflow.config
tags:
- bracken/combinebrackenoutputs
- bracken
files:
- path: output/bracken/bracken_combined.txt
contains:
- "name taxonomy_id taxonomy_lvl"