Skip to content

Commit

Permalink
Fix centrifuge: reduce number of input channels (#3674)
Browse files Browse the repository at this point in the history
* Bump taxpasta version (biocontainer not yet available)

* Remove unnecessary (and sometimes problematic) input channel

* Improve output glob for optional alignments

* Remove now unnecessary variable from command

* linting

* Add missing args
  • Loading branch information
jfy133 authored Jul 27, 2023
1 parent b2c97d9 commit 7b0b427
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
5 changes: 1 addition & 4 deletions modules/nf-core/centrifuge/centrifuge/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,11 @@ process CENTRIFUGE_CENTRIFUGE {
path db
val save_unaligned
val save_aligned
val sam_format

output:
tuple val(meta), path('*report.txt') , emit: report
tuple val(meta), path('*results.txt') , emit: results
tuple val(meta), path('*.sam') , optional: true, emit: sam
tuple val(meta), path('*.{sam,tab}') , optional: true, emit: sam
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
path "versions.yml" , emit: versions
Expand All @@ -38,7 +37,6 @@ process CENTRIFUGE_CENTRIFUGE {
unaligned = save_unaligned ? "--un-conc-gz ${prefix}.unmapped.fastq.gz" : ''
aligned = save_aligned ? "--al-conc-gz ${prefix}.mapped.fastq.gz" : ''
}
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\$//'`
Expand All @@ -50,7 +48,6 @@ process CENTRIFUGE_CENTRIFUGE {
-S ${prefix}.results.txt \\
$unaligned \\
$aligned \\
$sam_output \\
$args
cat <<-END_VERSIONS > versions.yml
Expand Down
9 changes: 7 additions & 2 deletions modules/nf-core/centrifuge/centrifuge/meta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ input:
type: directory
description: Path to directory containing centrifuge database files
- save_unaligned:
type: value
type: boolean
description: If true unmapped fastq files are saved
- save_aligned:
type: value
type: boolean
description: If true mapped fastq files are saved
output:
- meta:
Expand All @@ -48,6 +48,11 @@ output:
description: |
File containing classification results
pattern: "*.{results.txt}"
- sam:
type: file
description: |
Optional output file containing read alignments (SAM format )or a table of per-read hit information (TAB)s
pattern: "*.{sam,tab}"
- fastq_unmapped:
type: file
description: Unmapped fastq files
Expand Down
6 changes: 2 additions & 4 deletions tests/modules/nf-core/centrifuge/centrifuge/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,9 @@ workflow test_centrifuge_centrifuge_single_end {
db = [ [], file('https://raw.githubusercontent.com/nf-core/test-datasets/modules/data/delete_me/minigut_cf.tar.gz', checkIfExists: true) ]
save_unaligned = true
save_aligned = false
sam_format = false

UNTAR ( db )
CENTRIFUGE_CENTRIFUGE ( input, UNTAR.out.untar.map{ it[1] }, save_unaligned, save_aligned, sam_format )
CENTRIFUGE_CENTRIFUGE ( input, UNTAR.out.untar.map{ it[1] }, save_unaligned, save_aligned )

}

Expand All @@ -27,10 +26,9 @@ workflow test_centrifuge_centrifuge_paired_end {
db = [ [], file('https://raw.githubusercontent.com/nf-core/test-datasets/modules/data/delete_me/minigut_cf.tar.gz', checkIfExists: true) ]
save_unaligned = true
save_aligned = false
sam_format = false

UNTAR ( db )
CENTRIFUGE_CENTRIFUGE ( input, UNTAR.out.untar.map{ it[1] }, save_unaligned, save_aligned, sam_format )
CENTRIFUGE_CENTRIFUGE ( input, UNTAR.out.untar.map{ it[1] }, save_unaligned, save_aligned )


}

0 comments on commit 7b0b427

Please sign in to comment.