bpp-core3  3.0.0
GranthamAAVolumeIndex.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_GRANTHAMAAVOLUMEINDEX_H
6 #define BPP_SEQ_ALPHABETINDEX_GRANTHAMAAVOLUMEINDEX_H
7 
8 
9 #include "AlphabetIndex1.h"
10 
11 // From the STL:
12 #include <vector>
13 
14 namespace bpp
15 {
36  public virtual ProteicAlphabetIndex1
37 {
38 private:
39  std::vector<double> volume_;
40 
41 public:
44  volume_()
45  {
46  volume_.resize(20);
47  volume_[ 0] = 31.; // A
48  volume_[ 1] = 124.; // R
49  volume_[ 2] = 56.; // N
50  volume_[ 3] = 54.; // D
51  volume_[ 4] = 55.; // C
52  volume_[ 5] = 85.; // Q
53  volume_[ 6] = 83.; // E
54  volume_[ 7] = 3.; // G
55  volume_[ 8] = 96.; // H
56  volume_[ 9] = 111.; // I
57  volume_[10] = 111.; // L
58  volume_[11] = 119.; // K
59  volume_[12] = 105.; // M
60  volume_[13] = 132.; // F
61  volume_[14] = 32.5; // P
62  volume_[15] = 32.; // S
63  volume_[16] = 61.; // T
64  volume_[17] = 170.; // W
65  volume_[18] = 136.; // Y
66  volume_[19] = 84.; // V
67  }
68 
70 
71  GranthamAAVolumeIndex* clone() const override { return new GranthamAAVolumeIndex(); }
72 
73 public:
74  double getIndex(int state) const override
75  {
76  return volume_[getAlphabet()->getStateIndex(state) - 1];
77  }
78 
79  double getIndex(const std::string& state) const override
80  {
81  return volume_[getAlphabet()->getStateIndex(state) - 1];
82  }
83 
84  const std::vector<double>& indexVector() const override { return volume_; }
85 };
86 } // end of namespace bpp.
87 #endif // BPP_SEQ_ALPHABETINDEX_GRANTHAMAAVOLUMEINDEX_H
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.
double getIndex(int state) const override
Get the index associated to a state.
Volume index used in Grantham (1974).
std::vector< double > volume_
GranthamAAVolumeIndex * clone() const override
const std::vector< double > & indexVector() const override