bpp-seq3  3.0.0
GranthamAAPolarityIndex.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_GRANTHAMAAPOLARITYINDEX_H
6 #define BPP_SEQ_ALPHABETINDEX_GRANTHAMAAPOLARITYINDEX_H
7 
8 
9 #include "AlphabetIndex1.h"
10 
11 namespace bpp
12 {
33  public virtual ProteicAlphabetIndex1
34 {
35 private:
36  std::vector<double> polarity_;
37 
38 public:
41  polarity_()
42  {
43  polarity_.resize(20);
44  polarity_[ 0] = 8.1; // A
45  polarity_[ 1] = 10.5; // R
46  polarity_[ 2] = 11.6; // N
47  polarity_[ 3] = 13.0; // D
48  polarity_[ 4] = 5.5; // C
49  polarity_[ 5] = 10.5; // Q
50  polarity_[ 6] = 12.3; // E
51  polarity_[ 7] = 9.0; // G
52  polarity_[ 8] = 10.4; // H
53  polarity_[ 9] = 5.2; // I
54  polarity_[10] = 4.9; // L
55  polarity_[11] = 11.3; // K
56  polarity_[12] = 5.7; // M
57  polarity_[13] = 5.2; // F
58  polarity_[14] = 8.0; // P
59  polarity_[15] = 9.2; // S
60  polarity_[16] = 8.6; // T
61  polarity_[17] = 5.4; // W
62  polarity_[18] = 6.2; // Y
63  polarity_[19] = 5.9; // V
64  }
65 
67 
68  GranthamAAPolarityIndex* clone() const override { return new GranthamAAPolarityIndex(); }
69 
70 public:
71  double getIndex(int state) const override
72  {
73  return polarity_[getAlphabet()->getStateIndex(state) - 1];
74  }
75 
76  double getIndex(const std::string& state) const override
77  {
78  return polarity_[getAlphabet()->getStateIndex(state) - 1];
79  }
80 
81  const std::vector<double>& indexVector() const override { return polarity_; }
82 };
83 } // end of namespace bpp.
84 #endif // BPP_SEQ_ALPHABETINDEX_GRANTHAMAAPOLARITYINDEX_H
Polarity index used in Grantham (1974).
double getIndex(int state) const override
Get the index associated to a state.
const std::vector< double > & indexVector() const override
GranthamAAPolarityIndex * clone() const override
double getIndex(const std::string &state) const override
Get the index associated to a state.
std::shared_ptr< const Alphabet > getAlphabet() const override
Get the alphabet associated to this index.
This alphabet is used to deal NumericAlphabet.