bpp-phyl3  3.0.0
SitePatterns.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_SITEPATTERNS_H
6 #define BPP_PHYL_SITEPATTERNS_H
7 
8 #include <Bpp/Clonable.h>
10 
11 
12 // From bpp-seq:
13 #include <Bpp/Seq/CoreSite.h>
15 
16 // From the STL:
17 #include <map>
18 #include <vector>
19 #include <string>
20 
21 #include <Eigen/Core>
22 
23 namespace bpp
24 {
33 class SitePatterns :
34  public virtual Clonable
35 {
36 public:
37  typedef Eigen::Matrix<size_t, 1, -1> IndicesType;
38 
39 private:
44  {
45 public:
46  std::string siteS;
49 
50 public:
54  {
55  siteS = ss.siteS;
56  siteP = ss.siteP;
58  return *this;
59  }
60 
61  bool operator<(const SortableSite& ss) const { return siteS < ss.siteS; }
62 
63  virtual ~SortableSite() {}
64  };
65 
66 private:
67  std::vector<std::string> names_;
68  std::vector<std::shared_ptr<const CoreSiteInterface>> sites_;
69  std::vector<unsigned int> weights_;
71  std::shared_ptr<const Alphabet> alpha_;
72 
73 public:
85  const AlignmentDataInterface& sequences,
86  std::vector<std::string> names = {});
87 
88  SitePatterns* clone() const { return new SitePatterns(*this); }
89 
90 private:
91  void init_(
92  const AlignmentDataInterface& sequences,
93  std::vector<std::string> names = {});
94 
95 public:
99  const std::vector<unsigned int>& getWeights() const { return weights_; }
103  const IndicesType& getIndices() const { return indices_; }
104 
108  std::unique_ptr<AlignmentDataInterface> getSites() const;
109 };
110 } // end of namespace bpp.
111 #endif // BPP_PHYL_SITEPATTERNS_H
Class used for site pattern sorting.
Definition: SitePatterns.h:44
bool operator<(const SortableSite &ss) const
Definition: SitePatterns.h:61
SortableSite(const SortableSite &ss)
Definition: SitePatterns.h:52
SortableSite & operator=(const SortableSite &ss)
Definition: SitePatterns.h:53
const CoreSiteInterface * siteP
Definition: SitePatterns.h:47
Data structure for site patterns.
Definition: SitePatterns.h:35
const std::vector< unsigned int > & getWeights() const
Definition: SitePatterns.h:99
const IndicesType & getIndices() const
Definition: SitePatterns.h:103
void init_(const AlignmentDataInterface &sequences, std::vector< std::string > names={})
Eigen::Matrix< size_t, 1, -1 > IndicesType
Definition: SitePatterns.h:37
IndicesType indices_
Definition: SitePatterns.h:70
std::vector< std::shared_ptr< const CoreSiteInterface > > sites_
Definition: SitePatterns.h:68
std::vector< unsigned int > weights_
Definition: SitePatterns.h:69
std::vector< std::string > names_
Definition: SitePatterns.h:67
SitePatterns * clone() const
Definition: SitePatterns.h:88
std::shared_ptr< const Alphabet > alpha_
Definition: SitePatterns.h:71
SitePatterns(const AlignmentDataInterface &sequences, std::vector< std::string > names={})
Build a new SitePattern object.
std::unique_ptr< AlignmentDataInterface > getSites() const
Defines the basic types of data flow nodes.