Update centrifuge/centrifuge (#1495)

This commit is contained in:
Sofia Stamouli 2022-04-07 11:46:34 +02:00 committed by GitHub
parent dc95e67e15
commit d2726fcf75
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 22 additions and 35 deletions

View file

@ -1,4 +1,4 @@
process CENTRIFUGE { process CENTRIFUGE_CENTRIFUGE {
tag "$meta.id" tag "$meta.id"
label 'process_high' label 'process_high'
@ -10,7 +10,6 @@ process CENTRIFUGE {
input: input:
tuple val(meta), path(reads) tuple val(meta), path(reads)
path db path db
val db_name
val save_unaligned val save_unaligned
val save_aligned val save_aligned
val sam_format val sam_format
@ -18,7 +17,6 @@ process CENTRIFUGE {
output: output:
tuple val(meta), path('*report.txt') , emit: report tuple val(meta), path('*report.txt') , emit: report
tuple val(meta), path('*results.txt') , emit: results tuple val(meta), path('*results.txt') , emit: results
tuple val(meta), path('*kreport.txt') , emit: kreport
tuple val(meta), path('*.sam') , optional: true, emit: sam tuple val(meta), path('*.sam') , optional: true, emit: sam
tuple val(meta), path('*.mapped.fastq{,.1,.2}.gz') , optional: true, emit: fastq_mapped tuple val(meta), path('*.mapped.fastq{,.1,.2}.gz') , optional: true, emit: fastq_mapped
tuple val(meta), path('*.unmapped.fastq{,.1,.2}.gz') , optional: true, emit: fastq_unmapped tuple val(meta), path('*.unmapped.fastq{,.1,.2}.gz') , optional: true, emit: fastq_unmapped
@ -31,7 +29,6 @@ process CENTRIFUGE {
def args = task.ext.args ?: '' def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}" def prefix = task.ext.prefix ?: "${meta.id}"
def paired = meta.single_end ? "-U ${reads}" : "-1 ${reads[0]} -2 ${reads[1]}" def paired = meta.single_end ? "-U ${reads}" : "-1 ${reads[0]} -2 ${reads[1]}"
def db_name = db.toString().replace(".tar.gz","")
def unaligned = '' def unaligned = ''
def aligned = '' def aligned = ''
if (meta.single_end) { if (meta.single_end) {
@ -43,8 +40,10 @@ process CENTRIFUGE {
} }
def sam_output = sam_format ? "--out-fmt 'sam'" : '' def sam_output = sam_format ? "--out-fmt 'sam'" : ''
""" """
## we add "-no-name ._" to ensure silly Mac OSX metafiles files aren't included
db_name=`find -L ${db} -name "*.1.cf" -not -name "._*" | sed 's/.1.cf//'`
centrifuge \\ centrifuge \\
-x ${db}/${db_name} \\ -x \$db_name \\
-p $task.cpus \\ -p $task.cpus \\
$paired \\ $paired \\
--report-file ${prefix}.report.txt \\ --report-file ${prefix}.report.txt \\
@ -53,7 +52,6 @@ process CENTRIFUGE {
$aligned \\ $aligned \\
$sam_output \\ $sam_output \\
$args $args
centrifuge-kreport -x $db_name ${prefix}.results.txt > ${prefix}.kreport.txt
cat <<-END_VERSIONS > versions.yml cat <<-END_VERSIONS > versions.yml
"${task.process}": "${task.process}":

View file

@ -1,4 +1,4 @@
name: centrifuge name: centrifuge_centrifuge
description: Classifies metagenomic sequence data description: Classifies metagenomic sequence data
keywords: keywords:
- classify - classify
@ -25,11 +25,7 @@ input:
respectively. respectively.
- db: - db:
type: directory type: directory
description: Centrifuge database in .tar.gz format description: Path to directory containing centrifuge database files
pattern: "*.tar.gz"
- db_name:
type: string
description: Centrifuge database filenames without the suffix ".cf"
- save_unaligned: - save_unaligned:
type: value type: value
description: If true unmapped fastq files are saved description: If true unmapped fastq files are saved
@ -52,12 +48,6 @@ output:
description: | description: |
File containing classification results File containing classification results
pattern: "*.{results.txt}" pattern: "*.{results.txt}"
- kreport:
type: file
description: |
File containing kraken-style report from centrifuge
out files.
pattern: "*.{kreport.txt}"
- fastq_unmapped: - fastq_unmapped:
type: file type: file
description: Unmapped fastq files description: Unmapped fastq files

View file

@ -395,9 +395,9 @@ cellranger/mkref:
- modules/cellranger/gtf/** - modules/cellranger/gtf/**
- tests/modules/cellranger/gtf/** - tests/modules/cellranger/gtf/**
centrifuge: centrifuge/centrifuge:
- modules/centrifuge/** - modules/centrifuge/centrifuge/**
- tests/modules/centrifuge/** - tests/modules/centrifuge/centrifuge/**
checkm/lineagewf: checkm/lineagewf:
- modules/checkm/lineagewf/** - modules/checkm/lineagewf/**

View file

@ -2,37 +2,36 @@
nextflow.enable.dsl = 2 nextflow.enable.dsl = 2
include { UNTAR } from '../../../modules/untar/main.nf' include { UNTAR } from '../../../../modules/untar/main.nf'
include { CENTRIFUGE } from '../../../modules/centrifuge/main.nf' include { CENTRIFUGE_CENTRIFUGE } from '../../../../modules/centrifuge/centrifuge/main.nf'
workflow test_centrifuge_single_end { workflow test_centrifuge_centrifuge_single_end {
input = [ [ id:'test', single_end:true ], // meta map input = [ [ id:'test', single_end:true ], // meta map
[ file(params.test_data['sarscov2']['illumina']['test_1_fastq_gz'], checkIfExists: true) ] [ 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) ] 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_unaligned = true
save_aligned = false save_aligned = false
sam_format = false sam_format = false
UNTAR ( db ) UNTAR ( db )
CENTRIFUGE ( input, UNTAR.out.untar.map{ it[1] },db_name, save_unaligned, save_aligned, sam_format ) CENTRIFUGE_CENTRIFUGE ( input, UNTAR.out.untar.map{ it[1] }, save_unaligned, save_aligned, sam_format )
} }
workflow test_centrifuge_paired_end { workflow test_centrifuge_centrifuge_paired_end {
input = [ [ id:'test', single_end:false ], // meta map 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_1_fastq_gz'], checkIfExists: true),
file(params.test_data['sarscov2']['illumina']['test_2_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) ] db = [ [], file('https://raw.githubusercontent.com/nf-core/test-datasets/modules/data/delete_me/minigut_cf.tar.gz', checkIfExists: true) ]
db_name = "minigut_cf" //db_name = "minigut_cf"
save_unaligned = true save_unaligned = true
save_aligned = false save_aligned = false
sam_format = false sam_format = false
UNTAR ( db ) UNTAR ( db )
CENTRIFUGE ( input, UNTAR.out.untar.map{ it[1] }, db_name, save_unaligned, save_aligned, sam_format ) CENTRIFUGE_CENTRIFUGE ( input, UNTAR.out.untar.map{ it[1] }, save_unaligned, save_aligned, sam_format )
} }

View file

@ -1,20 +1,20 @@
- name: centrifuge test_centrifuge_single_end - name: centrifuge centrifuge test_centrifuge_centrifuge_single_end
command: nextflow run tests/modules/centrifuge -entry test_centrifuge_single_end -c tests/config/nextflow.config command: nextflow run tests/modules/centrifuge/centrifuge -entry test_centrifuge_centrifuge_single_end -c tests/config/nextflow.config
tags: tags:
- centrifuge - centrifuge
- centrifuge/centrifuge
files: files:
- path: output/centrifuge/test.kreport.txt
- path: output/centrifuge/test.report.txt - path: output/centrifuge/test.report.txt
- path: output/centrifuge/test.results.txt - path: output/centrifuge/test.results.txt
- path: output/centrifuge/test.unmapped.fastq.gz - path: output/centrifuge/test.unmapped.fastq.gz
- path: output/centrifuge/versions.yml - path: output/centrifuge/versions.yml
- name: centrifuge test_centrifuge_paired_end - name: centrifuge centrifuge test_centrifuge_centrifuge_paired_end
command: nextflow run tests/modules/centrifuge -entry test_centrifuge_paired_end -c tests/config/nextflow.config command: nextflow run tests/modules/centrifuge/centrifuge -entry test_centrifuge_centrifuge_paired_end -c tests/config/nextflow.config
tags: tags:
- centrifuge - centrifuge
- centrifuge/centrifuge
files: files:
- path: output/centrifuge/test.kreport.txt
- path: output/centrifuge/test.report.txt - path: output/centrifuge/test.report.txt
- path: output/centrifuge/test.results.txt - path: output/centrifuge/test.results.txt
- path: output/centrifuge/test.unmapped.fastq.1.gz - path: output/centrifuge/test.unmapped.fastq.1.gz