bpp-seq3  3.0.0
AAChargeIndex.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_SEQ_ALPHABETINDEX_AACHARGEINDEX_H
6 #define BPP_SEQ_ALPHABETINDEX_AACHARGEINDEX_H
7 
8 
9 #include "AlphabetIndex1.h"
10 
11 namespace bpp
12 {
61 {
62 private:
63  std::vector<double> charge_;
64 
65 public:
68  charge_()
69  {
70  charge_.resize(20);
71  charge_[ 0] = 0.; // A
72  charge_[ 1] = 1.; // R
73  charge_[ 2] = 0.; // N
74  charge_[ 3] = -1.; // D
75  charge_[ 4] = 0.; // C
76  charge_[ 5] = 0.; // Q
77  charge_[ 6] = -1.; // E
78  charge_[ 7] = 0.; // G
79  charge_[ 8] = 1.; // H
80  charge_[ 9] = 0.; // I
81  charge_[10] = 0.; // L
82  charge_[11] = 1.; // K
83  charge_[12] = 0.; // M
84  charge_[13] = 0.; // F
85  charge_[14] = 0.; // P
86  charge_[15] = 0.; // S
87  charge_[16] = 0.; // T
88  charge_[17] = 0.; // W
89  charge_[18] = 0.; // Y
90  charge_[19] = 0.; // V
91  }
92 
93  virtual ~AAChargeIndex() {}
94 
95  AAChargeIndex* clone() const override { return new AAChargeIndex(); }
96 
97 public:
98  double getIndex(int state) const override
99  {
100  return charge_[getAlphabet()->getStateIndex(state) - 1];
101  }
102 
103  double getIndex(const std::string& state) const override
104  {
105  return charge_[getAlphabet()->getStateIndex(state) - 1];
106  }
107 
108  const std::vector<double>& indexVector() const override { return charge_; }
109 };
110 } // end of namespace bpp.
111 #endif // BPP_SEQ_ALPHABETINDEX_AACHARGEINDEX_H
Charge of each amino acid.
Definition: AAChargeIndex.h:61
std::vector< double > charge_
Definition: AAChargeIndex.h:63
double getIndex(const std::string &state) const override
Get the index associated to a state.
AAChargeIndex * clone() const override
Definition: AAChargeIndex.h:95
double getIndex(int state) const override
Get the index associated to a state.
Definition: AAChargeIndex.h:98
virtual ~AAChargeIndex()
Definition: AAChargeIndex.h:93
const std::vector< double > & indexVector() const override
std::shared_ptr< const Alphabet > getAlphabet() const override
Get the alphabet associated to this index.
This alphabet is used to deal NumericAlphabet.