Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 14 additions & 7 deletions modules/nf-core/parabricks/mutectcaller/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@ process PARABRICKS_MUTECTCALLER {
path panel_of_normals_index

output:
tuple val(meta), path("*.vcf.gz"), emit: vcf
tuple val(meta), path("*.vcf.gz.stats"), emit: stats
path "compatible_versions.yml", emit: compatible_versions, optional: true
tuple val(meta), path("${prefix}.vcf.gz"), emit: vcf
tuple val(meta), path("${prefix}.vcf.gz.tbi"), emit: tbi
tuple val(meta), path("${prefix}.vcf.gz.stats"), emit: stats
path "compatible_versions.yml", emit: compatible_versions, optional: true
tuple val("${task.process}"), val('parabricks'), eval("pbrun version | grep -m1 '^pbrun:' | sed 's/^pbrun:[[:space:]]*//'"), topic: versions, emit: versions_parabricks

when:
Expand All @@ -32,10 +33,13 @@ process PARABRICKS_MUTECTCALLER {
}

def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}"
prefix = task.ext.prefix ?: "${meta.id}"

def intervals_command = intervals ? (intervals instanceof List ? intervals.collect { interval -> "--interval-file ${interval}" }.join(' ') : "--interval-file ${intervals}") : ""
def prepon_command = panel_of_normals ? "cp -L ${panel_of_normals_index} `readlink -f ${panel_of_normals}`.tbi && pbrun prepon --in-pon-file ${panel_of_normals}" : ""
// prepon and postpon expect the index at <pon>.tbi
def pon_index_command = panel_of_normals && panel_of_normals_index.name != "${panel_of_normals.name}.tbi" ? "cp -L ${panel_of_normals_index} ${panel_of_normals}.tbi" : ""
def prepon_command = panel_of_normals ? "pbrun prepon --in-pon-file ${panel_of_normals}" : ""
def pon_command = panel_of_normals ? "--pon ${panel_of_normals}" : ""
// pbrun postpon requires uncompressed .vcf input; output uncompressed when PON is provided
def mutect_out = panel_of_normals ? "${prefix}.vcf" : "${prefix}.vcf.gz"
def stats_rename = panel_of_normals ? "mv ${prefix}.vcf.stats ${prefix}.vcf.gz.stats" : ""
Expand All @@ -44,14 +48,16 @@ process PARABRICKS_MUTECTCALLER {
def num_gpus = task.accelerator ? "--num-gpus ${task.accelerator.request}" : ""
def normal_bam_flag = normal_bam ? "--in-normal-bam ${normal_bam}" : ""
"""
# if panel of normals specified, run prepon
# if panel of normals specified, place its index at <pon>.tbi and run prepon
${pon_index_command}
${prepon_command}

pbrun \\
mutectcaller \\
--ref ${fasta} \\
--in-tumor-bam ${tumor_bam} \\
${normal_bam_flag} \\
${pon_command} \\
--out-vcf ${mutect_out} \\
${intervals_command} \\
${num_gpus} \\
Expand All @@ -63,9 +69,10 @@ process PARABRICKS_MUTECTCALLER {
"""

stub:
def prefix = task.ext.prefix ?: "${meta.id}"
prefix = task.ext.prefix ?: "${meta.id}"
"""
echo "" | gzip > ${prefix}.vcf.gz
touch ${prefix}.vcf.gz.tbi
touch ${prefix}.vcf.gz.stats

# Capture the full version output once and store it in a variable
Expand Down
31 changes: 24 additions & 7 deletions modules/nf-core/parabricks/mutectcaller/meta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ input:
- edam: "http://edamontology.org/format_2572" # BAM
- tumor_bam_index:
type: file
description: (Optional) bai index corresponding to tumor bam file. Only required
description: (Optional) bai or csi index corresponding to tumor bam file. Only required
if intervals are provided.
pattern: "*.bam.bai"
pattern: "*.{bai,csi}"
ontologies: []
- normal_bam:
type: file
Expand All @@ -41,9 +41,9 @@ input:
- edam: "http://edamontology.org/format_2572" # BAM
- normal_bam_index:
type: file
description: (Optional) bai index corresponding to normal bam file. Only required
description: (Optional) bai or csi index corresponding to normal bam file. Only required
if intervals are provided.
pattern: "*.bam.bai"
pattern: "*.{bai,csi}"
ontologies: []
- intervals:
type: file
Expand All @@ -68,7 +68,12 @@ input:
ontologies: []
- panel_of_normals:
type: file
description: (Optional) panel of normals file.
description: |
(Optional) bgzipped panel of normals file. When provided, the module runs
prepon, passes it to mutectcaller via --pon and annotates the output with
postpon. Its header must contain only contigs present in the reference,
otherwise prepon fails with "Chromosome number of pon file doesn't match
reference" (see `bcftools reheader --fai`). Do not add --pon via ext.args.
pattern: "*.vcf.gz"
ontologies:
- edam: http://edamontology.org/format_3989 # GZIP format
Expand All @@ -84,20 +89,32 @@ output:
description: |
Groovy Map containing sample information
e.g. [ id:'test' ]
- "*.vcf.gz":
- "${prefix}.vcf.gz":
type: file
description: Compressed variants file. Will include an annotated vcf file
if panel of normals is used.
pattern: "*.vcf.gz"
ontologies:
- edam: http://edamontology.org/format_3989 # GZIP format
tbi:
- - meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test' ]
- "${prefix}.vcf.gz.tbi":
type: file
description: Tabix index of the compressed variants file.
pattern: "*.vcf.gz.tbi"
ontologies:
- edam: http://edamontology.org/format_3700 # Tabix index file format
stats:
- - meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test' ]
- "*.vcf.gz.stats":
- "${prefix}.vcf.gz.stats":
type: file
description: Variant statistics.
pattern: "*.vcf.gz.stats"
Expand Down
Loading
Loading