bpp-phyl  2.2.0
bpp::MvaFrequenciesSet 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/FrequenciesSet/MvaFrequenciesSet.h>

+ Inheritance diagram for bpp::MvaFrequenciesSet:
+ Collaboration diagram for bpp::MvaFrequenciesSet:

Public Member Functions

 MvaFrequenciesSet (const ProteicAlphabet *alpha)
 Constructor. More...
 
MvaFrequenciesSetclone () const
 
MvaFrequenciesSetoperator= (const MvaFrequenciesSet &mfs)
 
const ProteicAlphabet * getAlphabet () const
 
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) throw (DimensionException, Exception)
 Set the parameters in order to match a given set of frequencies. More...
 
void defineParameters ()
 
void fireParameterChanged (const ParameterList &parameters)
 
void updateFrequencies () throw (Exception)
 
void initSet (CoalaCore *coala)
 
void computeReversePCA (const std::vector< double > &positions, std::vector< double > &tmpFreqs) throw (Exception)
 
void computeCoordsFirstSpacePCA (std::vector< double > &tmpFreqs, std::vector< double > &freqs) throw (Exception)
 
void computeReverseCOA (const std::vector< double > &positions, std::vector< double > &tmpFreqs) throw (Exception)
 
void computeCoordsFirstSpaceCOA (std::vector< double > &tmpFreqs, std::vector< double > &freqs) throw (Exception)
 
virtual const StateMapgetStateMap () const =0
 
virtual const std::vector< double > getFrequencies () 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
 
const StateMapgetStateMap () const
 
const std::vector< double > getFrequencies () const
 
const std::map< int, double > getAlphabetStatesFrequencies () const
 
void setFrequenciesFromAlphabetStatesFrequencies (const std::map< int, double > &frequencies)
 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
 
std::string getName () const
 
void normalize ()
 

Static Public Attributes

static IntervalConstraint FREQUENCE_CONSTRAINT_SMALL
 
static IntervalConstraint FREQUENCE_CONSTRAINT_MILLI
 

Protected Member Functions

std::vector< double > & getFrequencies_ ()
 
double & getFreq_ (size_t i)
 
const double & getFreq_ (size_t i) const
 
void setFrequencies_ (const std::vector< double > &frequencies)
 

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_
 

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 57 of file MvaFrequenciesSet.h.

Constructor & Destructor Documentation

◆ MvaFrequenciesSet()

MvaFrequenciesSet::MvaFrequenciesSet ( const ProteicAlphabet *  alpha)

Constructor.

Definition at line 46 of file MvaFrequenciesSet.cpp.

Referenced by clone().

Member Function Documentation

◆ clone()

MvaFrequenciesSet* bpp::MvaFrequenciesSet::clone ( ) const
inlinevirtual

Implements bpp::AbstractFrequenciesSet.

Definition at line 72 of file MvaFrequenciesSet.h.

References MvaFrequenciesSet().

◆ computeCoordsFirstSpaceCOA()

void MvaFrequenciesSet::computeCoordsFirstSpaceCOA ( std::vector< double > &  tmpFreqs,
std::vector< double > &  freqs 
)
throw (Exception
)

Definition at line 144 of file MvaFrequenciesSet.cpp.

Referenced by updateFrequencies().

◆ computeCoordsFirstSpacePCA()

void bpp::MvaFrequenciesSet::computeCoordsFirstSpacePCA ( std::vector< double > &  tmpFreqs,
std::vector< double > &  freqs 
)
throw (Exception
)

◆ computeReverseCOA()

void MvaFrequenciesSet::computeReverseCOA ( const std::vector< double > &  positions,
std::vector< double > &  tmpFreqs 
)
throw (Exception
)

Definition at line 133 of file MvaFrequenciesSet.cpp.

Referenced by updateFrequencies().

◆ computeReversePCA()

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

◆ defineParameters()

void MvaFrequenciesSet::defineParameters ( )

Definition at line 66 of file MvaFrequenciesSet.cpp.

References nbrOfAxes_, paramValues_, and rowCoords_.

Referenced by initSet().

◆ fireParameterChanged()

void MvaFrequenciesSet::fireParameterChanged ( const ParameterList &  parameters)

Definition at line 82 of file MvaFrequenciesSet.cpp.

References updateFrequencies().

◆ getAlphabet()

const ProteicAlphabet* bpp::MvaFrequenciesSet::getAlphabet ( ) const
inlinevirtual
Returns
The alphabet associated to this set.

Reimplemented from bpp::AbstractFrequenciesSet.

Definition at line 96 of file MvaFrequenciesSet.h.

References bpp::AbstractFrequenciesSet::getAlphabet().

◆ getAlphabetStatesFrequencies() [1/2]

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

Implemented in bpp::AbstractFrequenciesSet.

Referenced by bpp::CodonDistanceFitnessPhaseFrequenciesSubstitutionModel::setFreq().

◆ getAlphabetStatesFrequencies() [2/2]

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

Implements bpp::FrequenciesSet.

Definition at line 79 of file FrequenciesSet.cpp.

◆ getFreq_() [1/2]

◆ getFreq_() [2/2]

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

Definition at line 204 of file FrequenciesSet.h.

References bpp::AbstractFrequenciesSet::freq_.

◆ getFrequencies() [1/2]

◆ getFrequencies() [2/2]

const std::vector<double> bpp::AbstractFrequenciesSet::getFrequencies ( ) const
inlinevirtualinherited
Returns
The frequencies values of the set.

Implements bpp::FrequenciesSet.

