22 exp_(), p_(size_, size_), freqSet_(nullptr), withFreq_(false)
29 std::shared_ptr<const ProteicAlphabet> alpha,
30 std::unique_ptr<ProteinFrequencySetInterface> freqSet,
34 exp_(), p_(size_, size_), freqSet_(std::move(freqSet)), withFreq_(true)
50 for (
unsigned int i = 0; i < 20; ++i)
52 for (
unsigned int j = 0; j < 20; ++j)
61 for (
unsigned int i = 0; i < 20; ++i)
67 for (
unsigned int i = 0; i < 20; ++i)
69 for (
unsigned int j = 0; j < 20; ++j)
77 for (
unsigned int i = 1; i < 20; ++i)
83 for (
unsigned int i = 0; i < 20; ++i)
87 for (
unsigned int i = 1; i < 20; ++i)
89 for (
unsigned int j = 0; j < 20; ++j)
94 for (
unsigned int i = 0; i < 19; ++i)
99 for (
unsigned int i = 0; i < 20; ++i)
103 for (
unsigned int i = 1; i < 20; ++i)
107 for (
unsigned int i = 0; i < 19; ++i)
109 for (
unsigned int j = 1; j < 20; ++j)
114 for (
unsigned int i = 1; i < 20; ++i)
130 return 1. / 20. + 19. / 20. *
exp(-
rate_ * 20. / 19. * d);
132 return 1. / 20. - 1. / 20. *
exp(-
rate_ * 20. / 19. * d);
175 for (
unsigned int i = 0; i <
size_; i++)
177 for (
unsigned int j = 0; j <
size_; j++)
179 p_(i, j) = (i == j) ? 1. / 20. + 19. / 20. *
exp_ : 1. / 20. - 1. / 20. *
exp_;
193 for (
unsigned int i = 0; i <
size_; i++)
195 for (
unsigned int j = 0; j <
size_; j++)
211 for (
unsigned int i = 0; i <
size_; i++)
213 for (
unsigned int j = 0; j <
size_; j++)
228 map<int, double> counts;
230 for (
auto i : counts)
232 freq_[(size_t)i.first] = i.second;
void addParameters_(const ParameterList ¶meters)
bool matchParametersValues(const ParameterList ¶meters) override
Specialisation abstract class for reversible protein substitution model.
virtual void updateMatrices_() override
Compute and diagonalize the matrix, and fill the eigenValues_, leftEigenVectors_ and rightEigenVecto...
RowMatrix< double > generator_
The generator matrix of the model.
Vdouble eigenValues_
The vector of eigen values.
RowMatrix< double > exchangeability_
The exchangeability matrix of the model, defined as . When the model is reversible,...
const Matrix< double > & getdPij_dt(double t) const
RowMatrix< double > leftEigenVectors_
The matrix made of left eigen vectors (by row) if rightEigenVectors_ is non-singular.
const Matrix< double > & getPij_t(double t) const
RowMatrix< double > rightEigenVectors_
The matrix made of right eigen vectors (by column).
const Matrix< double > & getd2Pij_dt2(double t) const
virtual double d2Pij_dt2(size_t i, size_t j, double t) const override
size_t size_
The number of states.
Vdouble freq_
The vector of equilibrium frequencies.
double rate_
The rate of the model (default: 1). The generator (and all its vectorial components) is independent o...
virtual double Pij_t(size_t i, size_t j, double t) const override
virtual double dPij_dt(size_t i, size_t j, double t) const override
This class implements a state map where all resolved states are modeled.
FrequencySet useful for homogeneous and stationary models, protein implementation.
const Matrix< double > & getPij_t(double d) const override
const Matrix< double > & getd2Pij_dt2(double d) const override
double Pij_t(size_t i, size_t j, double d) const override
double dPij_dt(size_t i, size_t j, double d) const override
double d2Pij_dt2(size_t i, size_t j, double d) const override
JCprot(std::shared_ptr< const ProteicAlphabet > alpha)
Build a simple JC69 model, with original equilibrium frequencies.
void setFreqFromData(const SequenceDataInterface &data, double pseudoCount=0) override
Set equilibrium frequencies equal to the frequencies estimated from the data.
std::unique_ptr< ProteinFrequencySetInterface > freqSet_
void updateMatrices_() override
const Matrix< double > & getdPij_dt(double d) const override
Defines the basic types of data flow nodes.
ExtendedFloat exp(const ExtendedFloat &ef)