-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathScoreMatrix.h
51 lines (44 loc) · 1.17 KB
/
ScoreMatrix.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#ifndef SCORE_MATRIX_H
#define SCORE_MATRIX_H
#include <string>
#include <fstream>
#include <map>
#include <vector>
#define UNKNOWN_SCORE -4
using namespace std;
// Class for loading and accessing substitution scoring matrices
class ScoreMatrix {
public:
/**
* Load scoring matrix from a file in csv format
*/
bool loadFromFile(string filename);
/**
* Set all relevant alignment penalties
*/
void setPenalties(double gapPenalty, double boundaryFsPenalty,
double exonFsStopPenalty);
/**
* Return score of a specified amino acid pair
*/
double getScore(char a, char b, bool boundaryFrameshift = false) const;
/**
* Return maximum score of an amino acid pair in the matrix
*/
double getMaxScore() const;
void print() const;
private:
map<char, map<char, double> > matrix;
ifstream inputStream;
int size;
vector<char> columnHeaders;
bool readColumnHeaders();
bool readRow();
void processLine(string & line);
void computeMaxScore();
double maxScore;
double gapPenalty;
double boundaryFsPenalty;
double exonFsStopPenalty;
};
#endif /* SCORE_MATRIX_H */