public class GenotypeLikelihoods
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
GenotypeLikelihoods.GenotypeLikelihoodsAllelePair |
Modifier and Type | Field and Description |
---|---|
protected static java.util.Map<java.lang.Integer,java.util.List<java.util.List<java.lang.Integer>>> |
anyploidPloidyToPLIndexToAlleleIndices
A cache of PL index to a list of alleles for any ploidy.
|
static int |
MAX_DIPLOID_ALT_ALLELES_THAT_CAN_BE_GENOTYPED
The maximum number of diploid alternate alleles that we can represent as genotype likelihoods
|
static int |
MAX_PL |
protected static int[] |
PLindexConversion |
Modifier and Type | Method and Description |
---|---|
protected static java.util.List<java.util.List<java.lang.Integer>> |
calculateAnyploidPLcache(int altAlleles,
int ploidy)
Calculate the cache of allele indices for each PL index for a ploidy.
|
static int |
calculatePLindex(int allele1Index,
int allele2Index) |
boolean |
equals(java.lang.Object aThat) |
static GenotypeLikelihoods |
fromGLField(java.lang.String GLs)
Deprecated.
|
static GenotypeLikelihoods |
fromLog10Likelihoods(double[] log10Likelihoods) |
static GenotypeLikelihoods |
fromPLField(java.lang.String PLs) |
static GenotypeLikelihoods |
fromPLs(int[] pls) |
static GenotypeLikelihoods.GenotypeLikelihoodsAllelePair |
getAllelePair(int PLindex)
Get the diploid allele index pair for the given PL index
|
static GenotypeLikelihoods.GenotypeLikelihoodsAllelePair |
getAllelePairUsingDeprecatedOrdering(int PLindex)
Deprecated.
|
static java.util.List<java.lang.Integer> |
getAlleles(int PLindex,
int ploidy)
Get the allele ploidy indices for the given PL index
Must use the same ploidy as @see #initializeAnyploidPLIndexToAlleleIndices
|
java.util.EnumMap<GenotypeType,java.lang.Double> |
getAsMap(boolean normalizeFromLog10) |
int[] |
getAsPLs() |
java.lang.String |
getAsString() |
double[] |
getAsVector()
The genotypes likelihoods in -10log10(x) vector format.
|
static double |
getGQLog10FromLikelihoods(int iOfChoosenGenotype,
double[] likelihoods) |
double |
getLog10GQ(Genotype genotype,
java.util.List<Allele> vcAlleles) |
double |
getLog10GQ(GenotypeType genotype)
Deprecated.
|
double |
getLog10GQ(Genotype genotype,
VariantContext context) |
static int[] |
getPLIndecesOfAlleles(int allele1Index,
int allele2Index)
get the PL indexes (AA, AB, BB) for the given allele pair; assumes allele1Index <= allele2Index.
|
static void |
initializeAnyploidPLIndexToAlleleIndices(int altAlleles,
int ploidy)
Initialize cache of allele anyploid indices
If initialized multiple times with the same ploidy, the alternate alleles from the last initialization will be used
|
static int |
numLikelihoods(int numAlleles,
int ploidy)
Compute how many likelihood elements are associated with the given number of alleles
Equivalent to asking in how many ways N non-negative integers can add up to P is S(N,P)
where P = ploidy (number of chromosomes) and N = total # of alleles.
|
java.lang.String |
toString() |
public static final int MAX_PL
public static final int MAX_DIPLOID_ALT_ALLELES_THAT_CAN_BE_GENOTYPED
protected static final java.util.Map<java.lang.Integer,java.util.List<java.util.List<java.lang.Integer>>> anyploidPloidyToPLIndexToAlleleIndices
protected static final int[] PLindexConversion
public static final GenotypeLikelihoods fromPLField(java.lang.String PLs)
@Deprecated public static final GenotypeLikelihoods fromGLField(java.lang.String GLs)
public static final GenotypeLikelihoods fromLog10Likelihoods(double[] log10Likelihoods)
public static final GenotypeLikelihoods fromPLs(int[] pls)
public double[] getAsVector()
public int[] getAsPLs()
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String getAsString()
public boolean equals(java.lang.Object aThat)
equals
in class java.lang.Object
public java.util.EnumMap<GenotypeType,java.lang.Double> getAsMap(boolean normalizeFromLog10)
@Deprecated public double getLog10GQ(GenotypeType genotype)
getLog10GQ(Genotype,VariantContext)
or getLog10GQ(Genotype,List<Allele>)
in place of it.
If you know you're biallelic, use getGQLog10FromLikelihoods
directly.genotype
- - actually a genotype type (no call, hom ref, het, hom var)public double getLog10GQ(Genotype genotype, VariantContext context)
public static double getGQLog10FromLikelihoods(int iOfChoosenGenotype, double[] likelihoods)
protected static java.util.List<java.util.List<java.lang.Integer>> calculateAnyploidPLcache(int altAlleles, int ploidy)
altAlleles
- Number of alternate allelesploidy
- Number of chromosomes in setpublic static int numLikelihoods(int numAlleles, int ploidy)
numAlleles
- Number of alleles (including ref)ploidy
- Ploidy, or number of chromosomes in setpublic static int calculatePLindex(int allele1Index, int allele2Index)
public static GenotypeLikelihoods.GenotypeLikelihoodsAllelePair getAllelePair(int PLindex)
PLindex
- the PL indexjava.lang.IllegalStateException
- if PLindex is negative value or greater than the cache computed by @see #calculateDiploidPLcachepublic static void initializeAnyploidPLIndexToAlleleIndices(int altAlleles, int ploidy)
altAlleles
- number of alternate allelesploidy
- number of chromosomesjava.lang.IllegalArgumentException
- if altAlleles or ploidy <= 0public static java.util.List<java.lang.Integer> getAlleles(int PLindex, int ploidy)
PLindex
- the PL indexploidy
- number of chromosomesjava.lang.IllegalStateException
- if @see #anyploidPloidyToPLIndexToAlleleIndices does not contain the requested ploidy or PL index@Deprecated public static GenotypeLikelihoods.GenotypeLikelihoodsAllelePair getAllelePairUsingDeprecatedOrdering(int PLindex)
PLindex
- the PL indexpublic static int[] getPLIndecesOfAlleles(int allele1Index, int allele2Index)
allele1Index
- the index in VariantContext.getAllele() of the first alleleallele2Index
- the index in VariantContext.getAllele() of the second allele