Description Usage Arguments Details Value Author(s) See Also Examples
View source: R/methods-genotypeToSnpMatrix.R
Convert an array of genotype likelihoods to posterior genotype probabilities.
1 2 |
gl |
Array of genotype likelihoods (log10-scaled). 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. |
pl |
Array of genotype likelihoods (phred-scaled, i.e. -10*log10). 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. |
GLtoGP
computes the probability of each genotype as 10^x / sum(10^x)
.
PLtoGP
first divides by -10 and then proceeds as in GLtoGP
.
An array of posterior genotype probabilities, in the same format as the input (matrix of lists or 3D array).
Stephanie Gogarten <sdmorris@u.washington.edu>
readVcf, genotypeToSnpMatrix
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | ## 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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.