Package pal.eval
Class ConditionalProbabilityStore
- java.lang.Object
-
- pal.eval.ConditionalProbabilityStore
-
- All Implemented Interfaces:
java.io.Serializable
public final class ConditionalProbabilityStore extends java.lang.Object implements java.io.Serializable
Title: ConditionalProbabilityStore (was ConditionalLikelihoodStore)
Description: A container class for various bits of data relating to the conditional likelihood. Things stored include the conditional likelihood, an scale factors and whether the current conditional likelihoods were created from cached data.
- Version:
- 1.0
- Author:
- Matthew Goode
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
ConditionalProbabilityStore.ExtraProcessor
-
Constructor Summary
Constructors Constructor Description ConditionalProbabilityStore(int numberOfCategories, int numberOfStates)
ConditionalProbabilityStore(int numberOfCategories, int numberOfStates, ConditionalProbabilityStore.ExtraProcessor extraProcessor)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description double[][]
calculateCategoryPatternConditionalProbabilities(double[] categoryProbabilities, double[] equilibriumFrequencies, int numberOfPatterns)
Calculate the conditional probabilities for each ancestral state at each site pattern, multiplied by related equilibrium frequenciesdouble
calculateLogLikelihood(double[] categoryProbabilities, double[] equilibriumFrequencies, int numberOfPatterns)
double
calculateLogLikelihood(double[] categoryProbabilities, double[] equilibriumFrequencies, int[] patternWeights, int numberOfPatterns)
double[]
calculatePatternLogLikelihoods(double[] categoryProbabilities, double[] equilibriumFrequencies, int numberOfPatterns)
double[][][]
getConditionalProbabilityAccess(int numberOfPatterns, boolean resultsBasedOnCachedData)
Use this when access the internal conditional likelihood store for the purpose of changing the contents.double[][][]
getConditionalProbabilityAccessNoChangeData(int numberOfPatterns, boolean resultsBasedOnCachedData)
Use this when access the internal conditional likelihood store for the purpose of changing the contents.ConditionalProbabilityStore
getCopy()
Cloningdouble[][][]
getCurrentConditionalProbabilities()
Used for getting access to the internal conditional probability store when the data is not to be directly changed.double[][]
getCurrentConditionalProbabilities(int category)
Used for getting access to the internal conditional probability store when the data is not to be directly changed.ConditionalProbabilityStore.ExtraProcessor
getExtraProcessor()
double[][][]
getIncompleteConditionalProbabilityAccess(int numberOfPatterns, boolean resultsBasedOnCachedData, boolean fix)
Use this when access the internal conditional likelihood store for the purpose of changing the contents.int
getPatternCapacity()
boolean
isBasedOnCachedData()
boolean
isHasExtraProcessor()
void
setBasedOnCachedData(boolean v)
java.lang.String
toString()
java.lang.String
toString(int numberOfPatterns)
-
-
-
Constructor Detail
-
ConditionalProbabilityStore
public ConditionalProbabilityStore(int numberOfCategories, int numberOfStates)
-
ConditionalProbabilityStore
public ConditionalProbabilityStore(int numberOfCategories, int numberOfStates, ConditionalProbabilityStore.ExtraProcessor extraProcessor)
-
-
Method Detail
-
getCopy
public final ConditionalProbabilityStore getCopy()
Cloning- Returns:
- a copy of this conditional probability store
-
isHasExtraProcessor
public final boolean isHasExtraProcessor()
-
getExtraProcessor
public final ConditionalProbabilityStore.ExtraProcessor getExtraProcessor()
-
getPatternCapacity
public int getPatternCapacity()
-
getCurrentConditionalProbabilities
public double[][][] getCurrentConditionalProbabilities()
Used for getting access to the internal conditional probability store when the data is not to be directly changed.- Returns:
- An array of arrays of arrays, in the form [category][pattern][state]
-
getCurrentConditionalProbabilities
public double[][] getCurrentConditionalProbabilities(int category)
Used for getting access to the internal conditional probability store when the data is not to be directly changed.- Parameters:
category
- the transition category of interest- Returns:
- An array of arrays in the form [pattern][state]
-
getConditionalProbabilityAccess
public double[][][] getConditionalProbabilityAccess(int numberOfPatterns, boolean resultsBasedOnCachedData)
Use this when access the internal conditional likelihood store for the purpose of changing the contents.- Parameters:
numberOfPatterns
- An indication of how much space will be required. The result will always be big enough to accomodate the requested number of patterns.resultsBasedOnCachedData
- An indication of whether the new conditionals about to be stored are based on cached data- Returns:
-
getConditionalProbabilityAccessNoChangeData
public double[][][] getConditionalProbabilityAccessNoChangeData(int numberOfPatterns, boolean resultsBasedOnCachedData)
Use this when access the internal conditional likelihood store for the purpose of changing the contents. This version will not automatically resize array, and will throw an exception if the numberOfPatterns requested is incompatible with the current contents of this store.- Parameters:
numberOfPatterns
- An indication of how much space will be required. An exception is thrown if this number of patterns cannot be accomodated without being resized.resultsBasedOnCachedData
- An indication of whether the new conditionals about to be stored are based on cached data- Returns:
- Throws:
java.lang.IllegalArgumentException
- if incompatible number of patterns
-
getIncompleteConditionalProbabilityAccess
public double[][][] getIncompleteConditionalProbabilityAccess(int numberOfPatterns, boolean resultsBasedOnCachedData, boolean fix)
Use this when access the internal conditional likelihood store for the purpose of changing the contents. The state arrays will not be created.- Parameters:
numberOfPatterns
- An indication of how much space will be required. The result will always be big enough to accomodate the requested number of patterns.resultsBasedOnCachedData
- An indication of whether the new conditionals about to be stored are based on cached data- Returns:
-
calculateLogLikelihood
public double calculateLogLikelihood(double[] categoryProbabilities, double[] equilibriumFrequencies, int[] patternWeights, int numberOfPatterns)
-
calculateLogLikelihood
public double calculateLogLikelihood(double[] categoryProbabilities, double[] equilibriumFrequencies, int numberOfPatterns)
-
calculatePatternLogLikelihoods
public double[] calculatePatternLogLikelihoods(double[] categoryProbabilities, double[] equilibriumFrequencies, int numberOfPatterns)
-
calculateCategoryPatternConditionalProbabilities
public double[][] calculateCategoryPatternConditionalProbabilities(double[] categoryProbabilities, double[] equilibriumFrequencies, int numberOfPatterns)
Calculate the conditional probabilities for each ancestral state at each site pattern, multiplied by related equilibrium frequencies- Parameters:
categoryProbabilities
- The prior probability of a site belonging to a particular categoryequilibriumFrequencies
- the prior probabibilities of seeing a particular statenumberOfPatterns
- The number of patterns- Returns:
- the related conditional probability array organised [category][pattern]
-
isBasedOnCachedData
public boolean isBasedOnCachedData()
-
setBasedOnCachedData
public void setBasedOnCachedData(boolean v)
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
toString
public java.lang.String toString(int numberOfPatterns)
-
-