bpp-phyl3  3.0.0
bpp::MvaFrequencySet Class Referenceabstract

A frequencies set used to estimate frequencies at the root with the COaLA model. Frequencies at the root are optimized in the same way than the equlibrium frequencies on branches. Hyperparameters are used, which represent positions along the principal axes obtained from a preliminary Correspondence Analysis. From the optimized positions, the 20 frequencies are calculated. More...

#include <Bpp/Phyl/Model/FrequencySet/MvaFrequencySet.h>

+ Inheritance diagram for bpp::MvaFrequencySet:
+ Collaboration diagram for bpp::MvaFrequencySet:

Public Member Functions

 MvaFrequencySet (std::shared_ptr< const ProteicAlphabet > alpha)
 Constructor. More...
 
MvaFrequencySetclone () const override
 
std::shared_ptr< const ProteicAlphabetgetProteicAlphabet () const override
 
void setTransposeMatrixOfPpalAxes (const RowMatrix< double > &matrix)
 
void setMatrixOfRowCoords (const RowMatrix< double > &matrix)
 
void setNbrOfAxes (const size_t &nAxes)
 
void setModelName (const std::string &modelName)
 
void setVectorOfColumnWeights (const std::vector< double > &cw)
 
void setParamValues (std::map< std::string, std::string > &valuesSettings)
 
void setFrequencies (const std::vector< double > &frequencies) override
 Set the parameters in order to match a given set of frequencies. More...
 
void defineParameters ()
 
void fireParameterChanged (const ParameterList &parameters) override
 
void updateFrequencies ()
 
void initSet (const CoalaCore &coala)
 
void computeReversePCA (const std::vector< double > &positions, std::vector< double > &tmpFreqs)
 
void computeCoordsFirstSpacePCA (std::vector< double > &tmpFreqs, std::vector< double > &freqs)
 
void computeReverseCOA (const std::vector< double > &positions, std::vector< double > &tmpFreqs)
 
void computeCoordsFirstSpaceCOA (std::vector< double > &tmpFreqs, std::vector< double > &freqs)
 
virtual std::shared_ptr< const AlphabetgetAlphabet () const =0
 
virtual const Alphabetalphabet () const =0
 
virtual const StateMapInterfacestateMap () const =0
 
virtual std::shared_ptr< const StateMapInterfacegetStateMap () const =0
 
virtual const VdoublegetFrequencies () const =0
 
virtual const std::map< int, double > getAlphabetStatesFrequencies () const =0
 
virtual void setFrequenciesFromAlphabetStatesFrequencies (const std::map< int, double > &frequencies)=0
 Set the Frequencies from the one of the map which keys match with a letter of the Alphabet. The frequencies are normalized so that the matching values sum 1. More...
 
virtual std::string getName () const =0
 
virtual size_t getNumberOfFrequencies () const =0
 
virtual size_t getNumberOfIndependentParameters () const=0
 
virtual void aliasParameters (const std::string &p1, const std::string &p2)=0
 
virtual void aliasParameters (std::map< std::string, std::string > &unparsedParams, bool verbose)=0
 
virtual void unaliasParameters (const std::string &p1, const std::string &p2)=0
 
virtual const ParameterListgetIndependentParameters () const=0
 
virtual std::vector< std::string > getAlias (const std::string &name) const=0
 
virtual std::map< std::string, std::string > getAliases () const=0
 
virtual bool hasParameter (const std::string &name) const=0
 
virtual const ParameterListgetParameters () const=0
 
virtual const Parameterparameter (const std::string &name) const=0
 
virtual double getParameterValue (const std::string &name) const=0
 
virtual void setAllParametersValues (const ParameterList &parameters)=0
 
virtual void setParameterValue (const std::string &name, double value)=0
 
virtual void setParametersValues (const ParameterList &parameters)=0
 
virtual bool matchParametersValues (const ParameterList &parameters)=0
 
virtual void removeConstraint (const std::string &name)=0
 
virtual void setConstraint (const std::string &name, std::shared_ptr< ConstraintInterface > constraint)=0
 
virtual size_t getNumberOfParameters () const=0
 
virtual void setNamespace (const std::string &prefix)=0
 
virtual std::string getNamespace () const=0
 
virtual std::string getParameterNameWithoutNamespace (const std::string &name) const=0
 
