Add centrifuge_kreport module (#1514)

This commit is contained in:
Sofia Stamouli 2022-04-13 15:33:51 +02:00 committed by GitHub
parent e04970b7d2
commit be4ae28c3c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 132 additions and 1 deletions

View file

@ -0,0 +1,33 @@
process CENTRIFUGE_KREPORT {
tag "$meta.id"
label 'process_low'
conda (params.enable_conda ? "bioconda::centrifuge=1.0.4_beta" : null)
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/centrifuge:1.0.4_beta--h9a82719_6':
'quay.io/biocontainers/centrifuge:1.0.4_beta--h9a82719_6' }"
input:
tuple val(meta), path(results)
path db
output:
tuple val(meta), path('*.txt') , emit: kreport
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}"
"""
db_name=`find -L ${db} -name "*.1.cf" -not -name "._*" | sed 's/.1.cf//'`
centrifuge-kreport -x \$db_name ${results} > ${prefix}.txt
cat <<-END_VERSIONS > versions.yml
"${task.process}":
centrifuge: \$( centrifuge --version | sed -n 1p | sed 's/^.*centrifuge-class version //')
END_VERSIONS
"""
}

View file

@ -0,0 +1,41 @@
name: "centrifuge_kreport"
description: Creates Kraken-style reports from centrifuge out files
keywords:
- metagenomics
tools:
- centrifuge:
description: Centrifuge is a classifier for metagenomic sequences.
homepage: https://ccb.jhu.edu/software/centrifuge/
documentation: https://ccb.jhu.edu/software/centrifuge/manual.shtml
doi: 10.1101/gr.210641.116
licence: ["GPL v3"]
input:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- results:
type: file
description: File containing the centrifuge classification results
pattern: "*.{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"
- kreport:
type: file
description: |
File containing kraken-style report from centrifuge
out files.
pattern: "*.{txt}"
authors:
- "@sofstam"
- "@jfy133"

View file

@ -25,7 +25,6 @@ workflow test_centrifuge_centrifuge_paired_end {
file(params.test_data['sarscov2']['illumina']['test_2_fastq_gz'], checkIfExists: true) ]
]
db = [ [], file('https://raw.githubusercontent.com/nf-core/test-datasets/modules/data/delete_me/minigut_cf.tar.gz', checkIfExists: true) ]
//db_name = "minigut_cf"
save_unaligned = true
save_aligned = false
sam_format = false

View file

@ -0,0 +1,32 @@
#!/usr/bin/env nextflow
nextflow.enable.dsl = 2
include { UNTAR } from '../../../../modules/untar/main.nf'
include { CENTRIFUGE_CENTRIFUGE } from '../../../../modules/centrifuge/centrifuge/main.nf'
include { CENTRIFUGE_KREPORT } from '../../../../modules/centrifuge/kreport/main.nf'
workflow test_centrifuge_kreport_single_end {
input = [ [ id:'test', single_end:true ], // meta map
[ file(params.test_data['sarscov2']['illumina']['test_1_fastq_gz'], checkIfExists: true) ]
]
db = [ [], file('https://raw.githubusercontent.com/nf-core/test-datasets/modules/data/delete_me/minigut_cf.tar.gz', checkIfExists: true) ]
ch_db = UNTAR ( db )
CENTRIFUGE_CENTRIFUGE ( input, ch_db.untar.map{ it[1] }, false, false, false )
CENTRIFUGE_KREPORT ( CENTRIFUGE_CENTRIFUGE.out.results, ch_db.untar.map{ it[1] } )
}
workflow test_centrifuge_kreport_paired_end {
input = [ [ id:'test', single_end:false ], // meta map
[ 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('https://raw.githubusercontent.com/nf-core/test-datasets/modules/data/delete_me/minigut_cf.tar.gz', checkIfExists: true) ]
ch_db = UNTAR ( db )
CENTRIFUGE_CENTRIFUGE ( input, ch_db.untar.map{ it[1] }, false, false, false )
CENTRIFUGE_KREPORT ( CENTRIFUGE_CENTRIFUGE.out.results, ch_db.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,21 @@
- name: centrifuge kreport test_centrifuge_kreport_single_end
command: nextflow run tests/modules/centrifuge/kreport -entry test_centrifuge_kreport_single_end -c tests/config/nextflow.config
tags:
- centrifuge
- centrifuge/kreport
files:
- path: output/centrifuge/test.txt
md5sum: af1a51fe57eb6d428350ff4a4bf759d4
contains: ["unclassified"]
- path: output/centrifuge/versions.yml
- name: centrifuge kreport test_centrifuge_kreport_paired_end
command: nextflow run tests/modules/centrifuge/kreport -entry test_centrifuge_kreport_paired_end -c tests/config/nextflow.config
tags:
- centrifuge
- centrifuge/kreport
files:
- path: output/centrifuge/test.txt
md5sum: af1a51fe57eb6d428350ff4a4bf759d4
contains: ["unclassified"]
- path: output/centrifuge/versions.yml