Hi Markus,
Thank you for your reply. I do not have the option of upgrading my current R version which is 3.5.1 and I can only install pureCN 1.12.2 on this version of R. Is it possible to work around this? I am also not clear on whether my workflow is correct. I would like to run PureCN with Mutect2, GATK4 and integrate cnvkit results with PureCN.
Currently what I do is I create a pooled reference by: 1) running each germline (unmatched but process matched) sample in Mutect2 tumor mode, and then run SomaticPanelOFNormals on this.
$GATK Mutect2 \
-R $REF_GENOME_b37 \
-I ${GERMLINE_PFX}_G.bam \
-tumor $GERMLINE_PFX\
--germline-resource af-only-gnomad.raw.sites.vcf \
-O ${GERMLINE_PFX}_for_pon.vcf.gz
ls *_pon.vcf.gz >> normals_for_pon_vcf.args
$GATK CreateSomaticPanelOfNormals \
-vcfs normals_for_pon_vcf.args \
-O pon.vcf.gz
2) using bcftools merge to merge all the Mutect2 vcf files for the germlines to create one merged germline.vcf. I then compress using bgzip and index using tabix.
bcftools-1.9/bcftools merge $(ls *_pon.vcf.gz) -Oz -o pon.vcf.gz
bcftools-1.9/bcftools index -t pon.vcf.gz
3) I run this step:
Rscript $PURECN/NormalDB.R --outdir $OUT --normal_panel pon.vcf.gz --assay agilent_v6 --genome hg19 --force
4) I create a mapping bias file using an R script
Rscript create_mapping_bias_file.r
contents of create_mapping_bias_file.r:
library("PureCN")
normal.panel.vcf.file <- "pon.vcf.gz"
bias <- calculateMappingBiasVcf(normal.panel.vcf.file, genome = "h19")
saveRDS(bias, "mapping_bias.rds")
5) I run this command for every tumor sample:
cnvkit.py export seg ${TUMOR_PFX}_T.cns --enumerate-chroms -o ${TUMOR_PFX}.seg
5) I run mutect2 on every single tumor sample
$GATK Mutect2 \
-R $REF_GENOME_b37 \
-I ${TUMOR_PFX}_T.bam \
-tumor $TUMOR_PFX\
--panel-of-normals pon.vcf.gz \
--germline-resource af-only-gnomad.raw.sites.vcf \
-O ${TUMOR_PFX}.vcf.gz
6) I run pureCN
Rscript $PURECN/PureCN.R \
--out ${TUMOR_PFX} \
--sampleid ${TUMOR_PFX}\
--tumor ${TUMOR_PFX}_T.cnr \
--segfile ${TUMOR_PFX}.seg \
--vcf ${TUMOR_PFX}.vcf.gz \
--genome hg19 \
--force --postoptimize --seed 123
--normaldb mapping_bias_agilent_v6_hg19.rds\
In the last step, somehow I get the error that the
seg file does not match the normal db
and if I remove that, I get the error above ((list) object cannot be
coerced to type 'double' Calls: runAbsoluteCN ... filterVcfMuTect2 -> filterVcfBasic -> .filterVcfByBQ -> which Execution halted).
I have searched extensively for documentation on how to integrate Mutect2 and GATK4 with PureCN while using cnvkit output and I could not get much information and so I thought documenting it here and asking for advice might help others in future. Thank you.