bpp-phyl3  3.0.0
bpp::ModelPath Class Reference

Organization of submodels in mixed substitution models in a path. See class ModelScenario for a thorough description. More...

#include <Bpp/Phyl/Likelihood/ModelPath.h>

+ Collaboration diagram for bpp::ModelPath:

Classes

class  PathNode
 A vector<int> where all elements are different and in INCREASING ORDER. So inclusion should be done through dedicated methods. More...
 

Public Member Functions

 ModelPath ()
 
 ModelPath (const ModelPath &)
 
ModelPathoperator= (const ModelPath &)
 
 ~ModelPath ()
 
size_t size () const
 
std::shared_ptr< MixedTransitionModelInterfacegetLeadModel ()
 gets the leader model. More...
 
const std::shared_ptr< MixedTransitionModelInterfacegetLeadModel () const
 
void setLeadModel (std::shared_ptr< MixedTransitionModelInterface > model)
 sets the leader model. More...
 
void setModel (std::shared_ptr< MixedTransitionModelInterface > mMod, const Vuint &vnS)
 sets submodel numbers in the mixed model. Checks if all the numbers are valid. More...
 
void changeModel (std::shared_ptr< MixedTransitionModelInterface > mMod1, std::shared_ptr< MixedTransitionModelInterface > mMod2)
 change from a model to another More...
 
void removeModel (std::shared_ptr< MixedTransitionModelInterface > mMod)
 Remove a model. More...
 
void addToModel (std::shared_ptr< MixedTransitionModelInterface > mMod, const Vuint &vnS)
 adds submodel numbers to the mixed model. Checks if all the numbers are valid. More...
 
ModelPathoperator+= (const ModelPath &)
 Cumulates the PathNodes of the given ModelPath into this one. More...
 
ModelPathoperator-= (const ModelPath &)
 Remove from the PathNodes of this object the matching ones of the ModelPath. More...
 
bool operator<= (const ModelPath &) const
 checks if this ModelPath is included in another one. Which means that all submodels of this path are in the other part. More...
 
bool operator>= (const ModelPath &) const
 checks if this ModelPath includes another one. More...
 
bool intersects (const ModelPath &) const
 checks if this ModelPath intersects another one. Which means that one submodel explicitly declared in a ModelPath is in the other. More...
 
double getProbability () const
 returns the probability More...
 
void setProbability (double x)
 sets the probability More...
 
bool hasModel (std::shared_ptr< MixedTransitionModelInterface > mMod) const
 checks if there is a pathnode associated with a model More...
 
bool hasModel (std::shared_ptr< const MixedTransitionModelInterface > mMod) const
 
const PathNodegetPathNode (std::shared_ptr< MixedTransitionModelInterface > mMod) const
 gets the pathnode associated with a model More...
 
const PathNodegetPathNode (std::shared_ptr< const MixedTransitionModelInterface > mMod) const
 
std::vector< std::shared_ptr< MixedTransitionModelInterface > > getModels () const
 gets the MixedTransitionModel used in the ModelPath More...
 
std::string toString () const
 string description More...
 

Private Attributes

std::map< std::shared_ptr< MixedTransitionModelInterface >, PathNodemModPath_
 
std::shared_ptr< MixedTransitionModelInterfaceleadMod_
 
double proba_
 probability of this ModelPath. More...
 

Detailed Description

Organization of submodels in mixed substitution models in a path. See class ModelScenario for a thorough description.

A path is defined through an hypergraph, ie a list of hypernodes.

Definition at line 21 of file ModelPath.h.

Constructor & Destructor Documentation

◆ ModelPath() [1/2]

bpp::ModelPath::ModelPath ( )
inline

Definition at line 116 of file ModelPath.h.

◆ ModelPath() [2/2]

ModelPath::ModelPath ( const ModelPath hn)

Definition at line 14 of file ModelPath.cpp.

◆ ~ModelPath()

bpp::ModelPath::~ModelPath ( )
inline

Definition at line 119 of file ModelPath.h.

Member Function Documentation

◆ addToModel()

void ModelPath::addToModel ( std::shared_ptr< MixedTransitionModelInterface mMod,
const Vuint vnS 
)

adds submodel numbers to the mixed model. Checks if all the numbers are valid.

Parameters
mModthe mixed model
vnSvector of numbers of the submodel

Definition at line 53 of file ModelPath.cpp.

References mModPath_.

Referenced by operator+=().

◆ changeModel()

void ModelPath::changeModel ( std::shared_ptr< MixedTransitionModelInterface mMod1,
std::shared_ptr< MixedTransitionModelInterface mMod2 
)

change from a model to another

Parameters
mMod1the ancient mixed model
mMod2the new mixed model

if mMod1 is the lead model, mMod2 becomes the lead model

Definition at line 39 of file ModelPath.cpp.

References leadMod_, mModPath_, and setModel().

◆ getLeadModel() [1/2]

std::shared_ptr<MixedTransitionModelInterface> bpp::ModelPath::getLeadModel ( )
inline

gets the leader model.

Definition at line 129 of file ModelPath.h.

References leadMod_.

◆ getLeadModel() [2/2]

const std::shared_ptr<MixedTransitionModelInterface> bpp::ModelPath::getLeadModel ( ) const
inline

Definition at line 134 of file ModelPath.h.

References leadMod_.

◆ getModels()

vector< shared_ptr< MixedTransitionModelInterface > > ModelPath::getModels ( ) const

gets the MixedTransitionModel used in the ModelPath