std::shared_ptr< const AlphabetgetAlphabet () const override
 
const Alphabetalphabet () const override
 
const StateMapInterfacestateMap () const override
 
std::shared_ptr< const StateMapInterfacegetStateMap () const override
 
const VdoublegetFrequencies () const override
 
const std::map< int, double > getAlphabetStatesFrequencies () const override
 
void setFrequenciesFromAlphabetStatesFrequencies (const std::map< int, double > &frequencies) override
 Set the Frequencies from the one of the map which keys match with a letter of the Alphabet. The frequencies are normalized so that the matching values sum 1. More...
 
size_t getNumberOfFrequencies () const override
 
std::string getName () const override
 
void normalize ()
 
size_t getNumberOfIndependentParameters () const
 
void aliasParameters (const std::string &p1, const std::string &p2)
 
void aliasParameters (std::map< std::string, std::string > &unparsedParams, bool verbose)
 
void unaliasParameters (const std::string &p1, const std::string &p2)
 
const ParameterListgetIndependentParameters () const
 
virtual std::vector< std::string > getAlias (const std::string &name) const
 
virtual std::map< std::string, std::string > getAliases () const
 
bool hasParameter (const std::string &name) const override
 
const ParameterListgetParameters () const override
 
const Parameterparameter (const std::string &name) const override
 
double getParameterValue (const std::string &name) const override
 
void setAllParametersValues (const ParameterList &parameters) override
 
void setParameterValue (const std::string &name, double value) override
 
void setParametersValues (const ParameterList &parameters) override
 
bool matchParametersValues (const ParameterList &parameters) override
 
void removeConstraint (const std::string &name) override
 
void setConstraint (const std::string &name, std::shared_ptr< ConstraintInterface > constraint) override
 
size_t getNumberOfParameters () const override
 
void setNamespace (const std::string &prefix)
 
std::string getNamespace () const override
 
std::string getParameterNameWithoutNamespace (const std::string &name) const override
 
bool hasIndependentParameter (const std::string &name) const
 
ParameterList getAliasedParameters (const ParameterList &pl) const
 
ParameterList getFromParameters (const ParameterList &pl) const
 
std::string getFrom (const std::string &name) const
 
const std::shared_ptr< Parameter > & getParameter (const std::string &name) const
 

Static Public Attributes

static std::shared_ptr< IntervalConstraintFREQUENCE_CONSTRAINT_SMALL
 
static std::shared_ptr< IntervalConstraintFREQUENCE_CONSTRAINT_MILLI
 
static std::shared_ptr< IntervalConstraintFREQUENCE_CONSTRAINT_CENTI
 

Protected Member Functions

virtual ParameterListgetParameters_ ()=0
 
std::vector< double > & getFrequencies_ ()
 
double & getFreq_ (size_t i)
 
const double & getFreq_ (size_t i) const
 
void setFrequencies_ (const std::vector< double > &frequencies)
 
ParameterListgetParameters_ () override
 
const std::shared_ptr< Parameter > & getParameter (size_t i) const
 
std::shared_ptr< Parameter > & getParameter (size_t i)
 
void addParameter_ (Parameter *parameter)
 
void addParameters_ (const ParameterList &parameters)
 
void shareParameter_ (const std::shared_ptr< Parameter > &parameter)
 
void shareParameters_ (const ParameterList &parameters)
 
void includeParameters_ (const ParameterList &parameters)
 
void deleteParameter_ (size_t index)
 
void deleteParameter_ (std::string &name)
 
void deleteParameters_ (const std::vector< std::string > &names)
 
void resetParameters_ ()
 
ParametergetParameter_ (const std::string &name)
 
ParametergetParameter_ (size_t index)
 
const ParametergetParameter_ (size_t index) const
 
ParametergetParameterWithNamespace_ (const std::string &name)
 
const ParametergetParameterWithNamespace_ (const std::string &name) const
 

Protected Attributes

RowMatrix< double > tPpalAxes_
 
RowMatrix< double > rowCoords_
 
size_t nbrOfAxes_
 
std::string model_
 
std::vector< double > columnWeights_
 
std::map< std::string, std::string > paramValues_
 

Private Attributes

std::shared_ptr< const Alphabetalphabet_
 
std::shared_ptr< const StateMapInterfacestateMap_
 
std::vector< double > freq_
 
std::string name_
 
