Skip to content
Open
32 changes: 12 additions & 20 deletions modules/nf-core/bwa/mem/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,10 @@ process BWA_MEM {
val sort_bam

output:
tuple val(meta), path("*.bam") , emit: bam, optional: true
tuple val(meta), path("*.cram") , emit: cram, optional: true
tuple val(meta), path("*.csi") , emit: csi, optional: true
tuple val(meta), path("*.crai") , emit: crai, optional: true
path "versions.yml" , emit: versions
tuple val(meta), path("*.{sam,bam,cram}"), emit: output
tuple val(meta), path("*.{csi,bai,crai}"), emit: index , optional: true
tuple val("${task.process}"), val('bwa'), eval('bwa 2>&1 | sed -n "s/^Version: //p"'), topic: versions, emit: versions_bwa
tuple val("${task.process}"), val('samtools'), eval("samtools version | sed '1!d;s/.* //'"), topic: versions, emit: versions_samtools

when:
task.ext.when == null || task.ext.when
Expand All @@ -43,13 +42,11 @@ process BWA_MEM {
-t $task.cpus \\
\$INDEX \\
$reads \\
| samtools $samtools_command $args2 ${reference} --threads $task.cpus -o ${prefix}.${extension} -

cat <<-END_VERSIONS > versions.yml
"${task.process}":
bwa: \$(echo \$(bwa 2>&1) | sed 's/^.*Version: //; s/Contact:.*\$//')
samtools: \$(echo \$(samtools --version 2>&1) | sed 's/^.*samtools //; s/Using.*\$//')
END_VERSIONS
| samtools $samtools_command \\
$args2 \\
${reference} \\
--threads $task.cpus \\
-o ${prefix}.${extension} -
"""

stub:
Expand All @@ -60,15 +57,10 @@ process BWA_MEM {
sort_bam && args2.contains("-O cram")? "cram":
!sort_bam && args2.contains("-C") ? "cram":
"bam"
def index_cmd = extension == "bam" ? "touch ${prefix}.csi" :
extension == "cram" ? "touch ${prefix}.crai" : ""
"""
touch ${prefix}.${extension}
touch ${prefix}.csi
touch ${prefix}.crai

cat <<-END_VERSIONS > versions.yml
"${task.process}":
bwa: \$(echo \$(bwa 2>&1) | sed 's/^.*Version: //; s/Contact:.*\$//')
samtools: \$(echo \$(samtools --version 2>&1) | sed 's/^.*samtools //; s/Using.*\$//')
END_VERSIONS
${index_cmd}
"""
}
82 changes: 48 additions & 34 deletions modules/nf-core/bwa/mem/meta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,57 +60,71 @@ input:
description: use samtools sort (true) or samtools view (false)
pattern: "true or false"
output:
bam:
output:
- - meta:
type: map
description: Groovy Map containing sample information
- "*.bam":
- "*.{sam,bam,cram}":
type: file
description: Output BAM file containing read alignments
pattern: "*.{bam}"
description: Output SAM/BAM/CRAM file containing read alignments
pattern: "*.{sam,bam,cram}"
ontologies:
- edam: "http://edamontology.org/format_2572" # BAM
cram:
- - meta:
type: file
description: Output BAM file containing read alignments
ontologies: []
- "*.cram":
type: file
description: Output CRAM file containing read alignments
pattern: "*.{cram}"
ontologies:
- edam: "http://edamontology.org/format_3462" # CRAM
csi:
index:
- - meta:
type: map
description: Groovy Map containing sample information
- "*.csi":
- "*.{csi,bai,crai}":
type: file
description: Optional index file for BAM file
pattern: "*.{csi}"
ontologies: []
crai:
- - meta:
type: map
description: Groovy Map containing sample information
- "*.crai":
type: file
description: Optional index file for CRAM file
pattern: "*.{crai}"
description: Optional index file for BAM/CRAM file
pattern: "*.{csi,bai,crai}"
ontologies: []
versions_bwa:
- - ${task.process}:
type: string
description: The process the versions were collected from
- bwa:
type: string
description: The tool name
- 'bwa 2>&1 | sed -n "s/^Version: //p"':
type: string
description: The command used to generate the version of the tool
versions_samtools:
- - ${task.process}:
type: string
description: The process the versions were collected from
- samtools:
type: string
description: The tool name
- "samtools version | sed '1!d;s/.* //'":
type: string
description: The command used to generate the version of the tool
topics:
versions:
- versions.yml:
type: file
description: File containing software versions
pattern: "versions.yml"
ontologies:
- edam: http://edamontology.org/format_3750 # YAML
- - ${task.process}:
type: string
description: The process the versions were collected from
- bwa:
type: string
description: The tool name
- 'bwa 2>&1 | sed -n "s/^Version: //p"':
type: string
description: The command used to generate the version of the tool
- - ${task.process}:
type: string
description: The process the versions were collected from
- samtools:
type: string
description: The tool name
- "samtools version | sed '1!d;s/.* //'":
type: string
description: The command used to generate the version of the tool

authors:
- "@drpatelh"
- "@jeremy1805"
- "@matthdsm"
maintainers:
- "@drpatelh"
- "@jeremy1805"
- "@matthdsm"
38 changes: 14 additions & 24 deletions modules/nf-core/bwa/mem/tests/main.nf.test
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,9 @@ nextflow_process {
assertAll(
{ assert process.success },
{ assert snapshot(
process.out.cram,
process.out.csi,
process.out.crai,
process.out.versions,
bam(process.out.bam[0][1]).getReadsMD5()
process.out.index,
process.out.findAll { key, val -> key.startsWith("versions") },
bam(process.out.output[0][1]).getReadsMD5()
).match()
}
)
Expand Down Expand Up @@ -79,10 +77,8 @@ nextflow_process {
assertAll(
{ assert process.success },
{ assert snapshot(
process.out.cram,
process.out.csi,
process.out.crai,
process.out.versions,
process.out.index,
process.out.findAll { key, val -> key.startsWith("versions") },
bam(process.out.bam[0][1]).getReadsMD5()
).match()
}
Expand Down Expand Up @@ -114,11 +110,9 @@ nextflow_process {
assertAll(
{ assert process.success },
{ assert snapshot(
process.out.cram,
process.out.csi,
process.out.crai,
process.out.versions,
bam(process.out.bam[0][1]).getReadsMD5()
process.out.index,
process.out.findAll { key, val -> key.startsWith("versions") },
bam(process.out.output[0][1]).getReadsMD5()
).match()
}
)
Expand Down Expand Up @@ -149,11 +143,9 @@ nextflow_process {
assertAll(
{ assert process.success },
{ assert snapshot(
process.out.cram,
process.out.csi,
process.out.crai,
process.out.versions,
bam(process.out.bam[0][1]).getReadsMD5()
process.out.index,
process.out.findAll { key, val -> key.startsWith("versions") },
bam(process.out.output[0][1]).getReadsMD5()
).match()
}
)
Expand Down Expand Up @@ -184,11 +176,9 @@ nextflow_process {
assertAll(
{ assert process.success },
{ assert snapshot(
process.out.cram,
process.out.csi,
process.out.crai,
process.out.versions,
bam(process.out.bam[0][1]).getReadsMD5()
process.out.index,
process.out.findAll { key, val -> key.startsWith("versions") },
bam(process.out.output[0][1]).getReadsMD5()
).match()
}
)
Expand Down
Loading
Loading