bpp-seq3  3.0.0
BLOSUM50.cpp
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: The Bio++ Development Group
2 //
3 // SPDX-License-Identifier: CECILL-2.1
4 
5 #include "../Alphabet/AlphabetTools.h"
6 #include "BLOSUM50.h"
7 
8 // from the STL:
9 #include <string>
10 
11 using namespace std;
12 using namespace bpp;
13 
14 BLOSUM50::BLOSUM50() :
16  distanceMatrix_(20, 20)
17 {
18  #include "__BLOSUM50MatrixCode"
19 }
20 
21 double BLOSUM50::getIndex(int state1, int state2) const
22 {
23  return distanceMatrix_(getAlphabet()->getStateIndex(state1) - 1, getAlphabet()->getStateIndex(state2) - 1);
24 }
25 
26 double BLOSUM50::getIndex(const std::string& state1, const std::string& state2) const
27 {
28  return distanceMatrix_(getAlphabet()->getStateIndex(state1) - 1, getAlphabet()->getStateIndex(state2) - 1);
29 }
30 
32 {
33  return distanceMatrix_;
34 }
double getIndex(int state1, int state2) const override
Get the index associated to a pair of states.
Definition: BLOSUM50.cpp:21
const Matrix< double > & getIndexMatrix() const override
Definition: BLOSUM50.cpp:31
LinearMatrix< double > distanceMatrix_
Definition: BLOSUM50.h:33
Virtual AlphabetIndex2 for proteic alphabet.
std::shared_ptr< const Alphabet > getAlphabet() const override
Get the alphabet associated to this index.
This alphabet is used to deal NumericAlphabet.