bpp-phyl3  3.0.0
AutoCorrelationProcessPhyloLikelihood.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: The Bio++ Development Group
2 //
3 // SPDX-License-Identifier: CECILL-2.1
4 
5 #ifndef BPP_PHYL_LIKELIHOOD_PHYLOLIKELIHOODS_AUTOCORRELATIONPROCESSPHYLOLIKELIHOOD_H
6 #define BPP_PHYL_LIKELIHOOD_PHYLOLIKELIHOODS_AUTOCORRELATIONPROCESSPHYLOLIKELIHOOD_H
7 
8 
9 #include "../AutoCorrelationSequenceEvolution.h"
12 
13 // From bpp-seq:
15 
16 #include "HmmLikelihood_DF.h"
18 
19 namespace bpp
20 {
31 {
32 private:
33  std::shared_ptr<HmmPhyloEmissionProbabilities> Hpep_;
34 
35  mutable std::shared_ptr<HmmLikelihood_DF> hmm_;
36 
37 public:
39  std::shared_ptr<const AlignmentDataInterface> data,
40  std::shared_ptr<AutoCorrelationSequenceEvolution> processSeqEvol,
41  std::shared_ptr<CollectionNodes> collNodes,
42  size_t nSeqEvol = 0,
43  size_t nData = 0);
44 
45 protected:
53  Hpep_(mlc.Hpep_),
54  hmm_(mlc.hmm_)
55  {}
56 
58  {
60  Hpep_ = mlc.Hpep_;
61  hmm_ = mlc.hmm_;
62  return *this;
63  }
64 
65 public:
67 
69  {
70  return new AutoCorrelationProcessPhyloLikelihood(*this);
71  }
72 
73 public:
74  void setNamespace(const std::string& nameSpace) override;
75 
76  void fireParameterChanged(const ParameterList& parameters) override;
77 
84  {
85  return *hmm_;
86  }
87 
88  std::shared_ptr<LikelihoodCalculation> getLikelihoodCalculation () const override
89  {
90  return hmm_;
91  }
92 
94  {
95  return *hmm_;
96  }
97 
98  std::shared_ptr<AlignedLikelihoodCalculation> getAlignedLikelihoodCalculation () const override
99  {
100  return hmm_;
101  }
102 
109  {
110  VVdouble pp;
111  auto mat = hmm_->getHiddenStatesPosteriorProbabilities().transpose();
112  copyEigenToBpp(mat, pp);
113  return pp;
114  }
115 
116  const Eigen::MatrixXd& getHmmTransitionMatrix() const
117  {
118  return hmm_->getHmmTransitionMatrix();
119  }
120 };
121 } // end of namespace bpp.
122 #endif // BPP_PHYL_LIKELIHOOD_PHYLOLIKELIHOODS_AUTOCORRELATIONPROCESSPHYLOLIKELIHOOD_H
Likelihood framework based on an auto-correlation of simple likelihoods.
AutoCorrelationProcessPhyloLikelihood(std::shared_ptr< const AlignmentDataInterface > data, std::shared_ptr< AutoCorrelationSequenceEvolution > processSeqEvol, std::shared_ptr< CollectionNodes > collNodes, size_t nSeqEvol=0, size_t nData=0)
AutoCorrelationProcessPhyloLikelihood & operator=(const AutoCorrelationProcessPhyloLikelihood &mlc)
AlignedLikelihoodCalculation & alignedLikelihoodCalculation() const override
void fireParameterChanged(const ParameterList &parameters) override
std::shared_ptr< LikelihoodCalculation > getLikelihoodCalculation() const override
AutoCorrelationProcessPhyloLikelihood * clone() const override
AutoCorrelationProcessPhyloLikelihood(const AutoCorrelationProcessPhyloLikelihood &mlc)
void setNamespace(const std::string &nameSpace) override
std::shared_ptr< HmmPhyloEmissionProbabilities > Hpep_
std::shared_ptr< AlignedLikelihoodCalculation > getAlignedLikelihoodCalculation() const override
VVdouble getPosteriorProbabilitiesPerSitePerProcess() const override
return the posterior probabilities of subprocess on each site.
LikelihoodCalculation & likelihoodCalculation() const override
Partial implementation of the Likelihood interface for multiple processes.
MultiProcessSequencePhyloLikelihood & operator=(const MultiProcessSequencePhyloLikelihood &mpspl)
Defines the basic types of data flow nodes.
template void copyEigenToBpp(const ExtendedFloatMatrixXd &eigenMatrix, std::vector< std::vector< double >> &bppMatrix)
std::vector< Vdouble > VVdouble