bpp-phyl3  3.0.0
bpp::UserFrequencySet Class Referenceabstract

FrequencySet to be read in a file. More specifically, a frequency set is read in a column of a given file, which column number is given in argument (default: 1). More...

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

+ Inheritance diagram for bpp::UserFrequencySet:
+ Collaboration diagram for bpp::UserFrequencySet:

Public Member Functions

 UserFrequencySet (std::shared_ptr< const StateMapInterface > stateMap, const std::string &path, size_t nCol=1)
 User. More...
 
 UserFrequencySet (const UserFrequencySet &fmfs)
 
UserFrequencySetoperator= (const UserFrequencySet &fmfs)
 
UserFrequencySetclone () const override
 
virtual ~UserFrequencySet ()
 
const std::string & getPath () const
 
size_t getColumnNumber () const
 
void setFrequencies (const std::vector< double > &frequencies) override
 Set the parameters in order to match a given set of frequencies. More...
 
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 ()
 
virtual size_t getNumberOfIndependentParameters () const=0
 
size_t getNumberOfIndependentParameters () const
 
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
 
void aliasParameters (const std::string &p1, const std::string &p2)
 
void aliasParameters (std::map< std::string, std::string > &unparsedParams, bool verbose)
 
virtual void unaliasParameters (const std::string &p1, const std::string &p2)=0
 
void unaliasParameters (const std::string &p1, const std::string &p2)
 
virtual const ParameterListgetIndependentParameters () const=0
 
const ParameterListgetIndependentParameters () const
 
virtual std::vector< std::string > getAlias (const std::string &name) const=0
 
virtual std::vector< std::string > getAlias (const std::string &name) const
 
virtual std::map< std::string, std::string > getAliases () const=0
 
virtual std::map< std::string, std::string > getAliases () const
 
virtual bool hasParameter (const std::string &name) const=0
 
bool hasParameter (const std::string &name) const override
 
virtual const ParameterListgetParameters () const=0
 
const ParameterListgetParameters () const override
 
virtual const Parameterparameter (const std::string &name) const=0
 
const Parameterparameter (const std::string &name) const override
 
virtual double getParameterValue (const std::string &name) const=0
 
double getParameterValue (const std::string &name) const override
 
virtual void setAllParametersValues (const ParameterList &parameters)=0
 
void setAllParametersValues (const ParameterList &parameters) override
 
virtual void setParameterValue (const std::string &name, double value)=0
 
void setParameterValue (const std::string &name, double value) override
 
virtual void setParametersValues (const ParameterList &parameters)=0
 
void setParametersValues (const ParameterList &parameters) override
 
virtual bool matchParametersValues (const ParameterList &parameters)=0
 
bool matchParametersValues (const ParameterList &parameters) override
 
virtual void removeConstraint (const std::string &name)=0
 
void removeConstraint (const std::string &name) override
 
virtual void setConstraint (const std::string &name, std::shared_ptr< ConstraintInterface > constraint)=0
 
void setConstraint (const std::string &name, std::shared_ptr< ConstraintInterface > constraint) override
 
virtual size_t getNumberOfParameters () const=0
 
size_t getNumberOfParameters () const override
 
virtual void setNamespace (const std::string &prefix)=0
 
void setNamespace (const std::string &prefix)
 
virtual std::string getNamespace () const=0
 
std::string getNamespace () const override
 
virtual std::string getParameterNameWithoutNamespace (const std::string &name) const=0
 
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
 
virtual void fireParameterChanged (const ParameterList &parameters)
 

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

void readFromFile_ ()
 
std::vector< double > & getFrequencies_ ()
 
double & getFreq_ (size_t i)
 
const double & getFreq_ (size_t i) const
 
void setFrequencies_ (const std::vector< double > &frequencies)
 
virtual ParameterListgetParameters_ ()=0
 
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
 

Private Attributes

std::string path_
 
size_t nCol_
 
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

FrequencySet to be read in a file. More specifically, a frequency set is read in a column of a given file, which column number is given in argument (default: 1).

Definition at line 384 of file FrequencySet.h.

Constructor & Destructor Documentation

◆ UserFrequencySet() [1/2]

UserFrequencySet::UserFrequencySet ( std::shared_ptr< const StateMapInterface stateMap,
const std::string &  path,
size_t  nCol = 1 
)

User.

Definition at line 254 of file FrequencySet.cpp.

References readFromFile_().

Referenced by clone().

◆ UserFrequencySet() [2/2]

UserFrequencySet::UserFrequencySet ( const UserFrequencySet fmfs)

Definition at line 268 of file FrequencySet.cpp.

◆ ~UserFrequencySet()

virtual bpp::UserFrequencySet::~UserFrequencySet ( )
inlinevirtual

Definition at line 403 of file FrequencySet.h.

Member Function Documentation

◆ alphabet()

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()

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

◆ getAlphabet()

◆ getAlphabetStatesFrequencies()

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.

◆ getColumnNumber()

size_t bpp::UserFrequencySet::getColumnNumber ( ) const
inline

Definition at line 408 of file FrequencySet.h.

References nCol_.

◆ 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()

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 bpp::MvaFrequencySet::updateFrequencies().

◆ getFrequencies_()

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

Definition at line 178 of file FrequencySet.h.

References bpp::AbstractFrequencySet::freq_.

Referenced by readFromFile_().

◆ getName()

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

◆ getNumberOfFrequencies()

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 setFrequencies().

◆ getPath()

const std::string& bpp::UserFrequencySet::getPath ( ) const
inline

Definition at line 406 of file FrequencySet.h.

References path_.

◆ getStateMap()

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_.

◆ normalize()

void bpp::AbstractFrequencySet::normalize ( )
inlineinherited

◆ operator=()

UserFrequencySet & UserFrequencySet::operator= ( const UserFrequencySet fmfs)

◆ readFromFile_()

◆ setFrequencies()

void UserFrequencySet::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 319 of file FrequencySet.cpp.

References bpp::AbstractFrequencySet::getNumberOfFrequencies(), bpp::AbstractFrequencySet::setFrequencies_(), and bpp::TextTools::toString().

◆ setFrequencies_()

◆ setFrequenciesFromAlphabetStatesFrequencies()

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.

◆ stateMap()

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

Member Data Documentation

◆ alphabet_

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

◆ 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

◆ name_

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

◆ nCol_

size_t bpp::UserFrequencySet::nCol_
private

Definition at line 389 of file FrequencySet.h.

Referenced by getColumnNumber(), operator=(), and readFromFile_().

◆ path_

std::string bpp::UserFrequencySet::path_
private

Definition at line 388 of file FrequencySet.h.

Referenced by getPath(), operator=(), and readFromFile_().

◆ stateMap_

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

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