bpp-seq3  3.0.0
AAMassIndex.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_AAMASSINDEX_H
6 #define BPP_SEQ_ALPHABETINDEX_AAMASSINDEX_H
7 
8 
9 #include "AlphabetIndex1.h"
10 
11 namespace bpp
12 {
16 class AAMassIndex :
18 {
19 private:
20  std::vector<double> mass_;
21 
22 public:
25  mass_()
26  {
27  mass_.resize(20);
28  mass_[ 0] = 71.09; // A
29  mass_[ 1] = 156.19; // R
30  mass_[ 2] = 114.11; // N
31  mass_[ 3] = 115.09; // D
32  mass_[ 4] = 103.15; // C
33  mass_[ 5] = 128.14; // Q
34  mass_[ 6] = 129.12; // E
35  mass_[ 7] = 57.05; // G
36  mass_[ 8] = 137.14; // H
37  mass_[ 9] = 113.16; // I
38  mass_[10] = 113.16; // L
39  mass_[11] = 128.17; // K
40  mass_[12] = 131.19; // M
41  mass_[13] = 147.18; // F
42  mass_[14] = 97.12; // P
43  mass_[15] = 87.08; // S
44  mass_[16] = 101.11; // T
45  mass_[17] = 186.12; // W
46  mass_[18] = 163.18; // Y
47  mass_[19] = 99.14; // V
48  }
49 
50  virtual ~AAMassIndex() {}
51 
52  AAMassIndex* clone() const override { return new AAMassIndex(); }
53 
54 public:
55  double getIndex(int state) const override
56  {
57  return mass_[getAlphabet()->getStateIndex(state) - 1];
58  }
59 
60  double getIndex(const std::string& state) const override
61  {
62  return mass_[getAlphabet()->getStateIndex(state) - 1];
63  }
64 
65  const std::vector<double>& indexVector() const override { return mass_; }
66 };
67 } // end of namespace bpp.
68 #endif // BPP_SEQ_ALPHABETINDEX_AAMASSINDEX_H
Mass (dalton) of each amino acid, according to http://www.imb-jena.de/IMAGE_AA.html.
Definition: AAMassIndex.h:18
AAMassIndex * clone() const override
Definition: AAMassIndex.h:52
double getIndex(int state) const override
Get the index associated to a state.
Definition: AAMassIndex.h:55
virtual ~AAMassIndex()
Definition: AAMassIndex.h:50
const std::vector< double > & indexVector() const override
Definition: AAMassIndex.h:65
double getIndex(const std::string &state) const override
Get the index associated to a state.
Definition: AAMassIndex.h:60
std::vector< double > mass_
Definition: AAMassIndex.h:20
std::shared_ptr< const Alphabet > getAlphabet() const override
Get the alphabet associated to this index.
This alphabet is used to deal NumericAlphabet.