|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectModels.Model
public class Model
Represents an evolutionary model. May contain many different RateCategory
.
Rates and frequencies within a model (including the frequency of the different
rate classes) are represent by strings. These strings may contain "parameters"
represented by a letter followed by a alphanumeric character which may later
(see Parameter
) be assigned a fixed value or optimised.
They may also contain numbers and mathematical operations. See
FunctionParser
for more on how these rates are evaluated.
Nested Class Summary | |
---|---|
class |
Model.ModelException
Exception thrown when there is a problem with the model |
Constructor Summary | |
---|---|
Model(java.util.Map<RateCategory,java.lang.String> freq)
Creates a new model with multiple rate classes |
|
Model(RateCategory r)
Creates a new model with a single rate class |
Method Summary | |
---|---|
static Model |
fromFile(java.io.File f)
Creates a new model from a file. |
static Model |
gammaRates(RateCategory r,
java.lang.String gamma,
int cats)
Creates a new model with multiple rate classes distributed by a gamma distribution (see Yang 1993) based on a single rate class |
double |
getFreq(RateCategory r)
Gets the frquency of a rate class |
java.util.Map<java.lang.String,java.lang.Integer> |
getMap()
Gets a map from the rate name to its index in the rate matrix Should it really be a method of Model rather than Rate |
int |
getNumberStates()
Get the number of states represented in the model |
java.util.Set<RateCategory> |
getRates()
Gets a set of rate classes in the model |
double |
getScale()
Gets the scale - the value the rate matrices need to be multiplied by to ensure an average rate of 1. |
java.util.Set<java.lang.String> |
getStates()
Gets the set of all states in the model |
boolean |
hasSingleRate()
Tests whether the model has a single rate class. |
java.util.Iterator<RateCategory> |
iterator()
|
void |
setParameters(Parameters p)
Sets the parameters of a model to the values contained in the Parameters data structure. |
void |
setRescale(boolean rescale)
Sets whether the matrix should be rescaled so the average rate of change is one. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Model(RateCategory r)
r
- The single rate classpublic Model(java.util.Map<RateCategory,java.lang.String> freq) throws Model.ModelException
freq
- A map from the rate classes in the model to the frequency of
the rate class (as a String - see the introduction to this class).
Frequencies need not sum to one as they ae rescaled to do so.
Model.ModelException
- If the states in each of the rate classes are not
identical.Method Detail |
---|
public int getNumberStates()
public java.util.Map<java.lang.String,java.lang.Integer> getMap()
public java.util.Set<java.lang.String> getStates()
public double getFreq(RateCategory r)
r
- The rate class to get the frquency for
public void setParameters(Parameters p) throws RateCategory.RateException, Model.ModelException
Parameters
data structure.
p
- The parameter values
RateCategory.RateException
- If there is an error while setting the parameter
values for one of the rate classes.
Model.ModelException
- If there is an error while setting the parameter
values for the frequency of the rate classes.public double getScale()
public boolean hasSingleRate()
public java.util.Iterator<RateCategory> iterator()
iterator
in interface java.lang.Iterable<RateCategory>
public java.util.Set<RateCategory> getRates()
public void setRescale(boolean rescale)
rescale
- Whether to rescalepublic static Model gammaRates(RateCategory r, java.lang.String gamma, int cats)
r
- The rate class to base the model ongamma
- The value of gamma as a string (as it will be evaluated)cats
- The number of categories, or rate classes, in the new model
public static Model fromFile(java.io.File f) throws InputException, Model.ModelException, RateCategory.RateException
MathsParse
for the format of this
equation) followed by a tab followed by a file path to a RateCategoy file.
f
- The input file
InputException
- If there is an exception reading a file
Model.ModelException
- If there is a problem initialising the model
RateCategory.RateException
- If there is a problem with one of
the Rate Categories in the model
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |