bpp-seq3  3.0.0
GranthamAAChemicalDistance.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_GRANTHAMAACHEMICALDISTANCE_H
6 #define BPP_SEQ_ALPHABETINDEX_GRANTHAMAACHEMICALDISTANCE_H
7 
8 
9 // from the STL:
10 #include <string>
11 
12 #include "AlphabetIndex2.h"
13 #include "../Alphabet/AlphabetExceptions.h"
14 #include <Bpp/Exceptions.h>
16 
17 namespace bpp
18 {
63 {
64 private:
68  short int sign_;
69 
70 public:
72 
78  sign_(gd.sign_)
79  {}
80 
82  {
84 
88  sign_ = gd.sign_;
89  return *this;
90  }
91 
92  GranthamAAChemicalDistance* clone() const override { return new GranthamAAChemicalDistance(); }
93 
95 
96 public:
102  double getIndex(int state1, int state2) const override;
103  double getIndex(const std::string& state1, const std::string& state2) const override;
104  const Matrix<double>& getIndexMatrix() const override { return indexMatrix_; }
107 protected:
108  void computeIndexMatrix_();
109 
110 public:
111  void setSymmetric(bool yn)
112  {
113  sign_ = (yn ? SIGN_NONE : SIGN_ARBITRARY);
115  }
116  bool isSymmetric() const override { return sign_ == SIGN_NONE; }
124  void setPC1Sign(bool yn)
125  {
126  sign_ = (yn ? SIGN_PC1 : SIGN_ARBITRARY);
128  }
129 
130  static short int SIGN_ARBITRARY;
131  static short int SIGN_PC1;
132  static short int SIGN_NONE;
133 };
134 } // end of namespace bpp.
135 #endif // BPP_SEQ_ALPHABETINDEX_GRANTHAMAACHEMICALDISTANCE_H
Grantham (1974) Amino-Acid chemical distance.
GranthamAAChemicalDistance(const GranthamAAChemicalDistance &gd)
void setPC1Sign(bool yn)
The sign of the distance is computed using the coordinate on the first axis of a principal component ...
const Matrix< double > & getIndexMatrix() const override
double getIndex(int state1, int state2) const override
Get the index associated to a pair of states.
GranthamAAChemicalDistance & operator=(const GranthamAAChemicalDistance &gd)
GranthamAAChemicalDistance * clone() const override
Virtual AlphabetIndex2 for proteic alphabet.
ProteicAlphabetIndex2 & operator=(const ProteicAlphabetIndex2 &pt)
This alphabet is used to deal NumericAlphabet.