GLtoGP {VariantAnnotation}R Documentation

Convert genotype likelihoods to genotype probabilities

Description

Convert an array of genotype likelihoods to posterior genotype probabilities.

Usage

GLtoGP(gl)

Arguments

gl

Array of genotype likelihoods. The format can be a matrix of lists, or a three-dimensional array in which the third dimension corresponds to the probabilities for each genotype.

Details

Computes the probability of each genotype as 10^x / sum(10^x).

Value

An array of posterior genotype probabilities, in the same format as the input (matrix of lists or 3D array).

Author(s)

Stephanie Gogarten <sdmorris@u.washington.edu>

See Also

readVcf, genotypeToSnpMatrix

Examples

  ## 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)

[Package VariantAnnotation version 1.14.6 Index]