|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectModels.RateCategory
public class RateCategory
Represents a rate category of a phylogenetic model.
Nested Class Summary | |
---|---|
static class |
RateCategory.FrequencyType
Enumeration of the different ways of defining the root frequency |
class |
RateCategory.RateException
Exception thrown if there is a problem within a RateClass |
Constructor Summary | |
---|---|
RateCategory(java.lang.String[][] rates,
RateCategory.FrequencyType freqType,
java.util.HashMap<java.lang.String,java.lang.Integer> map)
Constrcutor for when the root distribution is defined as the stationary or quasi-staionary distribution. |
|
RateCategory(java.lang.String[][] rates,
java.lang.String[] freq,
java.util.HashMap<java.lang.String,java.lang.Integer> map)
Constructor for when the root distribution is defined. |
Method Summary | |
---|---|
static RateCategory |
fromFile(java.io.File mfile)
Creates an instance from the information in a file. |
ArrayMap<java.lang.String,java.lang.Integer> |
getArrayMap()
Gets the map that maps state to position in matrix Called this as getMap() is kept for comptability |
double[] |
getFreq()
Gets the root frequencies |
java.util.Map<java.lang.String,java.lang.Integer> |
getMap()
Gets the map that maps state to position in matrix |
java.lang.String |
getName()
Get the name of the rate category |
int |
getNumberStates()
Gets the number of states in the rate class |
SquareMatrix |
getP(double length)
Gets the P-matrix for a given length |
double |
getTotalRate()
Gets the total rate of the rate class. |
void |
setName(java.lang.String name)
Sets the name of the rate category. |
void |
setParameters(Parameters p)
Updates the parameters in the RateCategory. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public RateCategory(java.lang.String[][] rates, RateCategory.FrequencyType freqType, java.util.HashMap<java.lang.String,java.lang.Integer> map) throws RateCategory.RateException
rates
- Array representing the rate matrixfreqType
- How the root frequency is calculatedmap
- Map from State to position in matrix (0-index). For example
map would contain A -> 0 if state A was in the first position (column and
row of the matrix.
RateCategory.RateException
- If the rate matrix is not squarepublic RateCategory(java.lang.String[][] rates, java.lang.String[] freq, java.util.HashMap<java.lang.String,java.lang.Integer> map) throws RateCategory.RateException
_StateName
, for example if there is a state A,
the parameter _A
can be used to represent the frquency of A.
rates
- Array representing the rate matrixfreq
- Root frequency.map
- Map from State to position in matrix (0-index) or root frequency.
For example map would contain A -> 0 if state A was in the first position
(column and row) of the matrix and in the first position of the root frequency
array.
RateCategory.RateException
- If the rate matrix is not square
or the frequncy array is not the same length as the rate matrix.Method Detail |
---|
public void setParameters(Parameters p) throws RateCategory.RateException
p
- The new parameters
RateCategory.RateException
- If the parameters passed does not
include all the parameters in the model.public double getTotalRate()
public double[] getFreq()
getMap()
and which was passed to the constuctor.public int getNumberStates()
public ArrayMap<java.lang.String,java.lang.Integer> getArrayMap()
getMap()
is kept for comptability
public java.util.Map<java.lang.String,java.lang.Integer> getMap()
public SquareMatrix getP(double length) throws RateCategory.RateException
length
- The length
getMap()
and which was passed to the constuctor.
RateCategory.RateException
- Thrown if the matrix cannot be
calculated.public void setName(java.lang.String name)
name
- The rate category's namepublic java.lang.String getName()
public java.lang.String toString()
toString
in class java.lang.Object
public static RateCategory fromFile(java.io.File mfile) throws InputException, RateCategory.RateException
MathsParse
for a description of the format of the equations that can be in the rate
matrix and root distribution.
File format is as follows:
mfile
- The input file
InputException
- If there is a problem with the input file
RateCategory.RateException
- If the RateCategory can not be created
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |