bpp-phyl3  3.0.0
MixtureProcessPhyloLikelihood.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_MIXTUREPROCESSPHYLOLIKELIHOOD_H
6 #define BPP_PHYL_LIKELIHOOD_PHYLOLIKELIHOODS_MIXTUREPROCESSPHYLOLIKELIHOOD_H
7 
8 
9 #include "../DataFlow/Simplex_DF.h"
10 #include "../MixtureSequenceEvolution.h"
12 
13 // From SeqLib:
15 
16 
17 namespace bpp
18 {
31 {
32 private:
36  std::shared_ptr<MixtureSequenceEvolution> mSeqEvol_;
37 
41  std::shared_ptr<ConfiguredSimplex> simplex_;
42 
46  mutable std::shared_ptr<AlignedLikelihoodCalculation> likCal_;
47 
48 public:
50  std::shared_ptr<const AlignmentDataInterface> data,
51  std::shared_ptr<MixtureSequenceEvolution> processSeqEvol,
52  std::shared_ptr<CollectionNodes> collNodes,
53  size_t nSeqEvol = 0,
54  size_t nData = 0);
55 
56 protected:
64  mSeqEvol_(mlc.mSeqEvol_),
65  likCal_(mlc.likCal_)
66  {}
67 
69  {
71  mSeqEvol_ = mlc.mSeqEvol_;
72  likCal_ = mlc.likCal_;
73  return *this;
74  }
75 
77  {
78  return new MixtureProcessPhyloLikelihood(*this);
79  }
80 
81 public:
87  double getSubProcessProb(size_t i) const
88  {
89  return simplex_->targetValue()->prob(i);
90  }
91 
98  {
99  return *likCal_;
100  }
101 
102  std::shared_ptr<LikelihoodCalculation> getLikelihoodCalculation () const override
103  {
104  return likCal_;
105  }
106 
108  {
109  return *likCal_;
110  }
111 
112  std::shared_ptr<AlignedLikelihoodCalculation> getAlignedLikelihoodCalculation () const override
113  {
114  return likCal_;
115  }
116 
123 
127 };
128 } // end of namespace bpp.
129 #endif // BPP_PHYL_LIKELIHOOD_PHYLOLIKELIHOODS_MIXTUREPROCESSPHYLOLIKELIHOOD_H
Likelihood framework based on a mixture of simple likelihoods.
LikelihoodCalculation & likelihoodCalculation() const override
std::shared_ptr< AlignedLikelihoodCalculation > likCal_
std::shared_ptr< ConfiguredSimplex > simplex_
MixtureProcessPhyloLikelihood(std::shared_ptr< const AlignmentDataInterface > data, std::shared_ptr< MixtureSequenceEvolution > processSeqEvol, std::shared_ptr< CollectionNodes > collNodes, size_t nSeqEvol=0, size_t nData=0)
MixtureProcessPhyloLikelihood & operator=(const MixtureProcessPhyloLikelihood &mlc)
AlignedLikelihoodCalculation & alignedLikelihoodCalculation() const override
std::shared_ptr< AlignedLikelihoodCalculation > getAlignedLikelihoodCalculation() const override
double getSubProcessProb(size_t i) const
return the probability of a subprocess
std::shared_ptr< MixtureSequenceEvolution > mSeqEvol_
to avoid the dynamic casts
VVdouble getPosteriorProbabilitiesPerSitePerProcess() const override
return the posterior probabilities of subprocess on each site.
std::shared_ptr< LikelihoodCalculation > getLikelihoodCalculation() const override
MixtureProcessPhyloLikelihood(const MixtureProcessPhyloLikelihood &mlc)
MixtureProcessPhyloLikelihood * clone() const override
Partial implementation of the Likelihood interface for multiple processes.
MultiProcessSequencePhyloLikelihood & operator=(const MultiProcessSequencePhyloLikelihood &mpspl)
Defines the basic types of data flow nodes.
std::vector< Vdouble > VVdouble