5 #ifndef BPP_PHYL_MODEL_FREQUENCYSET_CODONFREQUENCYSET_H
6 #define BPP_PHYL_MODEL_FREQUENCYSET_CODONFREQUENCYSET_H
58 std::shared_ptr<const GeneticCode> gCode,
59 const std::string& mgmtStopCodon =
"quadratic",
60 unsigned short method = 1);
62 static const short F0;
65 static const short F61;
80 std::shared_ptr<const GeneticCode>
pgc_;
94 std::shared_ptr<const GeneticCode> gCode,
95 bool allowNullFreqs =
false,
96 unsigned short method = 1,
97 const std::string& name =
"Full");
100 std::shared_ptr<const GeneticCode> gCode,
101 const std::vector<double>& initFreqs,
102 bool allowNullFreqs =
false,
103 unsigned short method = 1,
104 const std::string& name =
"Full");
118 void setFrequencies(
const std::vector<double>& frequencies)
override;
122 return std::dynamic_pointer_cast<const CodonAlphabet>(
getAlphabet());
125 void setNamespace(
const std::string& nameSpace)
override;
149 std::shared_ptr<const GeneticCode>
pgc_;
153 std::shared_ptr<const GeneticCode> gCode,
154 const std::vector<double>& initFreqs,
155 const std::string& name =
"Fixed");
162 std::shared_ptr<const GeneticCode> gCode,
163 const std::string& name =
"Fixed");
184 return std::dynamic_pointer_cast<const CodonAlphabet>(
getAlphabet());
191 void setFrequencies(
const std::vector<double>& frequencies)
override;
202 std::shared_ptr<const GeneticCode>
pgc_;
206 std::shared_ptr<const GeneticCode> gCode,
207 const std::string& path,
229 return std::dynamic_pointer_cast<const CodonAlphabet>(
getAlphabet());
236 void setFrequencies(
const std::vector<double>& frequencies)
override;
260 std::shared_ptr<const GeneticCode>
pgc_;
261 std::unique_ptr<ProteinFrequencySetInterface>
ppfs_;
281 std::shared_ptr<const GeneticCode> gencode,
282 std::unique_ptr<ProteinFrequencySetInterface> ppfs,
283 unsigned short method = 1);
292 std::shared_ptr<const GeneticCode> gencode,
293 unsigned short method = 1);
306 return std::dynamic_pointer_cast<const CodonAlphabet>(
getAlphabet());
315 void setFrequencies(
const std::vector<double>& frequencies)
override;
321 return ppfs_ !=
nullptr;
331 return vS_.size() > 0 ?
vS_[0].getMethod() :
static_cast<unsigned short>(1);
356 std::shared_ptr<const GeneticCode>
pgc_;
378 std::shared_ptr<const GeneticCode> gCode,
379 std::vector<std::unique_ptr<FrequencySetInterface>>& freqvector,
380 const std::string& name =
"Codon",
381 const std::string& mgmtStopCodon =
"quadratic");
437 std::shared_ptr<const GeneticCode>
pgc_;
459 std::shared_ptr<const GeneticCode> gCode,
460 std::unique_ptr<FrequencySetInterface> pfreq,
461 const std::string& name =
"Codon",
462 const std::string& mgmtStopCodon =
"quadratic");
Basic implementation of the FrequencySet interface.
std::shared_ptr< const Alphabet > getAlphabet() const override
AbstractFrequencySet & operator=(const AbstractFrequencySet &af)
Parametrize a set of state frequencies for codons.
static std::unique_ptr< CodonFrequencySetInterface > getFrequencySetForCodons(short option, std::shared_ptr< const GeneticCode > gCode, const std::string &mgmtStopCodon="quadratic", unsigned short method=1)
A helper function that provide frequencies set for codon models according to PAML option.
virtual std::shared_ptr< const GeneticCode > getGeneticCode() const =0
CodonFrequencySetInterface * clone() const override=0
virtual std::shared_ptr< const CodonAlphabet > getCodonAlphabet() const =0
the Frequencies in codons are the product of Independent Frequencies in letters with the frequencies ...
virtual ~CodonFromIndependentFrequencySet()
CodonFromIndependentFrequencySet * clone() const override
std::map< int, Vint > mStopNeigh_
std::string getMgmtStopCodon() const
Retrieve the mgmt method for the stop codons.
std::shared_ptr< const CodonAlphabet > getCodonAlphabet() const override
std::shared_ptr< const GeneticCode > getGeneticCode() const override
void updateFrequencies() override
Update the frequencies given the parameters.
unsigned short mgmtStopCodon_
std::shared_ptr< const GeneticCode > pgc_
CodonFromIndependentFrequencySet(std::shared_ptr< const GeneticCode > gCode, std::vector< std::unique_ptr< FrequencySetInterface >> &freqvector, const std::string &name="Codon", const std::string &mgmtStopCodon="quadratic")
Constructor from a CodonAlphabet* and a vector of different std::shared_ptr<FrequencySet>....
CodonFromIndependentFrequencySet & operator=(const CodonFromIndependentFrequencySet &iwfs)
the Frequencies in codons are the product of the frequencies for a unique FrequencySet in letters,...
void updateFrequencies() override
Update the frequencies given the parameters.
CodonFromUniqueFrequencySet(std::shared_ptr< const GeneticCode > gCode, std::unique_ptr< FrequencySetInterface > pfreq, const std::string &name="Codon", const std::string &mgmtStopCodon="quadratic")
Constructor from a CodonAlphabet* and a std::shared_ptr<FrequencySet> repeated three times.
std::string getMgmtStopCodon() const
Retrieve the mgmt method for the stop codons.
unsigned short mgmtStopCodon_
std::shared_ptr< const GeneticCode > pgc_
std::shared_ptr< const GeneticCode > getGeneticCode() const override
std::map< int, Vint > mStopNeigh_
CodonFromUniqueFrequencySet & operator=(const CodonFromUniqueFrequencySet &iwfs)
std::shared_ptr< const CodonAlphabet > getCodonAlphabet() const override
CodonFromUniqueFrequencySet * clone() const override
virtual ~CodonFromUniqueFrequencySet()
FrequencySet useful for homogeneous and stationary models, codon implementation.
void setFrequencies(const std::vector< double > &frequencies) override
the given frequencies are normalized such thaat the sum of the frequencies on the non-stop codons equ...
std::shared_ptr< const CodonAlphabet > getCodonAlphabet() const override
std::shared_ptr< const GeneticCode > pgc_
void fireParameterChanged(const ParameterList ¶meters) override
FixedCodonFrequencySet & operator=(const FixedCodonFrequencySet &fcfs)
FixedCodonFrequencySet(std::shared_ptr< const GeneticCode > gCode, const std::vector< double > &initFreqs, const std::string &name="Fixed")
FixedCodonFrequencySet(const FixedCodonFrequencySet &fcfs)
std::shared_ptr< const GeneticCode > getGeneticCode() const override
FixedCodonFrequencySet * clone() const override
Parametrize a set of state frequencies.
virtual std::shared_ptr< const Alphabet > getAlphabet() const =0
A generic FrequencySet for Full Codon alphabets.
FullCodonFrequencySet & operator=(const FullCodonFrequencySet &fcfs)
unsigned short getMethod() const
FullCodonFrequencySet(std::shared_ptr< const GeneticCode > gCode, bool allowNullFreqs=false, unsigned short method=1, const std::string &name="Full")
Construction with uniform frequencies on the letters of the alphabet. The stop codon frequencies are ...
Simplex sFreq_
Simplex to handle the probabilities and the parameters.
std::shared_ptr< const GeneticCode > pgc_
void setFrequencies(const std::vector< double > &frequencies) override
the given frequencies are normalized such that the sum of the frequencies on the non-stop codons equa...
void fireParameterChanged(const ParameterList ¶meters) override
void setNamespace(const std::string &nameSpace) override
std::shared_ptr< const GeneticCode > getGeneticCode() const override
FullCodonFrequencySet * clone() const override
std::shared_ptr< const CodonAlphabet > getCodonAlphabet() const override
FrequencySet integrating ProteinFrequencySet inside CodonFrequencySet. In this case,...
std::unique_ptr< ProteinFrequencySetInterface > ppfs_
std::shared_ptr< const GeneticCode > pgc_
std::shared_ptr< const CodonAlphabet > getCodonAlphabet() const override
virtual ~FullPerAACodonFrequencySet()
void setFrequencies(const std::vector< double > &frequencies) override
the given frequencies are normalized such thaat the sum of the frequencies on the non-stop codons equ...
FullPerAACodonFrequencySet * clone() const override
const ProteinFrequencySetInterface & proteinFrequencySet() const
unsigned short getMethod() const
std::shared_ptr< const GeneticCode > getGeneticCode() const override
void setNamespace(const std::string &prefix) override
std::vector< Simplex > vS_
vector of the simplexes, one for each AA
bool hasProteinFrequencySet() const
FullPerAACodonFrequencySet(std::shared_ptr< const GeneticCode > gencode, std::unique_ptr< ProteinFrequencySetInterface > ppfs, unsigned short method=1)
Create a new FullPerAACodonFrequencySet object.
FullPerAACodonFrequencySet & operator=(const FullPerAACodonFrequencySet &ffs)
void updateFrequencies_()
void fireParameterChanged(const ParameterList ¶meters) override
Parametrize a set of state frequencies for proteins.
unsigned short getMethod() const
UserCodonFrequencySet(std::shared_ptr< const GeneticCode > gCode, const std::string &path, size_t nCol=1)
UserCodonFrequencySet(const UserCodonFrequencySet &fcfs)
std::shared_ptr< const GeneticCode > pgc_
UserCodonFrequencySet & operator=(const UserCodonFrequencySet &fcfs)
std::shared_ptr< const CodonAlphabet > getCodonAlphabet() const override
UserCodonFrequencySet * clone() const override
void setFrequencies(const std::vector< double > &frequencies) override
the given frequencies are normalized such thaat the sum of the frequencies on the non-stop codons equ...
void fireParameterChanged(const ParameterList ¶meters) override
std::shared_ptr< const GeneticCode > getGeneticCode() const override
FrequencySet to be read in a file. More specifically, a frequency set is read in a column of a given ...
UserFrequencySet & operator=(const UserFrequencySet &fmfs)
the Frequencies in words are the product of Independent Frequencies in letters
Defines the basic types of data flow nodes.