bpp-phyl3  3.0.0
ProteinFrequencySet.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_MODEL_FREQUENCYSET_PROTEINFREQUENCYSET_H
6 #define BPP_PHYL_MODEL_FREQUENCYSET_PROTEINFREQUENCYSET_H
7 
9 
10 #include "FrequencySet.h"
11 
12 namespace bpp
13 {
18  public virtual FrequencySetInterface
19 {
20 public:
21  ProteinFrequencySetInterface* clone() const override = 0;
22 
23  virtual std::shared_ptr<const ProteicAlphabet> getProteicAlphabet() const = 0;
24 };
25 
38  public virtual ProteinFrequencySetInterface,
39  public FullFrequencySet
40 {
41 public:
43  std::shared_ptr<const ProteicAlphabet> alphabet,
44  bool allowNullFreqs = false,
45  unsigned short method = 1,
46  const std::string& name = "Full") :
48  std::make_shared<const CanonicalStateMap>(alphabet, false),
49  allowNullFreqs,
50  method,
51  name)
52  {}
53 
55  std::shared_ptr<const ProteicAlphabet> alphabet,
56  const std::vector<double>& initFreqs,
57  bool allowNullFreqs = false,
58  unsigned short method = 1,
59  const std::string& name = "Full") :
61  std::make_shared<const CanonicalStateMap>(alphabet, false),
62  initFreqs,
63  allowNullFreqs,
64  method,
65  name)
66  {}
67 
68  FullProteinFrequencySet* clone() const override { return new FullProteinFrequencySet(*this); }
69 
70 public:
71  std::shared_ptr<const ProteicAlphabet> getProteicAlphabet() const override
72  {
73  return std::dynamic_pointer_cast<const ProteicAlphabet>(getAlphabet());
74  }
75 };
76 
83  public virtual ProteinFrequencySetInterface,
84  public FixedFrequencySet
85 {
86 public:
88  std::shared_ptr<const ProteicAlphabet> alphabet,
89  const std::vector<double>& initFreqs,
90  const std::string& name = "Fixed") :
92  std::make_shared<const CanonicalStateMap>(alphabet, false),
93  initFreqs,
94  name)
95  {}
96 
102  std::shared_ptr<const ProteicAlphabet> alphabet,
103  const std::string& name = "Fixed") :
105  std::make_shared<const CanonicalStateMap>(alphabet, false),
106  name)
107  {}
108 
109  FixedProteinFrequencySet* clone() const override { return new FixedProteinFrequencySet(*this); }
110 
111  std::shared_ptr<const ProteicAlphabet> getProteicAlphabet() const override
112  {
113  return std::dynamic_pointer_cast<const ProteicAlphabet>(getAlphabet());
114  }
115 };
116 
124  public virtual ProteinFrequencySetInterface,
125  public UserFrequencySet
126 {
127 public:
129  std::shared_ptr<const ProteicAlphabet> alphabet,
130  const std::string& path,
131  size_t nCol = 1) :
133  std::make_shared<const CanonicalStateMap>(alphabet, false),
134  path,
135  nCol)
136  {}
137 
138  UserProteinFrequencySet* clone() const override { return new UserProteinFrequencySet(*this); }
139 
140  std::shared_ptr<const ProteicAlphabet> getProteicAlphabet() const override
141  {
142  return std::dynamic_pointer_cast<const ProteicAlphabet>(getAlphabet());
143  }
144 };
145 } // end of namespace bpp.
146 #endif // BPP_PHYL_MODEL_FREQUENCYSET_PROTEINFREQUENCYSET_H
This class implements a state map where all resolved states are modeled.
Definition: StateMap.h:168
FrequencySet useful for homogeneous and stationary models.
Definition: FrequencySet.h:347
FrequencySet useful for homogeneous and stationary models, protein implementation.
FixedProteinFrequencySet * clone() const override
FixedProteinFrequencySet(std::shared_ptr< const ProteicAlphabet > alphabet, const std::string &name="Fixed")
Construction with uniform frequencies on the letters of the alphabet.
FixedProteinFrequencySet(std::shared_ptr< const ProteicAlphabet > alphabet, const std::vector< double > &initFreqs, const std::string &name="Fixed")
std::shared_ptr< const ProteicAlphabet > getProteicAlphabet() const override
Parametrize a set of state frequencies.
Definition: FrequencySet.h:29
virtual std::shared_ptr< const Alphabet > getAlphabet() const =0
virtual const Alphabet & alphabet() const =0
A generic FrequencySet allowing for the estimation of all frequencies.
Definition: FrequencySet.h:198
Protein FrequencySet using 19 independent parameters to model the 20 frequencies.
std::shared_ptr< const ProteicAlphabet > getProteicAlphabet() const override
FullProteinFrequencySet * clone() const override
FullProteinFrequencySet(std::shared_ptr< const ProteicAlphabet > alphabet, const std::vector< double > &initFreqs, bool allowNullFreqs=false, unsigned short method=1, const std::string &name="Full")
FullProteinFrequencySet(std::shared_ptr< const ProteicAlphabet > alphabet, bool allowNullFreqs=false, unsigned short method=1, const std::string &name="Full")
Parametrize a set of state frequencies for proteins.
ProteinFrequencySetInterface * clone() const override=0
virtual std::shared_ptr< const ProteicAlphabet > getProteicAlphabet() const =0
FrequencySet to be read in a file. More specifically, a frequency set is read in a column of a given ...
Definition: FrequencySet.h:386
UserProteinFrequencySet(std::shared_ptr< const ProteicAlphabet > alphabet, const std::string &path, size_t nCol=1)
std::shared_ptr< const ProteicAlphabet > getProteicAlphabet() const override
UserProteinFrequencySet * clone() const override
Defines the basic types of data flow nodes.