5#ifndef BPP_PHYL_LEGACY_LIKELIHOOD_ABSTRACTNONHOMOGENEOUSTREELIKELIHOOD_H
6#define BPP_PHYL_LEGACY_LIKELIHOOD_ABSTRACTNONHOMOGENEOUSTREELIKELIHOOD_H
28 public ConstSiteModelIterator
49 throw Exception(
"AbstractNonHomogeneousTreeLikelihood::ConstHomogeneousSiteModelIterator::next(). No more site in the set.");
60 mutable std::map<int, VVVdouble>
pxy_;
62 mutable std::map<int, VVVdouble>
dpxy_;
64 mutable std::map<int, VVVdouble>
d2pxy_;
100 std::shared_ptr<SubstitutionModelSet> modelSet,
101 std::shared_ptr<DiscreteDistributionInterface> rDist,
103 bool reparametrizeRoot =
true);
127 std::shared_ptr<SubstitutionModelSet> modelSet,
128 std::shared_ptr<DiscreteDistributionInterface> rDist,
158 std::shared_ptr<const TransitionModelInterface>
getModelForNode(
int nodeId)
const override
160 return modelSet_->getModelForNode(nodeId);
165 return modelSet_->getModelForNode(nodeId);
203 return modelSet_->getRootFrequenciesParameters();
Partial implementation of the DiscreteRatesAcrossSitesTreeLikelihood interface.
ParameterList getRateDistributionParameters() const
Get the parameters associated to the rate distribution.
std::vector< ConstNoPartitionSiteModelDescription > siteModelDescriptions_
ConstNonHomogeneousSiteModelIterator(std::shared_ptr< const SubstitutionModelSet > modelSet)
ConstSiteModelDescription * next()
Partial implementation for branch non-homogeneous models of the TreeLikelihood interface.
std::map< int, VVVdouble > d2pxy_
virtual void initParameters()
This builds the parameters list from all parametrizable objects, i.e. substitution model,...
std::shared_ptr< SubstitutionModelSet > modelSet_
ParameterList getBranchLengthsParameters() const override
Get the branch lengths parameters.
virtual void setMaximumBranchLength(double maximum)
const SubstitutionModelSet & substitutionModelSet() const override
AbstractNonHomogeneousTreeLikelihood & operator=(const AbstractNonHomogeneousTreeLikelihood &lik)
Assignation operator.
virtual void initBranchLengthsParameters(bool verbose=true)
void initialize() override
Init the likelihood object.
virtual void computeAllTransitionProbabilities()
Fill the pxy_, dpxy_ and d2pxy_ arrays for all nodes.
std::shared_ptr< const TransitionModelInterface > getModelForNode(int nodeId) const override
Get the model associated to a given node.
virtual ~AbstractNonHomogeneousTreeLikelihood()
std::shared_ptr< TransitionModelInterface > getModelForNode(int nodeId) override
Get the substitution model associated to a given node.
ConstSiteModelIterator * getNewSiteModelIterator(size_t siteIndex) const override
void setSubstitutionModelSet(std::shared_ptr< SubstitutionModelSet > modelSet) override
Set the substitution models for this instance.
std::shared_ptr< ConstraintInterface > brLenConstraint_
virtual void setMinimumBranchLength(double minimum)
std::map< int, VVVdouble > dpxy_
size_t getNumberOfStates() const override
void init_(const Tree &tree, std::shared_ptr< SubstitutionModelSet > modelSet, std::shared_ptr< DiscreteDistributionInterface > rDist, bool verbose)
Method called by constructor.
ConstBranchModelIterator * getNewBranchModelIterator(int nodeId) const override
const std::vector< double > & getRootFrequencies(size_t siteIndex) const override
Get the values of the frequencies for each state in the alphabet at the root node.
ParameterList getSubstitutionModelParameters() const override
Get the parameters associated to substitution model(s).
virtual void computeTransitionProbabilitiesForNode(const Node *node)
Fill the pxy_, dpxy_ and d2pxy_ arrays for one node.
std::map< int, const Node * > idToNode_
An index linking nodes to their id, for faster access than the getNode() method.
ParameterList getRootFrequenciesParameters() const override
AbstractNonHomogeneousTreeLikelihood(const Tree &tree, std::shared_ptr< SubstitutionModelSet > modelSet, std::shared_ptr< DiscreteDistributionInterface > rDist, bool verbose=true, bool reparametrizeRoot=true)
std::vector< Node * > nodes_
Pointer toward all nodes in the tree.
virtual double getMaximumBranchLength() const
std::shared_ptr< const SubstitutionModelSet > getSubstitutionModelSet() const override
ParameterList brLenParameters_
int getAlphabetStateAsInt(size_t i) const override
const std::vector< int > & getAlphabetStates() const override
VVVdouble getTransitionProbabilitiesPerRateClass(int nodeId, size_t siteIndex) const override
Retrieves all Pij(t) for a particular branch, defined by the upper node.
std::string getAlphabetStateAsChar(size_t i) const override
virtual void applyParameters()
All parameters are stored in a parameter list. This function apply these parameters to the substituti...
ParameterList getRateDistributionParameters() const override
Get the parameters associated to the rate distribution.
std::map< int, VVVdouble > pxy_
std::shared_ptr< SubstitutionModelSet > getSubstitutionModelSet() override
virtual double getMinimumBranchLength() const
std::vector< double > rootFreqs_
SubstitutionModelSet & substitutionModelSet() override
const Tree & tree() const
Get the tree (topology and branch lengths).
The phylogenetic node class.
Specialization of the TreeLikelihood interface for the branch non-homogeneous and non-stationary mode...
Substitution models manager for non-homogeneous / non-reversible models of evolution.
Iterates through all models used for all sites on a given branch.
A pair of SubstitutionModel / BranchIterator.
Iterates through all models used for all branches on a given site.
Interface for phylogenetic tree objects.
std::string toString(T t)
Defines the basic types of data flow nodes.
std::vector< VVdouble > VVVdouble