42 #include <Bpp/Numeric/Matrix/MatrixTools.h>    45 #include <Bpp/Seq/Container/SequenceContainerTools.h>    56   const NucleicAlphabet* alphabet,
    65   AbstractParameterAliasable(
"RN95."),
    91   double f = gamma + lambda + delta + kappa;
   105   double kappaP = 
kappa_ / thetaR;
   106   double gammaP = 
gamma_ / (1 - thetaR);
   107   double alphaP = (
alpha_ * (1 - thetaG) + (thetaG < kappaP ? thetaG : kappaP) * (1 - thetaR)) / (thetaG * (1 - thetaR));
   108   double sigmaP = (
sigma_ * (1 - thetaC) + (thetaC < gammaP ? thetaC : gammaP) * thetaR) / (thetaC * thetaR);
   109   addParameter_(
new Parameter(
"RN95.thetaR", thetaR, &Parameter::PROP_CONSTRAINT_EX));
   110   addParameter_(
new Parameter(
"RN95.thetaC", thetaC, &Parameter::PROP_CONSTRAINT_EX));
   111   addParameter_(
new Parameter(
"RN95.thetaG", thetaG, &Parameter::PROP_CONSTRAINT_EX));
   112   addParameter_(
new Parameter(
"RN95.gammaP", gammaP, &Parameter::PROP_CONSTRAINT_EX));
   113   addParameter_(
new Parameter(
"RN95.kappaP", kappaP, &Parameter::PROP_CONSTRAINT_EX));
   114   addParameter_(
new Parameter(
"RN95.alphaP", alphaP, 
new IntervalConstraint(1, 1, 
false), 
true));
   115   addParameter_(
new Parameter(
"RN95.sigmaP", sigmaP, 
new IntervalConstraint(1, 1, 
false), 
true));
   123   double alphaP  = getParameterValue(
"alphaP");
   124   double sigmaP  = getParameterValue(
"sigmaP");
   125   double thetaR  = getParameterValue(
"thetaR");
   126   double thetaC  = getParameterValue(
"thetaC");
   127   double thetaG  = getParameterValue(
"thetaG");
   128   double gammaP  = getParameterValue(
"gammaP");
   129   double kappaP  = getParameterValue(
"kappaP");
   132   gamma_ = gammaP * (1 - thetaR);
   135   alpha_ = (alphaP * (1 - thetaR) * thetaG - (thetaG < kappaP ? thetaG : kappaP) * (1 - thetaR)) / (1 - thetaG);
   136   sigma_ = (sigmaP * thetaR * thetaC - (thetaC < gammaP ? thetaC : gammaP) * thetaR) / (1 - thetaC);
   142   freq_[0] = (1 - thetaG) * thetaR;
   143   freq_[1] = thetaC * (1 - thetaR);
   144   freq_[2] = thetaG * thetaR;
   145   freq_[3] = (1 - thetaC) * (1 - thetaR);
   176   for (
size_t i = 0; i < 4; i++)
   238     catch (ZeroDivisionException& e)
   240       ApplicationTools::displayMessage(
"Singularity during diagonalization of RN95. Taylor series used instead.");
   248     for (
unsigned int i = 0; i < 
size_; i++)
   249       for (
unsigned int j = 0; j < 
size_; j++)
   523   setParameterValue(
"thetaR", (freqs[0] + freqs[2]) / (freqs[0] + freqs[1] + freqs[2] + freqs[3]));
   524   setParameterValue(
"thetaC", freqs[1] / (freqs[1] + freqs[3]));
   525   setParameterValue(
"thetaG", freqs[2] / (freqs[0] + freqs[2]));
 
bool enableEigenDecomposition()
Tell if eigenValues and Vectors must be computed. 
RowMatrix< double > exchangeability_
The exchangeability matrix  of the model, defined as . When the model is reversible, this matrix is symetric. 
bool isNonSingular_
boolean value for non-singularity of rightEigenVectors_ 
This class implements a state map where all resolved states are modeled. 
RowMatrix< double > rightEigenVectors_
The  matrix made of right eigen vectors (by column). 
Vdouble eigenValues_
The vector of eigen values. 
const Matrix< double > & getdPij_dt(double d) const
double d2Pij_dt2(size_t i, size_t j, double d) const
Vdouble freq_
The vector  of equilibrium frequencies. 
Partial implementation of the SubstitutionModel interface. 
double Pij_t(size_t i, size_t j, double d) const
const Matrix< double > & getd2Pij_dt2(double d) const
RowMatrix< double > leftEigenVectors_
The  matrix made of left eigen vectors (by row) if rightEigenVectors_ is non-singular. 
RowMatrix< double > generator_
The generator matrix  of the model. 
double rate_
The rate of the model (default: 1). The generator (and all its vectorial components) is independent o...
RN95(const NucleicAlphabet *alphabet, double alpha=1, double beta=1, double gamma=1, double delta=1, double epsilon=1, double kappa=1, double lambda=1, double sigma=1)
std::vector< RowMatrix< double > > vPowGen_
vector of the powers of generator_ for Taylor development (if rightEigenVectors_ is singular)...
void updateMatrices()
Diagonalize the  matrix, and fill the eigenValues_, iEigenValues_, leftEigenVectors_ and rightEigenVe...
size_t size_
The size of the generator, i.e. the number of states. 
const Matrix< double > & getPij_t(double d) const
double dPij_dt(size_t i, size_t j, double d) const
bool isDiagonalizable_
boolean value for diagonalizability in R of the generator_ 
Vdouble iEigenValues_
The vector of the imaginary part of the eigen values. 
void setFreq(std::map< int, double > &)
Set equilibrium frequencies.