public class GeneralREVRateMatrix extends java.lang.Object implements NeoRateMatrix
Constructor and Description |
---|
GeneralREVRateMatrix(int dimension)
The general constructor for a fully specified REV model
|
GeneralREVRateMatrix(int dimension,
double[] specifiedDefaultParameters)
The general constructor for a fully specified REV model
|
GeneralREVRateMatrix(int dimension,
int[] constraints)
The general constructor
Constraint ordering example, for nucleotide data
-> + A C G T
A * 0 1 2
C * * 3 4
G * * * 5
T * * * *
if constraints were {0,1,1,0,0,1} then would be constrained so a-c = c-g = c-t and a-g = a-t = g-t (and there would be only one parameter) |
GeneralREVRateMatrix(int dimension,
int[] constraints,
double[] specifiedDefaultParameters)
The general constructor
Constraint ordering example, for nucleotide data
-> + A C G T
A * 0 1 2
C * * 3 4
G * * * 5
T * * * *
if constraints were {0,1,1,0,0,1} then would be constrained so a-c = c-g = c-t and a-g = a-t = g-t (and there would be only one parameter) |
GeneralREVRateMatrix(int dimension,
int[] constraints,
double[] specifiedDefaultParameters,
int fixedConstraintValue)
The general constructor
Constraint ordering example, for nucleotide data
-> + A C G T
A * 0 1 2
C * * 3 4
G * * * 5
T * * * *
if constraints were {0,1,1,0,0,1} then would be constrained so a-c = c-g = c-t and a-g = a-t = g-t (and there would be only one parameter) |
Modifier and Type | Method and Description |
---|---|
static GeneralREVRateMatrix |
createGTR()
Create a rate matrix equivalent to the GTR model
|
static GeneralREVRateMatrix |
createGTR(double[] defaultParameters)
Create a rate matrix equivalent to the GTR model
|
static GeneralREVRateMatrix |
createGTR(double a,
double b,
double c,
double d,
double e)
Create a rate matrix equivalent to the GTR model
Parameters laid out
*
-> + A C G T
A * a b c
C * * d e
G * * * 1
T * * * *
|
static GeneralREVRateMatrix |
createHKY()
Create a rate matrix equivalent to the HKY model, the one parameter will be kappa
|
static GeneralREVRateMatrix |
createHKY(double defaultKappa)
Create a rate matrix equivalent to the HKY model, the one parameter will be kappa
|
void |
createRelativeRates(double[][] rateStore,
double[] rateParameters,
int startIndex)
Create the relative rates array
|
void |
getDefaultRateParameters(double[] store,
int startIndex) |
int |
getDimension() |
int |
getNumberOfRateParameters() |
double |
getRateParameterLowerBound(int parameter) |
double |
getRateParameterUpperBound(int parameter) |
java.lang.String |
getUniqueName() |
boolean |
isDataTypeCompatible(DataType dt)
Check the compatibility of a data type to be used with the rate matrix
|
boolean |
isReversible()
Is the relative rate matrix described by this rate matrix meant to represent a reversible process?
If true only the upper part of the rate matrix needs to be filled in (eg in matrix[i][j], for all where j > i );
|
public GeneralREVRateMatrix(int dimension)
dimension
- the dimension of the data typepublic GeneralREVRateMatrix(int dimension, double[] specifiedDefaultParameters)
dimension
- the dimension of the data typespecifiedDefaultParameters
- the defaultParameters (potentially used as the starting parameters by a SubstitutionModel)public GeneralREVRateMatrix(int dimension, int[] constraints)
-> + A C G T
A * 0 1 2
C * * 3 4
G * * * 5
T * * * *
if constraints were {0,1,1,0,0,1} then would be constrained so a-c = c-g = c-t and a-g = a-t = g-t (and there would be only one parameter)dimension
- the dimension of the data typeconstraints
- the contraints, organised such that if constraints[i]==constraints[j] then transitions i and j will always be the same. The constraints are ordered like usual.public GeneralREVRateMatrix(int dimension, int[] constraints, double[] specifiedDefaultParameters)
-> + A C G T
A * 0 1 2
C * * 3 4
G * * * 5
T * * * *
if constraints were {0,1,1,0,0,1} then would be constrained so a-c = c-g = c-t and a-g = a-t = g-t (and there would be only one parameter)dimension
- the dimension of the data typeconstraints
- the contraints, organised such that if constraints[i]==constraints[j] then transitions i and j will always be the same. The constraints are ordered like usual. The last constrained item is fixed at 1.specifiedDefaultParameters
- the defaultParameters (potentially used as the starting parameters by a SubstitutionModel)public GeneralREVRateMatrix(int dimension, int[] constraints, double[] specifiedDefaultParameters, int fixedConstraintValue)
-> + A C G T
A * 0 1 2
C * * 3 4
G * * * 5
T * * * *
if constraints were {0,1,1,0,0,1} then would be constrained so a-c = c-g = c-t and a-g = a-t = g-t (and there would be only one parameter)dimension
- the dimension of the data typeconstraints
- the contraints, organised such that if constraints[i]==constraints[j] then transitions i and j will always be the same. The constraints are ordered like usual.specifiedDefaultParameters
- the defaultParameters (potentially used as the starting parameters by a SubstitutionModel)fixedConstraintValue
- the value of the constraint (in the constraints array) of the fixed constraint (that is, for which all related parts of the rate matrix are set to 1)public java.lang.String getUniqueName()
getUniqueName
in interface NeoRateMatrix
public boolean isReversible()
NeoRateMatrix
isReversible
in interface NeoRateMatrix
public int getDimension()
getDimension
in interface NeoRateMatrix
public boolean isDataTypeCompatible(DataType dt)
isDataTypeCompatible
in interface NeoRateMatrix
dt
- the data type to testpublic void createRelativeRates(double[][] rateStore, double[] rateParameters, int startIndex)
NeoRateMatrix
createRelativeRates
in interface NeoRateMatrix
rateStore
- The place where the relative rates are stored (should be assumed to be large enough - based on dimension)rateParameters
- The parameters to be used to construct the rate storestartIndex
- The index into the rateParameters to start reading parameterspublic int getNumberOfRateParameters()
getNumberOfRateParameters
in interface NeoRateMatrix
public double getRateParameterLowerBound(int parameter)
getRateParameterLowerBound
in interface NeoRateMatrix
public double getRateParameterUpperBound(int parameter)
getRateParameterUpperBound
in interface NeoRateMatrix
public void getDefaultRateParameters(double[] store, int startIndex)
getDefaultRateParameters
in interface NeoRateMatrix
public static final GeneralREVRateMatrix createGTR()
public static final GeneralREVRateMatrix createGTR(double[] defaultParameters)
defaultParameters
- the default parameters of the modelpublic static final GeneralREVRateMatrix createGTR(double a, double b, double c, double d, double e)
-> + A C G T
A * a b c
C * * d e
G * * * 1
T * * * *
a
- the default a parameter of the modelb
- the default a parameter of the modelc
- the default a parameter of the modeld
- the default a parameter of the modele
- the default a parameter of the modelpublic static final GeneralREVRateMatrix createHKY()
public static final GeneralREVRateMatrix createHKY(double defaultKappa)
defaultKappa
- the default kappa value