bpp-phyl3  3.0.0
WeightedAutoCorrelationProcessPhyloLikelihood.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"
17 #include <Bpp/Numeric/Hmm/WeightedAutoCorrelationTransitionMatrix.h>
18 
19 namespace bpp
20 {
31 class AutoCorrelationProcessPhyloLikelihood :
32  public MultiProcessSequencePhyloLikelihood
33 {
34 private:
35  std::shared_ptr<HmmPhyloEmissionProbabilities> Hpep_;
36 
37  mutable std::shared_ptr<HmmLikelihood_DF> hmm_;
38 
39 public:
41  std::shared_ptr<const AlignmentDataInterface> data,
42  std::shared_ptr<AutoCorrelationSequenceEvolution> processSeqEvol,
43  std::shared_ptr<CollectionNodes> collNodes,
44  size_t nSeqEvol = 0,
45  size_t nData = 0);
46 
47 protected:
55  Hpep_(mlc.Hpep_),
56  hmm_(mlc.hmm_)
57  {}
58 
60  {
62  Hpep_ = mlc.Hpep_;
63  hmm_ = mlc.hmm_;
64  return *this;
65  }
66 
67 public:
69 
71  {
72  return new AutoCorrelationProcessPhyloLikelihood(*this);
73  }
74 
75 public:
76  void setNamespace(const std::string& nameSpace) override;
77 
78  void fireParameterChanged(const ParameterList& parameters) override;
79 
86  {
87  return *hmm_;
88  }
89 
90  std::shared_ptr<LikelihoodCalculation> getLikelihoodCalculation () const override
91  {
92  return hmm_;
93  }
94 
96  {
97  return *hmm_;
98  }
99 
100  std::shared_ptr<AlignedLikelihoodCalculation> getAlignedLikelihoodCalculation () const override
101  {
102  return hmm_;
103  }
104 
111  {
112  VVdouble pp;
113  auto mat = hmm_->getHiddenStatesPosteriorProbabilities().transpose();
114  copyEigenToBpp(mat, pp);
115  return pp;
116  }
117 
118  const Eigen::MatrixXd& getHmmTransitionMatrix() const
119  {
120  return hmm_->getHmmTransitionMatrix();
121  }
122 };
123 } // end of namespace bpp.
124 #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)
void fireParameterChanged(const ParameterList &parameters) override
AutoCorrelationProcessPhyloLikelihood & operator=(const AutoCorrelationProcessPhyloLikelihood &mlc)
AlignedLikelihoodCalculation & alignedLikelihoodCalculation() const override
std::shared_ptr< LikelihoodCalculation > getLikelihoodCalculation() const override
AutoCorrelationProcessPhyloLikelihood * clone() const override
AutoCorrelationProcessPhyloLikelihood(const AutoCorrelationProcessPhyloLikelihood &mlc)
std::shared_ptr< HmmPhyloEmissionProbabilities > Hpep_
void setNamespace(const std::string &nameSpace) override
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)
std::shared_ptr< AlignedLikelihoodCalculation > getAlignedLikelihoodCalculation() const override
VVdouble getPosteriorProbabilitiesPerSitePerProcess() const override
return the posterior probabilities of subprocess on each site.
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