Definition at line 132 of file ModelPath.cpp.

References mModPath_.

Referenced by bpp::ModelScenario::complete(), and bpp::PhylogeneticsApplicationTools::printParameters().

◆ getPathNode() [1/2]

const PathNode& bpp::ModelPath::getPathNode ( std::shared_ptr< const MixedTransitionModelInterface mMod) const
inline

Definition at line 254 of file ModelPath.h.

References mModPath_.

◆ getPathNode() [2/2]

const PathNode& bpp::ModelPath::getPathNode ( std::shared_ptr< MixedTransitionModelInterface mMod) const
inline

◆ getProbability()

double bpp::ModelPath::getProbability ( ) const
inline

returns the probability

Definition at line 225 of file ModelPath.h.

References proba_.

Referenced by bpp::ModelScenario::computeModelPathsProbabilities().

◆ hasModel() [1/2]

bool bpp::ModelPath::hasModel ( std::shared_ptr< const MixedTransitionModelInterface mMod) const
inline

Definition at line 238 of file ModelPath.h.

References mModPath_.

◆ hasModel() [2/2]

bool bpp::ModelPath::hasModel ( std::shared_ptr< MixedTransitionModelInterface mMod) const
inline

checks if there is a pathnode associated with a model

Definition at line 235 of file ModelPath.h.

References mModPath_.

Referenced by bpp::ProcessComputationTree::buildFollowingPath_(), and bpp::ModelScenario::computeModelPathsProbabilities().

◆ intersects()

bool ModelPath::intersects ( const ModelPath hn) const

checks if this ModelPath intersects another one. Which means that one submodel explicitly declared in a ModelPath is in the other.

Definition at line 83 of file ModelPath.cpp.

References mModPath_.

Referenced by bpp::ModelScenario::hasExclusivePaths().

◆ operator+=()

ModelPath & ModelPath::operator+= ( const ModelPath hn)

Cumulates the PathNodes of the given ModelPath into this one.

Definition at line 103 of file ModelPath.cpp.

References addToModel(), and mModPath_.

◆ operator-=()

ModelPath & ModelPath::operator-= ( const ModelPath hn)

Remove from the PathNodes of this object the matching ones of the ModelPath.

Definition at line 115 of file ModelPath.cpp.

References mModPath_.

◆ operator<=()

bool ModelPath::operator<= ( const ModelPath hn) const

checks if this ModelPath is included in another one. Which means that all submodels of this path are in the other part.

Definition at line 64 of file ModelPath.cpp.

References mModPath_.

◆ operator=()

ModelPath & ModelPath::operator= ( const ModelPath hn)

Definition at line 20 of file ModelPath.cpp.

References mModPath_, and proba_.

◆ operator>=()

bool ModelPath::operator>= ( const ModelPath hn) const

checks if this ModelPath includes another one.

Definition at line 78 of file ModelPath.cpp.

◆ removeModel()

void bpp::ModelPath::removeModel ( std::shared_ptr< MixedTransitionModelInterface mMod)
inline

Remove a model.

if the model is the leadmodel, the leadmodel is set to 0.

Definition at line 176 of file ModelPath.h.

References leadMod_, and mModPath_.

◆ setLeadModel()

void bpp::ModelPath::setLeadModel ( std::shared_ptr< MixedTransitionModelInterface model)
inline

sets the leader model.

The model must be in the map before.

Definition at line 144 of file ModelPath.h.

References leadMod_, and mModPath_.

◆ setModel()

void ModelPath::setModel ( std::shared_ptr< MixedTransitionModelInterface mMod,
const Vuint vnS 
)

sets submodel numbers in the mixed model. Checks if all the numbers are valid.

Parameters
mModthe mixed model
vnSvector of indexes of the submodels

Definition at line 28 of file ModelPath.cpp.

References mModPath_.

Referenced by changeModel().

◆ setProbability()

void bpp::ModelPath::setProbability ( double  x)
inline

sets the probability

Definition at line 230 of file ModelPath.h.

References proba_.

Referenced by bpp::ModelScenario::computeModelPathsProbabilities().

◆ size()

size_t bpp::ModelPath::size ( ) const
inline

Definition at line 121 of file ModelPath.h.

References mModPath_.

◆ toString()

std::string ModelPath::toString ( ) const

string description

Definition at line 147 of file ModelPath.cpp.

References bpp::BranchModelInterface::getName(), bpp::MixtureOfTransitionModels::getName(), and mModPath_.

Member Data Documentation

◆ leadMod_

std::shared_ptr<MixedTransitionModelInterface> bpp::ModelPath::leadMod_
private

The leading model (ie which that decides of the submodels probabilities).

Definition at line 108 of file ModelPath.h.

Referenced by changeModel(), getLeadModel(), removeModel(), and setLeadModel().

◆ mModPath_

std::map<std::shared_ptr<MixedTransitionModelInterface>, PathNode> bpp::ModelPath::mModPath_
private

Which submodels of MixedTransitionModels are used.

Definition at line 103 of file ModelPath.h.

Referenced by addToModel(), changeModel(), getModels(), getPathNode(), hasModel(), intersects(), operator+=(), operator-=(), operator<=(), operator=(), removeModel(), setLeadModel(), setModel(), size(), and toString().

◆ proba_

double bpp::ModelPath::proba_
private

probability of this ModelPath.

Definition at line 113 of file ModelPath.h.

Referenced by getProbability(), operator=(), and setProbability().


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