pal.substmodel
Class AbstractRateMatrix
java.lang.Object
|
+--pal.substmodel.AbstractRateMatrix
- All Implemented Interfaces:
- java.lang.Cloneable, NamedParameterized, Parameterized, RateMatrix, Report, java.io.Serializable
- Direct Known Subclasses:
- AminoAcidModel, CodonModel, NucleotideModel, TwoStateModel
- public abstract class AbstractRateMatrix
- extends java.lang.Object
- implements RateMatrix
abstract base class for all rate matrices
- See Also:
- Serialized Form
Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
dimension
public int dimension
- dimension
frequency
public double[] frequency
- stationary frequencies (sum = 1.0)
rate
public double[][] rate
- rate matrix (transition: from 1st index to 2nd index)
dataType
public DataType dataType
- data type
format
protected FormattedOutput format
AbstractRateMatrix
protected AbstractRateMatrix(int dim)
getTypeID
public int getTypeID()
- get numerical code describing the data type
- Specified by:
getTypeID
in interface RateMatrix
- Returns:
- integer code identifying a data type
getModelID
public abstract int getModelID()
- get numerical code describing the model type
- Specified by:
getModelID
in interface RateMatrix
- Returns:
- integer code identifying a substitution model
getDimension
public int getDimension()
- Specified by:
getDimension
in interface RateMatrix
- Following copied from interface:
pal.substmodel.RateMatrix
- Returns:
- the dimension of this rate matrix.
getEquilibriumFrequencies
public double[] getEquilibriumFrequencies()
- Specified by:
getEquilibriumFrequencies
in interface RateMatrix
- Returns:
- stationary frequencies (sum = 1.0)
getEquilibriumFrequency
public double getEquilibriumFrequency(int i)
- Specified by:
getEquilibriumFrequency
in interface RateMatrix
- Returns:
- stationary frequencie (sum = 1.0) for ith state
getDataType
public DataType getDataType()
- Description copied from interface:
RateMatrix
- Get the data type of this rate matrix
- Specified by:
getDataType
in interface RateMatrix
getRelativeRates
public double[][] getRelativeRates()
- Specified by:
getRelativeRates
in interface RateMatrix
- 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:
getTransitionProbability
in interface RateMatrix
- Parameters:
fromState
- The state from which we are startingtoState
- The resulting state
setDistance
public final void setDistance(double distance)
- Sets the distance (such as time/branch length) used when calculating
the probabilities. This method may well take the most time!
- Specified by:
setDistance
in interface RateMatrix
getTransitionProbabilities
public final void getTransitionProbabilities(double[][] probabilityStore)
- A utility method for speed, transfers trans prob information quickly
into store
- Specified by:
getTransitionProbabilities
in interface RateMatrix
printFrequencies
protected void printFrequencies(java.io.PrintWriter out)
setFrequencies
protected void setFrequencies(double[] f)
fromQToR
protected void fromQToR()
- Computes normalized rate matrix from Q matrix (general reversible model)
- Q_ii = 0
- Q_ij = Q_ji
- Q_ij is stored in R_ij (rate)
- only upper triangular is used
Also updates related MatrixExponential
addPalObjectListener
public void addPalObjectListener(PalObjectListener pol)
- Description copied from interface:
RateMatrix
- Add a PalObjectListener to be notified of changes to the model.
Only the parametersChanged method will generally be called
- Specified by:
addPalObjectListener
in interface RateMatrix
removePalObjectListener
public void removePalObjectListener(PalObjectListener pol)
- Specified by:
removePalObjectListener
in interface RateMatrix
fireParametersChangedEvent
protected void fireParametersChangedEvent()
fireParametersChangedEvent
protected void fireParametersChangedEvent(PalObjectEvent pe)
updateMatrixExp
protected void updateMatrixExp()
clone
public java.lang.Object clone()
- Specified by:
clone
in interface RateMatrix
- Overrides:
clone
in class java.lang.Object