29 std::shared_ptr<const ProteicAlphabet> alpha,
31 const string& prefix) :
43 std::shared_ptr<const ProteicAlphabet> alpha,
45 unique_ptr<ProteinFrequencySetInterface> freqSet,
51 freqSet_(std::move(freqSet))
56 freqSet->setFrequencies(
freq_);
78 throw Exception(
"UserProteinSubstitutionModel::readFromFile. Frequencies file not found : " +
path_);
80 ifstream in(
path_.c_str(), ios::in);
82 for (
unsigned int i = 1; i < 20; i++)
86 for (
unsigned int j = 0; j < i; j++)
93 unsigned int fCount = 0;
94 while (in && fCount < 20)
105 if (sf - 1 > 0.000001)
112 for (
unsigned int i = 0; i < 20; i++)
115 for (
unsigned int j = 0; j < 20; j++)
131 map<int, double> counts;
133 for (
auto i : counts)
135 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 > exchangeability_
The exchangeability matrix of the model, defined as . When the model is reversible,...
Vdouble freq_
The vector of equilibrium frequencies.
This class implements a state map where all resolved states are modeled.
FrequencySet useful for homogeneous and stationary models, protein implementation.
const std::string & nextToken()
bool hasMoreToken() const
std::unique_ptr< ProteinFrequencySetInterface > freqSet_
void setFreqFromData(const SequenceDataInterface &data, double pseudoCount=0) override
Set equilibrium frequencies equal to the frequencies estimated from the data.
UserProteinSubstitutionModel(std::shared_ptr< const ProteicAlphabet > alpha, const std::string &path, const std::string &prefix)
Build a protein model from a PAML file, with original equilibrium frequencies.
std::string getName() const override
Get the name of the model.
double toDouble(const std::string &s, char dec='.', char scientificNotation='e')
bool hasSubstring(const std::string &s, const std::string &pattern)
std::string toString(T t)
Defines the basic types of data flow nodes.