bpp-seq3  3.0.0
AAIndex1Entry.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_AAINDEX1ENTRY_H
6 #define BPP_SEQ_ALPHABETINDEX_AAINDEX1ENTRY_H
7 
8 
9 #include "AlphabetIndex1.h"
10 
11 namespace bpp
12 {
18 {
19 private:
20  std::vector<double> property_;
21 
22 public:
29  AAIndex1Entry(std::istream& input);
30 
31  AAIndex1Entry(const AAIndex1Entry& index) :
32  ProteicAlphabetIndex1(index),
33  property_(index.property_)
34  {}
35 
37  {
39  property_ = index.property_;
40  return *this;
41  }
42 
43  virtual ~AAIndex1Entry() {}
44 
45  AAIndex1Entry* clone() const override { return new AAIndex1Entry(*this); }
46 
47 public:
48  double getIndex(int state) const override
49  {
50  return property_[getAlphabet()->getStateIndex(state) - 1];
51  }
52 
53  double getIndex(const std::string& state) const override
54  {
55  return property_[getAlphabet()->getStateIndex(state) - 1];
56  }
57 
58  const std::vector<double>& indexVector() const override { return property_; }
59 };
60 } // end of namespace bpp.
61 #endif // BPP_SEQ_ALPHABETINDEX_AAINDEX1ENTRY_H
Create a AlphabetIndex1 object from an AAIndex2 entry.
Definition: AAIndex1Entry.h:18
AAIndex1Entry * clone() const override
Definition: AAIndex1Entry.h:45
std::vector< double > property_
Definition: AAIndex1Entry.h:20
AAIndex1Entry(const AAIndex1Entry &index)
Definition: AAIndex1Entry.h:31
virtual ~AAIndex1Entry()
Definition: AAIndex1Entry.h:43
AAIndex1Entry(std::istream &input)
Create a new AAIndex1Entry from an input stream.
double getIndex(int state) const override
Get the index associated to a state.
Definition: AAIndex1Entry.h:48
const std::vector< double > & indexVector() const override
Definition: AAIndex1Entry.h:58
double getIndex(const std::string &state) const override
Get the index associated to a state.
Definition: AAIndex1Entry.h:53
AAIndex1Entry & operator=(const AAIndex1Entry &index)
Definition: AAIndex1Entry.h:36
std::shared_ptr< const Alphabet > getAlphabet() const override
Get the alphabet associated to this index.
ProteicAlphabetIndex1 & operator=(const ProteicAlphabetIndex1 &pt)
This alphabet is used to deal NumericAlphabet.