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_
ConstSiteModelDescription * next()
ConstNonHomogeneousSiteModelIterator(std::shared_ptr< const SubstitutionModelSet > modelSet)
Partial implementation for branch non-homogeneous models of the TreeLikelihood interface.
std::map< int, VVVdouble > d2pxy_
std::shared_ptr< const SubstitutionModelSet > getSubstitutionModelSet() const override
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)
AbstractNonHomogeneousTreeLikelihood & operator=(const AbstractNonHomogeneousTreeLikelihood &lik)
Assignation operator.
ConstSiteModelIterator * getNewSiteModelIterator(size_t siteIndex) const override
virtual void initBranchLengthsParameters(bool verbose=true)
std::shared_ptr< const TransitionModelInterface > getModelForNode(int nodeId) const override
Get the model associated to a given node.
void initialize() override
Init the likelihood object.
const SubstitutionModelSet & substitutionModelSet() const override
std::shared_ptr< SubstitutionModelSet > getSubstitutionModelSet() override
virtual void computeAllTransitionProbabilities()
Fill the pxy_, dpxy_ and d2pxy_ arrays for all nodes.
virtual ~AbstractNonHomogeneousTreeLikelihood()
void setSubstitutionModelSet(std::shared_ptr< SubstitutionModelSet > modelSet) override
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.
ParameterList getSubstitutionModelParameters() const override
Get the parameters associated to substitution model(s).
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.
ConstBranchModelIterator * getNewBranchModelIterator(int nodeId) const override
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
ParameterList brLenParameters_
int getAlphabetStateAsInt(size_t i) const override
VVVdouble getTransitionProbabilitiesPerRateClass(int nodeId, size_t siteIndex) const override
Retrieves all Pij(t) for a particular branch, defined by the upper node.
const std::vector< int > & getAlphabetStates() const override
std::shared_ptr< TransitionModelInterface > getModelForNode(int nodeId) override
Get the substitution model associated to a given 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_
virtual double getMinimumBranchLength() const
SubstitutionModelSet & substitutionModelSet() override
std::vector< double > rootFreqs_
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