## Read a vcf file with a "GL" field.
vcfFile <- system.file("extdata", "gl_chr1.vcf", package="VariantAnnotation")
vcf <- readVcf(vcfFile, "hg19")
## extract genotype likelihoods as a matrix of lists
gl <- geno(vcf)$GL
class(gl)
mode(gl)
# convert to posterior probabilities
gp <- GLtoGP(gl)
## Read a vcf file with a "PL" field.
vcfFile <- system.file("extdata", "hapmap_exome_chr22.vcf.gz",
package="VariantAnnotation")
vcf <- readVcf(vcfFile, "hg19")
## extract genotype likelihoods as a matrix of lists
pl <- geno(vcf)$PL
class(pl)
mode(pl)
# convert to posterior probabilities
gp <- PLtoGP(pl)
Run the code above in your browser using DataLab