Definition at line 174 of file FrequenciesSet.h.

References bpp::AbstractFrequenciesSet::freq_.

Referenced by updateFrequencies().

◆ getFrequencies_()

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

Definition at line 202 of file FrequenciesSet.h.

References bpp::AbstractFrequenciesSet::freq_.

◆ getName() [1/2]

◆ getName() [2/2]

std::string bpp::AbstractFrequenciesSet::getName ( ) const
inlinevirtualinherited

◆ getNumberOfFrequencies() [1/2]

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

Implemented in bpp::AbstractFrequenciesSet.

◆ getNumberOfFrequencies() [2/2]

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

Implements bpp::FrequenciesSet.

Definition at line 189 of file FrequenciesSet.h.

References bpp::AbstractFrequenciesSet::freq_.

Referenced by bpp::FixedFrequenciesSet::setFrequencies().

◆ getStateMap() [1/2]

virtual const StateMap& bpp::FrequenciesSet::getStateMap ( ) const
pure virtualinherited
Returns
The mapping of model states with alphabet states.

Implemented in bpp::AbstractFrequenciesSet.

◆ getStateMap() [2/2]

const StateMap& bpp::AbstractFrequenciesSet::getStateMap ( ) const
inlinevirtualinherited
Returns
The mapping of model states with alphabet states.

Implements bpp::FrequenciesSet.

Definition at line 172 of file FrequenciesSet.h.

References bpp::AbstractFrequenciesSet::stateMap_.

Referenced by bpp::FullPerAACodonFrequenciesSet::updateFrequencies().

◆ initSet()

◆ normalize()

void bpp::AbstractFrequenciesSet::normalize ( )
inlineinherited

◆ operator=()

MvaFrequenciesSet& bpp::MvaFrequenciesSet::operator= ( const MvaFrequenciesSet mfs)
inline

◆ setFrequencies()

void MvaFrequenciesSet::setFrequencies ( const std::vector< double > &  frequencies)
throw (DimensionException,
Exception
)
virtual

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::FrequenciesSet.

Definition at line 130 of file MvaFrequenciesSet.cpp.

◆ setFrequencies_()

void bpp::AbstractFrequenciesSet::setFrequencies_ ( const std::vector< double > &  frequencies)
inlineprotectedinherited

◆ setFrequenciesFromAlphabetStatesFrequencies() [1/2]

virtual void bpp::FrequenciesSet::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::AbstractFrequenciesSet.

Referenced by bpp::BppOFrequenciesSetFormat::initialize_(), bpp::AbstractCodonFitnessSubstitutionModel::setFreq(), bpp::AbstractCodonFrequenciesSubstitutionModel::setFreq(), and bpp::AbstractCodonPhaseFrequenciesSubstitutionModel::setFreq().

◆ setFrequenciesFromAlphabetStatesFrequencies() [2/2]

void AbstractFrequenciesSet::setFrequenciesFromAlphabetStatesFrequencies ( const std::map< int, double > &  frequencies)
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.

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::FrequenciesSet.

Definition at line 58 of file FrequenciesSet.cpp.

◆ setMatrixOfRowCoords()

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

Definition at line 99 of file MvaFrequenciesSet.h.

References rowCoords_.

Referenced by initSet().

◆ setModelName()

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

Definition at line 101 of file MvaFrequenciesSet.h.

References model_.

◆ setNbrOfAxes()

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

Definition at line 100 of file MvaFrequenciesSet.h.

References nbrOfAxes_.

Referenced by initSet().

◆ setParamValues()

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

Definition at line 103 of file MvaFrequenciesSet.h.

References paramValues_.

◆ setTransposeMatrixOfPpalAxes()

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

Definition at line 98 of file MvaFrequenciesSet.h.

References tPpalAxes_.

Referenced by initSet().

◆ setVectorOfColumnWeights()

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

Definition at line 102 of file MvaFrequenciesSet.h.

References columnWeights_.

Referenced by initSet().

◆ updateFrequencies()

Member Data Documentation

◆ columnWeights_

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

Definition at line 92 of file MvaFrequenciesSet.h.

Referenced by operator=(), and setVectorOfColumnWeights().

◆ FREQUENCE_CONSTRAINT_MILLI

IntervalConstraint FrequenciesSet::FREQUENCE_CONSTRAINT_MILLI
staticinherited

Definition at line 118 of file FrequenciesSet.h.

◆ FREQUENCE_CONSTRAINT_SMALL

IntervalConstraint FrequenciesSet::FREQUENCE_CONSTRAINT_SMALL
staticinherited

◆ model_

std::string bpp::MvaFrequenciesSet::model_
protected

Definition at line 91 of file MvaFrequenciesSet.h.

Referenced by operator=(), and setModelName().

◆ nbrOfAxes_

size_t bpp::MvaFrequenciesSet::nbrOfAxes_
protected

Definition at line 90 of file MvaFrequenciesSet.h.

Referenced by defineParameters(), operator=(), setNbrOfAxes(), and updateFrequencies().

◆ paramValues_

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

Definition at line 93 of file MvaFrequenciesSet.h.

Referenced by defineParameters(), operator=(), and setParamValues().

◆ rowCoords_

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

Definition at line 89 of file MvaFrequenciesSet.h.

Referenced by defineParameters(), operator=(), and setMatrixOfRowCoords().

◆ tPpalAxes_

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

Definition at line 88 of file MvaFrequenciesSet.h.

Referenced by operator=(), and setTransposeMatrixOfPpalAxes().


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