public class GenotypeLikelihoods extends Object
Modifier and Type | Class | Description |
---|---|---|
static class |
GenotypeLikelihoods.GenotypeLikelihoodsAllelePair |
Modifier and Type | Field | Description |
---|---|---|
protected static Map<Integer,List<List<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 | Description |
---|---|---|
protected static List<List<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(Object aThat) |
|
static GenotypeLikelihoods |
fromGLField(String GLs) |
Deprecated.
|
static GenotypeLikelihoods |
fromLog10Likelihoods(double[] log10Likelihoods) |
|
static GenotypeLikelihoods |
fromPLField(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.
since 2/5/13
|
static List<Integer> |
getAlleles(int PLindex,
int ploidy) |
Get the allele ploidy indices for the given PL index
Must use the same ploidy as @see #initializeAnyploidPLIndexToAlleleIndices
|
EnumMap<GenotypeType,Double> |
getAsMap(boolean normalizeFromLog10) |
|
int[] |
getAsPLs() |
|
String |
getAsString() |
|
double[] |
getAsVector() |
The genotypes likelihoods in -10log10(x) vector format.
|
static double |
getGQLog10FromLikelihoods(int iOfChoosenGenotype,
double[] likelihoods) |
|
double |
getLog10GQ(Genotype genotype,
VariantContext context) |
|
double |
getLog10GQ(Genotype genotype,
List<Allele> vcAlleles) |
|
double |
getLog10GQ(GenotypeType genotype) |
Deprecated.
since 2/5/13 use
getLog10GQ(Genotype, VariantContext) or
getLog10GQ(Genotype, List) |
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.
|
String |
toString() |
public static final int MAX_PL
public static final int MAX_DIPLOID_ALT_ALLELES_THAT_CAN_BE_GENOTYPED
protected static final Map<Integer,List<List<Integer>>> anyploidPloidyToPLIndexToAlleleIndices
protected static final int[] PLindexConversion
public static final GenotypeLikelihoods fromPLField(String PLs)
@Deprecated public static final GenotypeLikelihoods fromGLField(String GLs)
public static final GenotypeLikelihoods fromLog10Likelihoods(double[] log10Likelihoods)
public static final GenotypeLikelihoods fromPLs(int[] pls)
public double[] getAsVector()
public int[] getAsPLs()
public String getAsString()
public EnumMap<GenotypeType,Double> getAsMap(boolean normalizeFromLog10)
@Deprecated public double getLog10GQ(GenotypeType genotype)
getLog10GQ(Genotype, VariantContext)
or
getLog10GQ(Genotype, List)
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 List<List<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 indexIllegalStateException
- 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 chromosomesIllegalArgumentException
- if altAlleles or ploidy <= 0public static List<Integer> getAlleles(int PLindex, int ploidy)
PLindex
- the PL indexploidy
- number of chromosomesIllegalStateException
- 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