ParameterList independentParameters_
 
std::map< std::string, std::shared_ptr< AliasParameterListener > > aliasListenersRegister_
 
ParameterList parameters_
 
std::string prefix_
 

Detailed Description

A frequencies set used to estimate frequencies at the root with the COaLA model. Frequencies at the root are optimized in the same way than the equlibrium frequencies on branches. Hyperparameters are used, which represent positions along the principal axes obtained from a preliminary Correspondence Analysis. From the optimized positions, the 20 frequencies are calculated.

Author
Mathieu Groussin

Definition at line 21 of file MvaFrequencySet.h.

Constructor & Destructor Documentation

◆ MvaFrequencySet()

MvaFrequencySet::MvaFrequencySet ( std::shared_ptr< const ProteicAlphabet alpha)

Constructor.

Definition at line 12 of file MvaFrequencySet.cpp.

Referenced by clone().

Member Function Documentation

◆ alphabet() [1/2]

virtual const Alphabet& bpp::FrequencySetInterface::alphabet ( ) const
pure virtualinherited
Returns
The alphabet associated to this set.

Implemented in bpp::AbstractFrequencySet.

◆ alphabet() [2/2]

const Alphabet& bpp::AbstractFrequencySet::alphabet ( ) const
inlineoverridevirtualinherited
Returns
The alphabet associated to this set.

Implements bpp::FrequencySetInterface.

Definition at line 142 of file FrequencySet.h.

References bpp::AbstractFrequencySet::alphabet_.

◆ clone()

MvaFrequencySet* bpp::MvaFrequencySet::clone ( ) const
inlineoverridevirtual

Implements bpp::ProteinFrequencySetInterface.

Definition at line 31 of file MvaFrequencySet.h.

References MvaFrequencySet().

◆ computeCoordsFirstSpaceCOA()

void MvaFrequencySet::computeCoordsFirstSpaceCOA ( std::vector< double > &  tmpFreqs,
std::vector< double > &  freqs 
)

Definition at line 113 of file MvaFrequencySet.cpp.

References columnWeights_.

Referenced by updateFrequencies().

◆ computeCoordsFirstSpacePCA()

void bpp::MvaFrequencySet::computeCoordsFirstSpacePCA ( std::vector< double > &  tmpFreqs,
std::vector< double > &  freqs 
)

◆ computeReverseCOA()

void MvaFrequencySet::computeReverseCOA ( const std::vector< double > &  positions,
std::vector< double > &  tmpFreqs 
)

Definition at line 102 of file MvaFrequencySet.cpp.

References nbrOfAxes_, and tPpalAxes_.

Referenced by updateFrequencies().

◆ computeReversePCA()

void bpp::MvaFrequencySet::computeReversePCA ( const std::vector< double > &  positions,
std::vector< double > &  tmpFreqs 
)

◆ defineParameters()

◆ fireParameterChanged()

void MvaFrequencySet::fireParameterChanged ( const ParameterList parameters)
overridevirtual

Reimplemented from bpp::AbstractParameterAliasable.

Definition at line 51 of file MvaFrequencySet.cpp.

References updateFrequencies().

◆ getAlphabet() [1/2]

◆ getAlphabet() [2/2]

◆ getAlphabetStatesFrequencies() [1/2]

virtual const std::map<int, double> bpp::FrequencySetInterface::getAlphabetStatesFrequencies ( ) const
pure virtualinherited
Returns
The frequencies of each alphabet states according to this model.

Implemented in bpp::AbstractFrequencySet.

◆ getAlphabetStatesFrequencies() [2/2]

const std::map< int, double > AbstractFrequencySet::getAlphabetStatesFrequencies ( ) const
overridevirtualinherited
Returns
The frequencies of each alphabet states according to this model.

Implements bpp::FrequencySetInterface.

Definition at line 57 of file FrequencySet.cpp.

◆ getFreq_() [1/2]

◆ getFreq_() [2/2]

const double& bpp::AbstractFrequencySet::getFreq_ ( size_t  i) const
inlineprotectedinherited

Definition at line 180 of file FrequencySet.h.

References bpp::AbstractFrequencySet::freq_.

◆ getFrequencies() [1/2]

◆ getFrequencies() [2/2]

const Vdouble& bpp::AbstractFrequencySet::getFrequencies ( ) const
inlineoverridevirtualinherited
Returns
The frequencies values of the set.

