bpp-phyl3  3.0.0
AlignedPhyloLikelihoodSet.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_SETOFALIGNEDPHYLOLIKELIHOOD_H
6 #define BPP_PHYL_LIKELIHOOD_PHYLOLIKELIHOODS_SETOFALIGNEDPHYLOLIKELIHOOD_H
7 
8 
9 // From bpp-seq:
11 
12 #include "AlignedPhyloLikelihood.h"
13 #include "PhyloLikelihoodSet.h"
14 
15 namespace bpp
16 {
21  public virtual PhyloLikelihoodSetInterface,
22  public virtual AlignedPhyloLikelihoodInterface
23 {
24 public:
26 
27  virtual std::shared_ptr<const AlignedPhyloLikelihoodInterface> getAlignedPhyloLikelihood(size_t nPhyl) const = 0;
28 
29  virtual std::shared_ptr<AlignedPhyloLikelihoodInterface> getAlignedPhyloLikelihood(size_t nPhyl) = 0;
30 
31  virtual const AlignedPhyloLikelihoodInterface& alignedPhyloLikelihood(size_t nPhyl) const = 0;
32 
34 
43  virtual DataLik getLikelihoodForASiteForAPhyloLikelihood(size_t site, size_t nPhyl) const = 0;
44 
53  virtual double getLogLikelihoodForASiteForAPhyloLikelihood(size_t site, size_t nPhyl) const = 0;
54 };
55 
64  public virtual AbstractPhyloLikelihoodSet,
65  public virtual AbstractAlignedPhyloLikelihood
66 {
67 public:
70  std::shared_ptr<PhyloLikelihoodContainer> pC,
71  bool inCollection = true,
72  const std::string& prefix = "");
73 
76  std::shared_ptr<PhyloLikelihoodContainer> pC,
77  const std::vector<size_t>& nPhylo,
78  bool inCollection = true,
79  const std::string& prefix = "");
80 
81 protected:
86  {}
87 
89  {
92  return *this;
93  }
94 
95 public:
97 
108  bool addPhyloLikelihood(size_t nPhyl, const std::string& suff) override;
109 
110  std::shared_ptr<const AlignedPhyloLikelihoodInterface> getAlignedPhyloLikelihood(size_t nPhyl) const override
111  {
112  return std::dynamic_pointer_cast<const AlignedPhyloLikelihoodInterface>((*pPhyloCont_)[nPhyl]);
113  }
114 
115  std::shared_ptr<AlignedPhyloLikelihoodInterface> getAlignedPhyloLikelihood(size_t nPhyl) override
116  {
117  return std::dynamic_pointer_cast<AlignedPhyloLikelihoodInterface>((*pPhyloCont_)[nPhyl]);
118  }
119 
120  const AlignedPhyloLikelihoodInterface& alignedPhyloLikelihood(size_t nPhyl) const override
121  {
122  return dynamic_cast<const AlignedPhyloLikelihoodInterface&>(*(*pPhyloCont_)[nPhyl]);
123  }
124 
126  {
127  return dynamic_cast<AlignedPhyloLikelihoodInterface&>(*(*pPhyloCont_)[nPhyl]);
128  }
129 
130  DataLik getLikelihoodForASiteForAPhyloLikelihood(size_t site, size_t nPhyl) const override
131  {
132  return alignedPhyloLikelihood(nPhyl).getLikelihoodForASite(site);
133  }
134 
135  double getLogLikelihoodForASiteForAPhyloLikelihood(size_t site, size_t nPhyl) const override
136  {
138  }
139 };
140 } // end of namespace bpp.
141 #endif // BPP_PHYL_LIKELIHOOD_PHYLOLIKELIHOODS_SETOFALIGNEDPHYLOLIKELIHOOD_H
The AlignedPhyloLikelihoodSet abstract class.
AbstractAlignedPhyloLikelihoodSet & operator=(const AbstractAlignedPhyloLikelihoodSet &soap)
bool addPhyloLikelihood(size_t nPhyl, const std::string &suff) override
adds a PhyloLikelihood already stored in the m ap, iff it is an AlignedPhyloLikelihood of the same si...
double getLogLikelihoodForASiteForAPhyloLikelihood(size_t site, size_t nPhyl) const override
Get the log likelihood for a site for an aligned phyloLikelihood.
DataLik getLikelihoodForASiteForAPhyloLikelihood(size_t site, size_t nPhyl) const override
Get the likelihood for a site for an aligned phyloLikelihood.
AlignedPhyloLikelihoodInterface & alignedPhyloLikelihood(size_t nPhyl) override
AbstractAlignedPhyloLikelihoodSet(const AbstractAlignedPhyloLikelihoodSet &soap)
std::shared_ptr< const AlignedPhyloLikelihoodInterface > getAlignedPhyloLikelihood(size_t nPhyl) const override
const AlignedPhyloLikelihoodInterface & alignedPhyloLikelihood(size_t nPhyl) const override
std::shared_ptr< AlignedPhyloLikelihoodInterface > getAlignedPhyloLikelihood(size_t nPhyl) override
AbstractAlignedPhyloLikelihoodSet(Context &context, std::shared_ptr< PhyloLikelihoodContainer > pC, bool inCollection=true, const std::string &prefix="")
AbstractAlignedPhyloLikelihood & operator=(const AbstractAlignedPhyloLikelihood &aasd)
The PhyloLikelihoodSet class, to manage a subset of PhyloLikelihoods from a given PhyloLikelihoodCont...
std::shared_ptr< PhyloLikelihoodContainer > pPhyloCont_
pointer to a PhyloLikelihoodContainer
AbstractPhyloLikelihoodSet & operator=(const AbstractPhyloLikelihoodSet &sd)
const Context & context() const override
The AlignedPhyloLikelihood interface, for phylogenetic likelihood.
virtual double getLogLikelihoodForASite(size_t site) const =0
Get the log likelihood for a site, and its derivatives.
virtual DataLik getLikelihoodForASite(size_t site) const =0
Get the likelihood for a site.
Joint interface SetOf+Aligned PhylLikelihood.
virtual double getLogLikelihoodForASiteForAPhyloLikelihood(size_t site, size_t nPhyl) const =0
Get the log likelihood for a site for an aligned phyloLikelihood.
virtual std::shared_ptr< AlignedPhyloLikelihoodInterface > getAlignedPhyloLikelihood(size_t nPhyl)=0
virtual const AlignedPhyloLikelihoodInterface & alignedPhyloLikelihood(size_t nPhyl) const =0
AlignedPhyloLikelihoodSetInterface * clone() const override=0
virtual AlignedPhyloLikelihoodInterface & alignedPhyloLikelihood(size_t nPhyl)=0
virtual DataLik getLikelihoodForASiteForAPhyloLikelihood(size_t site, size_t nPhyl) const =0
Get the likelihood for a site for an aligned phyloLikelihood.
virtual std::shared_ptr< const AlignedPhyloLikelihoodInterface > getAlignedPhyloLikelihood(size_t nPhyl) const =0
Context for dataflow node construction.
Definition: DataFlow.h:527
The PhyloLikelihoodSet interface, to manage a subset of PhyloLikelihoods from a given PhyloLikelihood...
Defines the basic types of data flow nodes.