bpp-phyl3  3.0.0
GivenDataSubstitutionProcessSequenceSimulator.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_SIMULATION_GIVENDATASUBSTITUTIONPROCESSSEQUENCESIMULATOR_H
6 #define BPP_PHYL_SIMULATION_GIVENDATASUBSTITUTIONPROCESSSEQUENCESIMULATOR_H
7 
8 
10 #include "SequenceSimulator.h"
11 
12 namespace bpp
13 {
19  public virtual SequenceSimulatorInterface
20 {
21 private:
22  std::shared_ptr<LikelihoodCalculationSingleProcess> calcul_;
23 
24  /*
25  * @brief Vector of site specific site simulators on SHRUNKED data
26  *
27  * More efficient implementation is possible (all in ona).
28  *
29  */
30 
31  std::vector<std::shared_ptr<GivenDataSubstitutionProcessSiteSimulator>> vSiteSim_;
32 
33 public:
34  GivenDataSubstitutionProcessSequenceSimulator(std::shared_ptr<LikelihoodCalculationSingleProcess> calcul) :
35  calcul_(calcul), vSiteSim_()
36  {
37  for (size_t i = 0; i < calcul_->getNumberOfDistinctSites(); i++)
38  {
39  vSiteSim_.push_back(std::make_shared<GivenDataSubstitutionProcessSiteSimulator>(calcul_, i, true));
40  }
41  }
42 
44  {}
45 
47  calcul_(nhss.calcul_), vSiteSim_(nhss.vSiteSim_)
48  {}
49 
51  {
53  }
54 
55 public:
61  std::unique_ptr<SiteContainerInterface> simulate() const
62  {
63  return simulate(0);
64  }
65 
66  std::unique_ptr<SiteContainerInterface> simulate(size_t numberOfSites) const override;
67 
68  const SiteSimulatorInterface& siteSimulator(size_t pos) const override
69  {
70  return *vSiteSim_[calcul_->getRootArrayPosition(pos)];
71  }
72 
78  std::shared_ptr<const Alphabet> getAlphabet() const override
79  {
80  return vSiteSim_[0]->getAlphabet();
81  }
82 
83  const Alphabet& alphabet() const override
84  {
85  return vSiteSim_[0]->alphabet();
86  }
87 
88  std::vector<std::string> getSequenceNames() const override
89  {
90  return vSiteSim_[0]->getSequenceNames();
91  }
92 
96  size_t getNumberOfSites() const
97  {
98  return calcul_->getNumberOfSites();
99  }
100 
109  void outputInternalSequences(bool yn) override
110  {
111  for (auto& siteSim : vSiteSim_)
112  {
113  siteSim->outputInternalSites(yn);
114  }
115  }
116 };
117 } // end of namespace bpp.
118 #endif // BPP_PHYL_SIMULATION_GIVENDATASUBSTITUTIONPROCESSSEQUENCESIMULATOR_H
Sequences simulation under a unique substitution process, but with site specific posterior probabilit...
GivenDataSubstitutionProcessSequenceSimulator * clone() const override
void outputInternalSequences(bool yn) override
Sets whether we will output the internal sequences or not.
GivenDataSubstitutionProcessSequenceSimulator(std::shared_ptr< LikelihoodCalculationSingleProcess > calcul)
const SiteSimulatorInterface & siteSimulator(size_t pos) const override
std::vector< std::shared_ptr< GivenDataSubstitutionProcessSiteSimulator > > vSiteSim_
GivenDataSubstitutionProcessSequenceSimulator(const GivenDataSubstitutionProcessSequenceSimulator &nhss)
std::shared_ptr< LikelihoodCalculationSingleProcess > calcul_
The SequenceSimulator interface. SequenceSimulator classes can simulate whole datasets.
The SiteSimulator interface. SiteSimulator classes can simulate single sites.
Definition: SiteSimulator.h:24
Defines the basic types of data flow nodes.