Implements bpp::FrequencySetInterface.

Definition at line 148 of file FrequencySet.h.

References bpp::AbstractFrequencySet::freq_.

Referenced by updateFrequencies().

◆ getFrequencies_()

std::vector<double>& bpp::AbstractFrequencySet::getFrequencies_ ( )
inlineprotectedinherited

Definition at line 178 of file FrequencySet.h.

References bpp::AbstractFrequencySet::freq_.

Referenced by bpp::UserFrequencySet::readFromFile_().

◆ getName() [1/2]

virtual std::string bpp::FrequencySetInterface::getName ( ) const
pure virtualinherited

◆ getName() [2/2]

std::string bpp::AbstractFrequencySet::getName ( ) const
inlineoverridevirtualinherited

◆ getNumberOfFrequencies() [1/2]

virtual size_t bpp::FrequencySetInterface::getNumberOfFrequencies ( ) const
pure virtualinherited
Returns
The number of frequencies in the set. This is equivalent to getStateMap().getNumberOfModelStates().

Implemented in bpp::AbstractFrequencySet.

◆ getNumberOfFrequencies() [2/2]

size_t bpp::AbstractFrequencySet::getNumberOfFrequencies ( ) const
inlineoverridevirtualinherited
Returns
The number of frequencies in the set. This is equivalent to getStateMap().getNumberOfModelStates().

Implements bpp::FrequencySetInterface.

Definition at line 163 of file FrequencySet.h.

References bpp::AbstractFrequencySet::freq_.

Referenced by bpp::FromModelFrequencySet::setFrequencies(), bpp::FixedFrequencySet::setFrequencies(), and bpp::UserFrequencySet::setFrequencies().

◆ getProteicAlphabet()

std::shared_ptr<const ProteicAlphabet> bpp::MvaFrequencySet::getProteicAlphabet ( ) const
inlineoverridevirtual

◆ getStateMap() [1/2]

virtual std::shared_ptr<const StateMapInterface> bpp::FrequencySetInterface::getStateMap ( ) const
pure virtualinherited
Returns
A shared_ptr toward the mapping of model states with alphabet states.

Implemented in bpp::AbstractFrequencySet.

◆ getStateMap() [2/2]

std::shared_ptr<const StateMapInterface> bpp::AbstractFrequencySet::getStateMap ( ) const
inlineoverridevirtualinherited
Returns
A shared_ptr toward the mapping of model states with alphabet states.

Implements bpp::FrequencySetInterface.

Definition at line 146 of file FrequencySet.h.

References bpp::AbstractFrequencySet::stateMap_.

◆ initSet()

◆ normalize()

void bpp::AbstractFrequencySet::normalize ( )
inlineinherited

◆ setFrequencies()

void MvaFrequencySet::setFrequencies ( const std::vector< double > &  frequencies)
overridevirtual

Set the parameters in order to match a given set of frequencies.

Parameters
frequenciesThe set of frequencies to match.
Exceptions
DimensionExceptionIf the number of frequencies does not match the size of the alphabet.
ExceptionIf the frequencies do not sum to 1.

Implements bpp::FrequencySetInterface.

Definition at line 99 of file MvaFrequencySet.cpp.

◆ setFrequencies_()

◆ setFrequenciesFromAlphabetStatesFrequencies() [1/2]

void AbstractFrequencySet::setFrequenciesFromAlphabetStatesFrequencies ( const std::map< int, double > &  frequencies)
overridevirtualinherited

Set the Frequencies from the one of the map which keys match with a letter of the Alphabet. The frequencies are normalized so that the matching values sum 1.

In this implementation, all model states with the same alphabet state are given the same frequency.

Parameters
frequenciesThe set of frequencies to match.

Implements bpp::FrequencySetInterface.

Definition at line 28 of file FrequencySet.cpp.

◆ setFrequenciesFromAlphabetStatesFrequencies() [2/2]

virtual void bpp::FrequencySetInterface::setFrequenciesFromAlphabetStatesFrequencies ( const std::map< int, double > &  frequencies)
pure virtualinherited

Set the Frequencies from the one of the map which keys match with a letter of the Alphabet. The frequencies are normalized so that the matching values sum 1.

Parameters
frequenciesThe set of frequencies to match.

Implemented in bpp::AbstractFrequencySet.

