Package pal.substmodel
Class AbstractRateMatrix
java.lang.Object
pal.substmodel.AbstractRateMatrix
- All Implemented Interfaces:
Serializable,Cloneable,ExternalParameterListener,NamedParameterized,Parameterized,Report,RateMatrix
- Direct Known Subclasses:
AminoAcidModel,CodonModel,NucleotideModel,TwoStateModel
public abstract class AbstractRateMatrix
extends Object
implements RateMatrix, ExternalParameterListener
abstract base class for all rate matrices
- Version:
- $Id: AbstractRateMatrix.java,v 1.30 2004/04/05 05:14:39 matt Exp $
- Author:
- Korbinian Strimmer, Alexei Drummond
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface pal.misc.Parameterized
Parameterized.Null, Parameterized.ParameterizedBase, Parameterized.ParameterizedUser, Parameterized.Utils -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdd a PalObjectListener to be notified of changes to the model.clone()protected voidprotected voidGet the data type of this rate matrixintdouble[]doublegetEquilibriumFrequency(int i) protected final double[]abstract intget numerical code describing the model typefinal doublegetParameter(int parameter) get model parameterdouble[][]final voidgetTransitionProbabilities(double[][] probabilityStore) A utility method for speed, transfers trans prob information quickly into storedoublegetTransitionProbability(int fromState, int toState) Returns the probability of going from one state to another given the current distanceintget numerical code describing the data typevoidFor the external parameter interface.protected voidfinal voidrebuild()protected abstract voidrebuildRateMatrix(double[][] rate, double[] parameters) voidvoidscale(double scale) protected final voidsetDataType(DataType dt) final voidsetDistance(double distance) Sets the distance (such as time/branch length) used when calculating the probabilities.final voidsetDistanceTranspose(double distance) Sets the distance (such as time/branch length) used when calculating the probabilities.protected voidsetFrequencies(double[] f) final voidsetParameter(double value, int parameter) set model parametervoidsetParameters(double[] parameters) doublesetParametersNoScale(double[] parameters) protected voidMethods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface pal.misc.NamedParameterized
getParameterNameMethods inherited from interface pal.misc.Parameterized
getDefaultValue, getLowerLimit, getNumParameters, getUpperLimit, setParameterSEMethods inherited from interface pal.substmodel.RateMatrix
getUniqueName
-
Field Details
-
format
-
-
Constructor Details
-
AbstractRateMatrix
protected AbstractRateMatrix(int dim)
-
-
Method Details
-
getTypeID
public int getTypeID()get numerical code describing the data type- Specified by:
getTypeIDin interfaceRateMatrix- Returns:
- integer code identifying a data type
-
getModelID
public abstract int getModelID()get numerical code describing the model type- Specified by:
getModelIDin interfaceRateMatrix- Returns:
- integer code identifying a substitution model
-
getDimension
public int getDimension()- Specified by:
getDimensionin interfaceRateMatrix- Returns:
- the dimension of this rate matrix.
-
getEquilibriumFrequencies
public double[] getEquilibriumFrequencies()- Specified by:
getEquilibriumFrequenciesin interfaceRateMatrix- Returns:
- stationary frequencies (sum = 1.0)
-
getEquilibriumFrequency
public double getEquilibriumFrequency(int i) - Specified by:
getEquilibriumFrequencyin interfaceRateMatrix- Returns:
- stationary frequencie (sum = 1.0) for ith state
-
getDataType
Description copied from interface:RateMatrixGet the data type of this rate matrix- Specified by:
getDataTypein interfaceRateMatrix
-
setDataType
-
getRelativeRates
public double[][] getRelativeRates()- Specified by:
getRelativeRatesin interfaceRateMatrix- Returns:
- rate matrix (transition: from 1st index to 2nd index)
-
getTransitionProbability
public double getTransitionProbability(int fromState, int toState) Returns the probability of going from one state to another given the current distance- Specified by:
getTransitionProbabilityin interfaceRateMatrix- Parameters:
fromState- The state from which we are startingtoState- The resulting state- Returns:
- the probability of going from one state to another given the current distance
-
rebuild
public final void rebuild() -
setDistance
public final void setDistance(double distance) Sets the distance (such as time/branch length) used when calculating the probabilities.- Specified by:
setDistancein interfaceRateMatrix
-
setDistanceTranspose
public final void setDistanceTranspose(double distance) Sets the distance (such as time/branch length) used when calculating the probabilities.- Specified by:
setDistanceTransposein interfaceRateMatrix
-
getTransitionProbabilities
public final void getTransitionProbabilities(double[][] probabilityStore) A utility method for speed, transfers trans prob information quickly into store- Specified by:
getTransitionProbabilitiesin interfaceRateMatrix
-
scale
public void scale(double scale) - Specified by:
scalein interfaceRateMatrix
-
printFrequencies
-
setFrequencies
protected void setFrequencies(double[] f) -
setParametersNoScale
public double setParametersNoScale(double[] parameters) - Specified by:
setParametersNoScalein interfaceRateMatrix
-
setParameters
public void setParameters(double[] parameters) -
setParameter
public final void setParameter(double value, int parameter) Description copied from interface:Parameterizedset model parameter- Specified by:
setParameterin interfaceParameterized- Parameters:
value- parameter valueparameter- parameter number
-
getParameter
public final double getParameter(int parameter) Description copied from interface:Parameterizedget model parameter- Specified by:
getParameterin interfaceParameterized- Parameters:
parameter- parameter number- Returns:
- parameter value
-
rebuildRateMatrix
protected abstract void rebuildRateMatrix(double[][] rate, double[] parameters) -
addPalObjectListener
Description copied from interface:RateMatrixAdd a PalObjectListener to be notified of changes to the model. Only the parametersChanged method will generally be called- Specified by:
addPalObjectListenerin interfaceRateMatrix
-
removePalObjectListener
- Specified by:
removePalObjectListenerin interfaceRateMatrix
-
fireParametersChangedEvent
protected void fireParametersChangedEvent() -
fireParametersChangedEvent
-
updateMatrixExp
protected void updateMatrixExp() -
parameterChanged
For the external parameter interface. This can be ignored unless you want to use this Rate Matrix as an external parameter listener This method does two things.First it sets a flag indicating that rebuild method should be called the next time a setDistance method is called, and then it notifies any PalObject listeners that a parameter has changed- Specified by:
parameterChangedin interfaceExternalParameterListener
-
clone
- Specified by:
clonein interfaceRateMatrix- Overrides:
clonein classObject
-
getOrthogonalHints
- Specified by:
getOrthogonalHintsin interfaceRateMatrix- Returns:
- null
-
getFrequencies
protected final double[] getFrequencies()
-