Skip to content

Commit

Permalink
Enable PureCN with tumor-only Mutect too
Browse files Browse the repository at this point in the history
As long as Mutect has been run with a PoN, PureCN can work with it.
  • Loading branch information
lbeltrame committed Oct 30, 2024
1 parent 9e713bb commit 82d477e
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 1 deletion.
29 changes: 29 additions & 0 deletions subworkflows/local/bam_variant_calling_tumor_only_all/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ include { BAM_VARIANT_CALLING_TUMOR_ONLY_CONTROLFREEC } from '../bam_variant_cal
include { BAM_VARIANT_CALLING_TUMOR_ONLY_MANTA } from '../bam_variant_calling_tumor_only_manta/main'
include { BAM_VARIANT_CALLING_TUMOR_ONLY_MUTECT2 } from '../bam_variant_calling_tumor_only_mutect2/main'
include { BAM_VARIANT_CALLING_TUMOR_ONLY_LOFREQ } from '../bam_variant_calling_tumor_only_lofreq/main'
include { PURECN_INTERVALFILE } from '../../../modules/nf-core/purecn/intervalfile/main'
include { BAM_VARIANT_CALLING_SOMATIC_PURECN } from '../bam_variant_calling_somatic_purecn/main.nf'

workflow BAM_VARIANT_CALLING_TUMOR_ONLY_ALL {
take:
Expand All @@ -36,6 +38,8 @@ workflow BAM_VARIANT_CALLING_TUMOR_ONLY_ALL {
panel_of_normals_tbi // channel: [optional] panel_of_normals_tbi
joint_mutect2 // boolean: [mandatory] [default: false] run mutect2 in joint mode
wes // boolean: [mandatory] [default: false] whether targeted data is processed
purecn_gatk_pon // channel: [optional] PoN made from GATK4 for PureCN
purecn_normaldb // channel: [optional] NormalDB generated by PureCN

main:
versions = Channel.empty()
Expand Down Expand Up @@ -173,6 +177,31 @@ workflow BAM_VARIANT_CALLING_TUMOR_ONLY_ALL {
versions = versions.mix(BAM_VARIANT_CALLING_SINGLE_TIDDIT.out.versions)
}

// Needs Mutect and a PoN specified
if (tools.split(',').contains('purecn') &&
tools.split('.').contains("mutect2") &&
panel_of_normals) {

ch_bed = [["id": "intervals_bed"], intervals]
ch_fasta = [["id": "fasta"], fasta]
PURECN_INTERVALFILE(ch_bed, ch_fasta)
versions = versions.mix(PURECN_INTERVALFILE.out.versions)

// As long as there's a PoN, it can work
BAM_VARIANT_CALLING_SOMATIC_PURECN(
cram,
fasta,
fasta_fai,
dict,
file(purecn_normaldb),
BAM_VARIANT_CALLING_TUMOR_ONLY_MUTECT2.out.vcf, // PureCN will do filtering itself
file(purecn_gatk_pon),
PURECN_INTERVALFILE.out.txt,
PURECN_INTERVALFILE.out.bed
)
versions = versions.mix(BAM_VARIANT_CALLING_SOMATIC_PURECN.out.versions)
}

vcf_all = Channel.empty().mix(
vcf_freebayes,
vcf_lofreq,
Expand Down
4 changes: 3 additions & 1 deletion workflows/sarek/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -796,7 +796,9 @@ workflow SAREK {
pon,
pon_tbi,
params.joint_mutect2,
params.wes
params.wes,
params.purecn_gatk_pon,
params.purecn_normaldb
)

// PAIR VARIANT CALLING
Expand Down

0 comments on commit 82d477e

Please sign in to comment.