bpp-seq3  3.0.0
KleinAANetChargeIndex.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_KLEINAANETCHARGEINDEX_H
6 #define BPP_SEQ_ALPHABETINDEX_KLEINAANETCHARGEINDEX_H
7 
8 
9 #include "AlphabetIndex1.h"
10 
11 namespace bpp
12 {
36 {
37 private:
38  std::vector<double> charge_;
39 
40 public:
43  charge_()
44  {
45  charge_.resize(20);
46  charge_[ 0] = 0.; // A
47  charge_[ 1] = 1.; // R
48  charge_[ 2] = 0.; // N
49  charge_[ 3] = -1.; // D
50  charge_[ 4] = 0.; // C
51  charge_[ 5] = 0.; // Q
52  charge_[ 6] = -1.; // E
53  charge_[ 7] = 0.; // G
54  charge_[ 8] = 0.; // H
55  charge_[ 9] = 0.; // I
56  charge_[10] = 0.; // L
57  charge_[11] = 1.; // K
58  charge_[12] = 0.; // M
59  charge_[13] = 0.; // F
60  charge_[14] = 0.; // P
61  charge_[15] = 0.; // S
62  charge_[16] = 0.; // T
63  charge_[17] = 0.; // W
64  charge_[18] = 0.; // Y
65  charge_[19] = 0.; // V
66  }
67 
69 
70  KleinAANetChargeIndex* clone() const override { return new KleinAANetChargeIndex(); }
71 
72 public:
73  double getIndex(int state) const override
74  {
75  return charge_[getAlphabet()->getStateIndex(state) - 1];
76  }
77 
78  double getIndex(const std::string& state) const override
79  {
80  return charge_[getAlphabet()->getStateIndex(state) - 1];
81  }
82 
83  const std::vector<double>& indexVector() const override { return charge_; }
84 };
85 } // end of namespace bpp.
86 #endif // BPP_SEQ_ALPHABETINDEX_KLEINAANETCHARGEINDEX_H
Charge of each amino acid.
double getIndex(const std::string &state) const override
Get the index associated to a state.
std::vector< double > charge_
const std::vector< double > & indexVector() const override
double getIndex(int state) const override
Get the index associated to a state.
KleinAANetChargeIndex * clone() const override
std::shared_ptr< const Alphabet > getAlphabet() const override
Get the alphabet associated to this index.
This alphabet is used to deal NumericAlphabet.