43 #include <Bpp/Io/FileTools.h> 44 #include <Bpp/Text/TextTools.h> 45 #include <Bpp/Text/StringTokenizer.h> 46 #include <Bpp/App/ApplicationTools.h> 47 #include <Bpp/Numeric/VectorTools.h> 48 #include <Bpp/Numeric/Matrix/MatrixTools.h> 49 #include <Bpp/Numeric/Stat/Mva/CorrespondenceAnalysis.h> 51 #include <Bpp/Seq/SequenceTools.h> 66 const ProteicAlphabet* alpha,
70 AbstractParameterAliasable(
"Coala."),
76 exch_(model.getName()),
91 ifstream in(file.c_str(), ios::in);
93 for (
unsigned int i = 1; i < 20; i++)
95 string line = FileTools::getNextLine(in);
96 StringTokenizer st(line);
97 for (
unsigned int j = 0; j < i; j++)
99 double s = TextTools::toDouble(st.nextToken());
105 for (
unsigned int i = 0; i < 20; i++)
108 for (
unsigned int j = 0; j < 20; j++)
130 vector<double> coord;
133 coord.push_back(getParameter(
"AxPos" + TextTools::toString(i)).getValue());
137 vector<double> tmpFreqs;
139 for (
unsigned int i = 0; i < tmpFreqs.size(); i++)
147 for (
unsigned int i = 0; i < 20; i++)
149 if (
freq_[i] < 0.001)
162 double s = VectorTools::sum(
freq_);
163 for (
size_t i = 0; i < 20; i++)
185 addParameters_(pList);
RowMatrix< double > exchangeability_
The exchangeability matrix of the model, defined as . When the model is reversible, this matrix is symetric.
virtual const Matrix< double > & getExchangeabilityMatrix() const =0
This class implements a state map where all resolved states are modeled.
void updateMatrices()
Compute and diagonalize the matrix, and fill the eigenValues_, leftEigenVectors_ and rightEigenVecto...
Specialized interface for protein substitution model.
Vdouble freq_
The vector of equilibrium frequencies.
Coala(const ProteicAlphabet *alpha, const ProteinSubstitutionModel &model, unsigned int nbAxes=0, bool param=true)
virtual void updateMatrices()
Compute and diagonalize the matrix, and fill the eigenValues_, leftEigenVectors_ and rightEigenVecto...
std::vector< double > colWeights_
Partial implementation of the ReversibleSubstitutionModel interface.
void computeEquilibriumFrequencies()
std::vector< double > prodMatrixVector(RowMatrix< double > &P, std::vector< double > &V)
void setFreqFromData(const SequenceContainer &data, double pseudoCount=0)
Set equilibrium frequencies equal to the frequencies estimated from the data.
void readFromFile(std::string &file)
std::string getName() const
Get the name of the model.
ParameterList computeCOA(const SequenceContainer &data, bool param=true)
This class is the core class inherited by the Coala class. COaLA is a branch-heterogeneous amino-acid...