bpp-seq3  3.0.0
AAIndex2Entry.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_AAINDEX2ENTRY_H
6 #define BPP_SEQ_ALPHABETINDEX_AAINDEX2ENTRY_H
7 
9 
10 #include "AlphabetIndex2.h"
11 
12 namespace bpp
13 {
18  public virtual ProteicAlphabetIndex2
19 {
20 private:
22  bool sym_;
23 
24 public:
36  AAIndex2Entry(std::istream& input, bool sym = true);
37 
38  AAIndex2Entry(const AAIndex2Entry& index) :
39  ProteicAlphabetIndex2(*this),
40  property_(index.property_),
41  sym_(index.sym_)
42  {}
43 
45  {
47 
48  property_ = index.property_;
49  sym_ = index.sym_;
50  return *this;
51  }
52 
53  virtual ~AAIndex2Entry() {}
54 
55 public:
56  AAIndex2Entry* clone() const override { return new AAIndex2Entry(*this); }
57 
58  double getIndex(int state1, int state2) const override
59  {
60  return property_(getAlphabet()->getStateIndex(state1) - 1, getAlphabet()->getStateIndex(state2) - 1);
61  }
62 
63  double getIndex(const std::string& state1, const std::string& state2) const override
64  {
65  return property_(getAlphabet()->getStateIndex(state1) - 1, getAlphabet()->getStateIndex(state2) - 1);
66  }
67 
68  const Matrix<double>& getIndexMatrix() const override { return property_; }
69 
70  bool isSymmetric() const override { return sym_; }
71 };
72 } // end of namespace bpp.
73 #endif // BPP_SEQ_ALPHABETINDEX_AAINDEX2ENTRY_H
Create a AlphabetIndex2 object from an AAIndex2 entry.
Definition: AAIndex2Entry.h:19
AAIndex2Entry(const AAIndex2Entry &index)
Definition: AAIndex2Entry.h:38
LinearMatrix< double > property_
Definition: AAIndex2Entry.h:21
double getIndex(const std::string &state1, const std::string &state2) const override
Get the index associated to a pair of states.
Definition: AAIndex2Entry.h:63
AAIndex2Entry * clone() const override
Definition: AAIndex2Entry.h:56
AAIndex2Entry(std::istream &input, bool sym=true)
Create a new AAIndex2Entry from an input stream.
AAIndex2Entry & operator=(const AAIndex2Entry &index)
Definition: AAIndex2Entry.h:44
virtual ~AAIndex2Entry()
Definition: AAIndex2Entry.h:53
const Matrix< double > & getIndexMatrix() const override
Definition: AAIndex2Entry.h:68
double getIndex(int state1, int state2) const override
Get the index associated to a pair of states.
Definition: AAIndex2Entry.h:58
bool isSymmetric() const override
Definition: AAIndex2Entry.h:70
Virtual AlphabetIndex2 for proteic alphabet.
std::shared_ptr< const Alphabet > getAlphabet() const override
Get the alphabet associated to this index.
ProteicAlphabetIndex2 & operator=(const ProteicAlphabetIndex2 &pt)
This alphabet is used to deal NumericAlphabet.