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;
81 std::shared_ptr<const GeneticCode>
pgc_;
95 std::shared_ptr<const GeneticCode> gCode,
96 bool allowNullFreqs =
false,
97 unsigned short method = 1,
98 const std::string& name =
"Full");
101 std::shared_ptr<const GeneticCode> gCode,
102 const std::vector<double>& initFreqs,
103 bool allowNullFreqs =
false,
104 unsigned short method = 1,
105 const std::string& name =
"Full");
119 void setFrequencies(
const std::vector<double>& frequencies)
override;
123 return std::dynamic_pointer_cast<const CodonAlphabet>(
getAlphabet());
126 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;
203 std::shared_ptr<const GeneticCode>
pgc_;
207 std::shared_ptr<const GeneticCode> gCode,
208 const std::string& path,
230 return std::dynamic_pointer_cast<const CodonAlphabet>(
getAlphabet());
237 void setFrequencies(
const std::vector<double>& frequencies)
override;
264 std::shared_ptr<const GeneticCode>
pgc_;
265 std::unique_ptr<ProteinFrequencySetInterface>
ppfs_;
285 std::shared_ptr<const GeneticCode> gencode,
286 std::unique_ptr<ProteinFrequencySetInterface> ppfs,
287 unsigned short method = 1);
296 std::shared_ptr<const GeneticCode> gencode,
297 unsigned short method = 1);
310 return std::dynamic_pointer_cast<const CodonAlphabet>(
getAlphabet());
319 void setFrequencies(
const std::vector<double>& frequencies)
override;
325 return ppfs_ !=
nullptr;
335 return vS_.size() > 0 ?
vS_[0].getMethod() :
static_cast<unsigned short>(1);
397 std::shared_ptr<const GeneticCode>
pgc_;
412 std::shared_ptr<const GeneticCode> gCode,
413 std::vector<std::unique_ptr<FrequencySetInterface>>& freqvector,
414 const std::string& name =
"Codon",
415 const std::string& mgmtStopCodon =
"quadratic");
506 std::shared_ptr<const GeneticCode>
pgc_;
521 std::shared_ptr<const GeneticCode> gCode,
522 std::unique_ptr<FrequencySetInterface> pfreq,
523 const std::string& name =
"Codon",
524 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.
virtual std::shared_ptr< const CodonAlphabet > getCodonAlphabet() const =0
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.
CodonFrequencySetInterface * clone() const override=0
virtual std::shared_ptr< const GeneticCode > getGeneticCode() const =0
the Frequencies in codons are the product of Independent Frequencies in letters with the frequencies ...
virtual ~CodonFromIndependentFrequencySet()
std::shared_ptr< const GeneticCode > getGeneticCode() 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
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 * clone() const override
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.
std::shared_ptr< const GeneticCode > getGeneticCode() const override
unsigned short mgmtStopCodon_
std::shared_ptr< const GeneticCode > pgc_
std::map< int, Vint > mStopNeigh_
CodonFromUniqueFrequencySet & operator=(const CodonFromUniqueFrequencySet &iwfs)
std::shared_ptr< const CodonAlphabet > getCodonAlphabet() const override
virtual ~CodonFromUniqueFrequencySet()
CodonFromUniqueFrequencySet * clone() const override
FrequencySet for codons, with no parameter.
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 > getGeneticCode() const override
std::shared_ptr< const GeneticCode > pgc_
FixedCodonFrequencySet & operator=(const FixedCodonFrequencySet &fcfs)
void fireParameterChanged(const ParameterList ¶meters) override
FixedCodonFrequencySet * clone() const override
FixedCodonFrequencySet(std::shared_ptr< const GeneticCode > gCode, const std::vector< double > &initFreqs, const std::string &name="Fixed")
FixedCodonFrequencySet(const FixedCodonFrequencySet &fcfs)
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 > getGeneticCode() const override
FullCodonFrequencySet * clone() const override
std::shared_ptr< const GeneticCode > pgc_
std::shared_ptr< const CodonAlphabet > getCodonAlphabet() const override
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
FrequencySet integrating ProteinFrequencySet inside CodonFrequencySet. In this case,...
std::unique_ptr< ProteinFrequencySetInterface > ppfs_
std::shared_ptr< const GeneticCode > pgc_
virtual ~FullPerAACodonFrequencySet()
FullPerAACodonFrequencySet * 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...
unsigned short getMethod() const
void setNamespace(const std::string &prefix) override
std::vector< Simplex > vS_
vector of the simplexes, one for each AA
const ProteinFrequencySetInterface & proteinFrequencySet() const
std::shared_ptr< const CodonAlphabet > getCodonAlphabet() const override
bool hasProteinFrequencySet() const
std::shared_ptr< const GeneticCode > getGeneticCode() const override
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)
UserCodonFrequencySet * clone() const override
std::shared_ptr< const CodonAlphabet > getCodonAlphabet() 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.