bpp-core3  3.0.0
KD_AAHydropathyIndex.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_KD_AAHYDROPATHYINDEX_H
6 #define BPP_SEQ_ALPHABETINDEX_KD_AAHYDROPATHYINDEX_H
7 
8 
9 #include "AlphabetIndex1.h"
10 
11 namespace bpp
12 {
21  public virtual ProteicAlphabetIndex1
22 {
23 private:
24  std::vector<double> hydropathy_;
25 
26 public:
29  hydropathy_()
30  {
31  hydropathy_.resize(20);
32  hydropathy_[ 0] = 1.8; // A
33  hydropathy_[ 1] = -4.5; // R
34  hydropathy_[ 2] = -3.5; // N
35  hydropathy_[ 3] = -3.5; // D
36  hydropathy_[ 4] = 2.5; // C
37  hydropathy_[ 5] = -3.5; // Q
38  hydropathy_[ 6] = -3.5; // E
39  hydropathy_[ 7] = -0.4; // G
40  hydropathy_[ 8] = -3.2; // H
41  hydropathy_[ 9] = 4.5; // I
42  hydropathy_[10] = 3.8; // L
43  hydropathy_[11] = -3.9; // K
44  hydropathy_[12] = 1.9; // M
45  hydropathy_[13] = 2.8; // F
46  hydropathy_[14] = -1.6; // P
47  hydropathy_[15] = -0.8; // S
48  hydropathy_[16] = -0.7; // T
49  hydropathy_[17] = -0.9; // W
50  hydropathy_[18] = -1.3; // Y
51  hydropathy_[19] = 4.2; // V
52  }
53 
54  virtual ~KD_AAHydropathyIndex() {}
55 
56  KD_AAHydropathyIndex* clone() const override { return new KD_AAHydropathyIndex(); }
57 
58 public:
59  double getIndex(int state) const override
60  {
61  return hydropathy_[getAlphabet()->getStateIndex(state) - 1];
62  }
63 
64  double getIndex(const std::string& state) const override
65  {
66  return hydropathy_[getAlphabet()->getStateIndex(state) - 1];
67  }
68 
69  const std::vector<double>& indexVector() const override { return hydropathy_; }
70 };
71 } // end of namespace bpp.
72 #endif // BPP_SEQ_ALPHABETINDEX_KD_AAHYDROPATHYINDEX_H
std::shared_ptr< const Alphabet > getAlphabet() const override
Get the alphabet associated to this index.
This alphabet is used to deal NumericAlphabet.
std::vector< double > hydropathy_
const std::vector< double > & indexVector() const override
double getIndex(const std::string &state) const override
Get the index associated to a state.
double getIndex(int state) const override
Get the index associated to a state.
KD_AAHydropathyIndex * clone() const override
Hydropathy index defined in Kyte & Doolitle (1982).