41 #ifndef _ABSTRACTNONHOMOGENEOUSTREELIKELIHOOD_H_ 42 #define _ABSTRACTNONHOMOGENEOUSTREELIKELIHOOD_H_ 84 throw Exception(
"AbstractNonHomogeneousTreeLikelihood::ConstHomogeneousSiteModelIterator::next(). No more site in the set.");
95 mutable std::map<int, VVVdouble>
pxy_;
97 mutable std::map<int, VVVdouble>
dpxy_;
99 mutable std::map<int, VVVdouble>
d2pxy_;
136 DiscreteDistribution* rDist,
138 bool reparametrizeRoot =
true)
165 DiscreteDistribution* rDist,
166 bool verbose)
throw (Exception);
261 throw Exception(
"AbstractNonHomogeneousTreeLikelihood::setMinimumBranchLength. Minimum branch length sould be lower than the maximum one: " + TextTools::toString(
maximumBrLen_));
271 throw Exception(
"AbstractNonHomogeneousTreeLikelihood::setMaximumBranchLength. Maximum branch length sould be higher than the minimum one: " + TextTools::toString(
minimumBrLen_));
296 #endif //_ABSTRACTNONHOMOGENEOUSTREELIKELIHOOD_H_ virtual void setMaximumBranchLength(double maximum)
int getAlphabetStateAsInt(size_t i) const
Substitution models manager for non-homogeneous / non-reversible models of evolution.
AbstractNonHomogeneousTreeLikelihood(const Tree &tree, SubstitutionModelSet *modelSet, DiscreteDistribution *rDist, bool verbose=true, bool reparametrizeRoot=true)
ParameterList getSubstitutionModelParameters() const
Get the parameters associated to substitution model(s).
Interface for all substitution models.
Partial implementation for branch non-homogeneous models of the TreeLikelihood interface.
const SubstitutionModel * getModelForNode(int nodeId) const
Get the model associated to a particular node id.
ParameterList brLenParameters_
ParameterList getRootFrequenciesParameters() const
Get the parameters corresponding to the root frequencies.
std::vector< Node * > nodes_
Pointer toward all nodes in the tree.
virtual void setMinimumBranchLength(double minimum)
const SubstitutionModel * getModel(size_t i) const
Get one model from the set knowing its index.
virtual const std::vector< int > & getAlphabetStates() const
Partial implementation of the DiscreteRatesAcrossSitesTreeLikelihood interface.
SubstitutionModelSet * modelSet_
virtual void computeAllTransitionProbabilities()
Fill the pxy_, dpxy_ and d2pxy_ arrays for all nodes.
Iterates through all models used for all sites on a given branch.
ParameterList getRateDistributionParameters() const
Get the parameters associated to the rate distirbution.
virtual void applyParameters()
All parameters are stored in a parameter list. This function apply these parameters to the substituti...
ParameterList getRateDistributionParameters() const
Get the parameters associated to the rate distirbution.
virtual std::string getAlphabetStateAsChar(size_t index) const
Interface for phylogenetic tree objects.
SubstitutionModelSet * getSubstitutionModelSet()
std::vector< double > rootFreqs_
std::vector< ConstNoPartitionSiteModelDescription > siteModelDescriptions_
Iterates through all models used for all branches on a given site.
virtual void initParameters()
This builds the parameters list from all parametrizable objects, i.e. substitution model...
ConstBranchModelIterator * getNewBranchModelIterator(int nodeId) const
const std::vector< double > & getRootFrequencies(size_t siteIndex) const
Get the values of the frequencies for each state in the alphabet at the root node.
virtual double getMinimumBranchLength() const
VVVdouble getTransitionProbabilitiesPerRateClass(int nodeId, size_t siteIndex) const
Retrieves all Pij(t) for a particular branch, defined by the upper node.
std::auto_ptr< Constraint > brLenConstraint_
std::map< int, VVVdouble > d2pxy_
virtual void computeTransitionProbabilitiesForNode(const Node *node)
Fill the pxy_, dpxy_ and d2pxy_ arrays for one node.
Exception thrown when something is wrong with a particular node.
ParameterList getRootFrequenciesParameters() const
virtual void initBranchLengthsParameters()
const std::vector< int > & getAlphabetStates() const
std::map< int, const Node * > idToNode_
An index linking nodes to their id, for faster access than the getNode() method.
The phylogenetic node class.
ParameterList getBranchLengthsParameters() const
Get the branch lengths parameters.
virtual int getAlphabetStateAsInt(size_t index) const
Specialization of the TreeLikelihood interface for the branch non-homogeneous and non-stationary mode...
ConstNonHomogeneousSiteModelIterator(const SubstitutionModelSet *modelSet)
ConstSiteModelDescription * next()
const SubstitutionModel * getSubstitutionModelForNode(int nodeId) const
Get the substitution model associated to a given node.
size_t getNumberOfStates() const
Get the number of states associated to this model set.
void setSubstitutionModelSet(SubstitutionModelSet *modelSet)
std::map< int, VVVdouble > dpxy_
const std::vector< int > & getNodesWithModel(size_t i) const
Get a list of nodes id for which the given model is associated.
SubstitutionModel * getSubstitutionModelForNode(int nodeId)
Get the substitution model associated to a given node.
size_t getNumberOfStates() const
A pair of SubstitutionModel / BranchIterator.
void initialize()
Init the likelihood object.
std::string getAlphabetStateAsChar(size_t i) const
void init_(const Tree &tree, SubstitutionModelSet *modelSet, DiscreteDistribution *rDist, bool verbose)
Method called by constructor.
std::map< int, VVVdouble > pxy_
virtual double getMaximumBranchLength() const
const SubstitutionModelSet * getSubstitutionModelSet() const
ConstSiteModelIterator * getNewSiteModelIterator(size_t siteIndex) const