I have a vcf file with PL values and I would like to convert it into GP (genotype probabilities) values.
I am using package VariantAnnotation in R, but I have difficulties with saving of output vcf file with GP values (or other format – beagle is which I need for other analyses).
Please could you advice which command I have to use to save vcf file with GP values.
I have found example for convert to posterior probabilities, but I can’t figure out how to save it.
## Read a vcf file with a "PL" field.
vcfFile <- system.file("extdata", "hapmap_exome_chr22.vcf.gz",
vcf <- readVcf(vcfFile, "hg19")
## extract genotype likelihoods as a matrix of lists
pl <- geno(vcf)$PL
## convert to posterior probabilities
gp <- PLtoGP(pl)
Is there a limit for the number of SNPs in vcf file? When I am trying to readVcf file, Rstudio is falling down. Thanks.
I think any limitations would come from R and your computer's RAM rather than the VariantAnnotation package in particular. If your file is large, you might want to iterate rather than reading the entire file at once. From the man page for