Referenced by bpp::BppOFrequencySetFormat::initialize_().

◆ setMatrixOfRowCoords()

void bpp::MvaFrequencySet::setMatrixOfRowCoords ( const RowMatrix< double > &  matrix)
inline

Definition at line 62 of file MvaFrequencySet.h.

References rowCoords_.

Referenced by initSet().

◆ setModelName()

void bpp::MvaFrequencySet::setModelName ( const std::string &  modelName)
inline

Definition at line 64 of file MvaFrequencySet.h.

References model_.

◆ setNbrOfAxes()

void bpp::MvaFrequencySet::setNbrOfAxes ( const size_t &  nAxes)
inline

Definition at line 63 of file MvaFrequencySet.h.

References nbrOfAxes_.

Referenced by initSet().

◆ setParamValues()

void bpp::MvaFrequencySet::setParamValues ( std::map< std::string, std::string > &  valuesSettings)
inline

Definition at line 66 of file MvaFrequencySet.h.

References paramValues_.

◆ setTransposeMatrixOfPpalAxes()

void bpp::MvaFrequencySet::setTransposeMatrixOfPpalAxes ( const RowMatrix< double > &  matrix)
inline

Definition at line 61 of file MvaFrequencySet.h.

References tPpalAxes_.

Referenced by initSet().

◆ setVectorOfColumnWeights()

void bpp::MvaFrequencySet::setVectorOfColumnWeights ( const std::vector< double > &  cw)
inline

Definition at line 65 of file MvaFrequencySet.h.

References columnWeights_.

Referenced by initSet().

◆ stateMap() [1/2]

virtual const StateMapInterface& bpp::FrequencySetInterface::stateMap ( ) const
pure virtualinherited
Returns
The mapping of model states with alphabet states.

Implemented in bpp::AbstractFrequencySet.

◆ stateMap() [2/2]

const StateMapInterface& bpp::AbstractFrequencySet::stateMap ( ) const
inlineoverridevirtualinherited

◆ updateFrequencies()

Member Data Documentation

◆ alphabet_

std::shared_ptr<const Alphabet> bpp::AbstractFrequencySet::alphabet_
privateinherited

◆ columnWeights_

std::vector<double> bpp::MvaFrequencySet::columnWeights_
protected

Definition at line 52 of file MvaFrequencySet.h.

Referenced by computeCoordsFirstSpaceCOA(), and setVectorOfColumnWeights().

◆ freq_

◆ FREQUENCE_CONSTRAINT_CENTI

std::shared_ptr< IntervalConstraint > FrequencySetInterface::FREQUENCE_CONSTRAINT_CENTI
staticinherited

◆ FREQUENCE_CONSTRAINT_MILLI

std::shared_ptr< IntervalConstraint > FrequencySetInterface::FREQUENCE_CONSTRAINT_MILLI
staticinherited

Definition at line 91 of file FrequencySet.h.

◆ FREQUENCE_CONSTRAINT_SMALL

std::shared_ptr< IntervalConstraint > FrequencySetInterface::FREQUENCE_CONSTRAINT_SMALL
staticinherited

◆ model_

std::string bpp::MvaFrequencySet::model_
protected

Definition at line 51 of file MvaFrequencySet.h.

Referenced by setModelName().

◆ name_

std::string bpp::AbstractFrequencySet::name_
privateinherited

◆ nbrOfAxes_

size_t bpp::MvaFrequencySet::nbrOfAxes_
protected

◆ paramValues_

std::map<std::string, std::string> bpp::MvaFrequencySet::paramValues_
protected

Definition at line 53 of file MvaFrequencySet.h.

Referenced by defineParameters(), and setParamValues().

◆ rowCoords_

RowMatrix<double> bpp::MvaFrequencySet::rowCoords_
protected

Definition at line 49 of file MvaFrequencySet.h.

Referenced by defineParameters(), and setMatrixOfRowCoords().

◆ stateMap_

std::shared_ptr<const StateMapInterface> bpp::AbstractFrequencySet::stateMap_
privateinherited

◆ tPpalAxes_

RowMatrix<double> bpp::MvaFrequencySet::tPpalAxes_
protected

Definition at line 48 of file MvaFrequencySet.h.

Referenced by computeReverseCOA(), and setTransposeMatrixOfPpalAxes().


The documentation for this class was generated from the following files: