bpp-phyl3  3.0.0
SubstitutionProcessSequenceSimulator.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_SUBSTITUTIONPROCESSSEQUENCESIMULATOR_H
6 #define BPP_PHYL_SIMULATION_SUBSTITUTIONPROCESSSEQUENCESIMULATOR_H
7 
9 
10 #include "SequenceSimulator.h"
11 #include "SiteSimulator.h"
12 
13 namespace bpp
14 {
21  public virtual SequenceSimulatorInterface
22 {
23 protected:
28  std::map<size_t, std::shared_ptr<SiteSimulatorInterface>> mProcess_;
29 
35  mutable std::vector<size_t> vMap_;
36 
41  std::vector<std::string> seqNames_;
42 
50  std::map<size_t, std::vector<size_t>> mvPosNames_;
51 
52 public:
54 
56 
58 
60 
62 
63  const SiteSimulatorInterface& siteSimulator(size_t pos) const override
64  {
65  if (pos > vMap_.size())
66  throw BadIntegerException("Out of range position for SubstitutionProcessSequenceSimulator", (int)pos);
67  return *mProcess_.at(vMap_[pos]);
68  }
69 
70  std::vector<std::string> getSequenceNames() const override
71  {
72  return seqNames_;
73  }
74 
81  void outputInternalSequences(bool yn) override;
82 
86  void setMap(std::vector<size_t> vMap);
87 
91  size_t getNumberOfSites() const
92  {
93  return vMap_.size();
94  }
95 
96  std::unique_ptr<SiteContainerInterface> simulate(size_t numberOfSites) const override;
97 
98  std::unique_ptr<SiteContainerInterface> simulate(const std::vector<double>& rates) const;
99 
100  std::unique_ptr<SiteContainerInterface> simulate(const std::vector<size_t>& states) const;
101 
102  std::unique_ptr<SiteContainerInterface> simulate(const std::vector<double>& rates, const std::vector<size_t>& states) const;
103 
104  std::shared_ptr<const Alphabet> getAlphabet() const override;
105 
106  const Alphabet& alphabet() const override;
107 };
108 } // end of namespace bpp.
109 #endif // BPP_PHYL_SIMULATION_SUBSTITUTIONPROCESSSEQUENCESIMULATOR_H
This interface describes the evolution process of a sequence.
The SequenceSimulator interface. SequenceSimulator classes can simulate whole datasets.
The SiteSimulator interface. SiteSimulator classes can simulate single sites.
Definition: SiteSimulator.h:24
Sequences simulation under position specific substitution process.
std::vector< std::string > seqNames_
all processes trees must have at least the same sequence names as the first process of the map.
void setMap(std::vector< size_t > vMap)
reset the set of processes.
std::shared_ptr< const Alphabet > getAlphabet() const override
std::map< size_t, std::vector< size_t > > mvPosNames_
correspondence map of seqNames positions of the several trees. Reference is the tree of the first pro...
size_t getNumberOfSites() const
the number of mapped sites.
std::vector< size_t > vMap_
The vector of the site specific process in mProcess_; is mutable because can be changed for each simu...
SubstitutionProcessSequenceSimulator & operator=(const SubstitutionProcessSequenceSimulator &)
std::unique_ptr< SiteContainerInterface > simulate(size_t numberOfSites) const override
std::vector< std::string > getSequenceNames() const override
void outputInternalSequences(bool yn) override
Sets whether we will output the internal sequences or not.
SubstitutionProcessSequenceSimulator * clone() const override
std::map< size_t, std::shared_ptr< SiteSimulatorInterface > > mProcess_
the map of the process simulators.
const SiteSimulatorInterface & siteSimulator(size_t pos) const override
Defines the basic types of data flow nodes.