-
Notifications
You must be signed in to change notification settings - Fork 4
/
CalculateFeatures.h
executable file
·145 lines (131 loc) · 7.29 KB
/
CalculateFeatures.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
/***********************************************
* # Copyright 2019-2020. Kuang Mengmeng
* # GPL version 3.0 applies.
* # Changed from MSAProbs 0.97.
* ************************************************/
#ifndef _CALCULATEFEATURES_H
#define _CALCULATEFEATURES_H
#include "SafeVector.h"
#include "MultiSequence.h"
#include "ScoreType.h"
#include "ProbabilisticModel.h"
#include <string>
using namespace std;
class CalculateFeatures
{
string features;
const string alphabet = "ARNDCQEGHILKMFPSTWYV";
const float BLOSUM62[20][20] =
{
{4, -1, -2, -2, 0, -1, -1, 0, -2, -1, -1, -1, -1, -2, -1, 1, 0, -3, -2, 0}, {-1, 5, 0, -2, -3, 1, 0, -2, 0, -3, -2, 2, -1, -3, -2, -1, -1, -3, -2, -3}, {-2, 0, 6, 1, -3, 0, 0, 0, 1, -3, -3, 0, -2, -3, -2, 1, 0, -4, -2, -3}, {-2, -2, 1, 6, -3, 0, 2, -1, -1, -3, -4, -1, -3, -3, -1, 0, -1, -4, -3, -3}, {0, -3, -3, -3, 9, -3, -4, -3, -3, -1, -1, -3, -1, -2, -3, -1, -1, -2, -2, -1}, {-1, 1, 0, 0, -3, 5, 2, -2, 0, -3, -2, 1, 0, -3, -1, 0, -1, -2, -1, -2}, {-1, 0, 0, 2, -4, 2, 5, -2, 0, -3, -3, 1, -2, -3, -1, 0, -1, -3, -2, -2}, {0, -2, 0, -1, -3, -2, -2, 6, -2, -4, -4, -2, -3, -3, -2, 0, -2, -2, -3, -3}, {-2, 0, 1, -1, -3, 0, 0, -2, 8, -3, -3, -1, -2, -1, -2, -1, -2, -2, 2, -3}, {-1, -3, -3, -3, -1, -3, -3, -4, -3, 4, 2, -3, 1, 0, -3, -2, -1, -3, -1, 3}, {-1, -2, -3, -4, -1, -2, -3, -4, -3, 2, 4, -2, 2, 0, -3, -2, -1, -2, -1, 1}, {-1, 2, 0, -1, -3, 1, 1, -2, -1, -3, -2, 5, -1, -3, -1, 0, -1, -3, -2, -2}, {-1, -1, -2, -3, -1, 0, -2, -3, -2, 1, 2, -1, 5, 0, -2, -1, -1, -1, -1, 1}, {-2, -3, -3, -3, -2, -3, -3, -3, -1, 0, 0, -3, 0, 6, -4, -2, -2, 1, 3, -1}, {-1, -2, -2, -1, -3, -1, -1, -2, -2, -3, -3, -1, -2, -4, 7, -1, -1, -4, -3, -2}, {1, -1, 1, 0, -1, 0, 0, 0, -1, -2, -2, 0, -1, -2, -1, 4, 1, -3, -2, -2}, {0, -1, 0, -1, -1, -1, -1, -2, -2, -1, -1, -1, -1, -2, -1, 1, 5, -2, -2, 0}, {-3, -3, -4, -4, -2, -2, -3, -2, -2, -3, -2, -3, -1, 1, -4, -3, -2, 11, 2, -3}, {-2, -2, -2, -3, -2, -1, -2, -3, 2, -1, -1, -2, -1, 3, -3, -2, -2, 2, 7, -1}, {0, -3, -3, -3, -1, -2, -2, -3, -3, 3, 1, -2, 1, -1, -2, -2, 0, -3, -1, 4}
};
const float emitPairs[20][20] = { {
0.02373072f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
0.0f, 0.0f
}, {
0.00244502f, 0.01775118f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
0.0f
}, {
0.00210228f, 0.00207782f, 0.01281864f, 0.0f, 0.0f, 0.0f, 0.0f,
0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
0.0f
}, {
0.00223549f, 0.00161657f, 0.00353540f, 0.01911178f, 0.0f,
0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
0.0f, 0.0f, 0.0f
}, {
0.00145515f, 0.00044701f, 0.00042479f,
0.00036798f, 0.01013470f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f
}, {
0.00219102f,
0.00253532f, 0.00158223f, 0.00176784f, 0.00032102f, 0.00756604f, 0.0f,
0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
0.0f
}, {
0.00332218f, 0.00268865f, 0.00224738f, 0.00496800f,
0.00037956f, 0.00345128f, 0.01676565f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f
}, {
0.00597898f,
0.00194865f, 0.00288882f, 0.00235249f, 0.00071206f, 0.00142432f,
0.00214860f, 0.04062876f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
0.0f, 0.0f, 0.0f, 0.0f, 0.0f
}, {
0.00114353f, 0.00132105f, 0.00141205f,
0.00097077f, 0.00026421f, 0.00113901f, 0.00131767f, 0.00103704f,
0.00867996f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
0.0f
},
{
0.00318853f, 0.00138145f, 0.00104273f, 0.00105355f, 0.00094040f,
0.00100883f, 0.00124207f, 0.00142520f, 0.00059716f, 0.01778263f,
0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f
}, {
0.00449576f, 0.00246811f, 0.00160275f, 0.00161966f, 0.00138494f,
0.00180553f, 0.00222063f, 0.00212853f, 0.00111754f, 0.01071834f,
0.03583921f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
0.0f
}, {
0.00331693f, 0.00595650f, 0.00257310f, 0.00252518f,
0.00046951f, 0.00312308f, 0.00428420f, 0.00259311f, 0.00121376f,
0.00157852f, 0.00259626f, 0.01612228f, 0.0f, 0.0f, 0.0f, 0.0f,
0.0f, 0.0f, 0.0f, 0.0f
}, {
0.00148878f, 0.00076734f,
0.00063401f, 0.00047808f, 0.00037421f, 0.00075546f, 0.00076105f,
0.00066504f, 0.00042237f, 0.00224097f, 0.00461939f, 0.00096120f,
0.00409522f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f
}, {
0.00165004f, 0.00090768f, 0.00084658f, 0.00069041f, 0.00052274f,
0.00059248f, 0.00078814f, 0.00115204f, 0.00072545f, 0.00279948f,
0.00533369f, 0.00087222f, 0.00116111f, 0.01661038f, 0.0f, 0.0f,
0.0f, 0.0f, 0.0f, 0.0f
}, {
0.00230618f, 0.00106268f,
0.00100282f, 0.00125381f, 0.00034766f, 0.00090111f, 0.00151550f,
0.00155601f, 0.00049078f, 0.00103767f, 0.00157310f, 0.00154836f,
0.00046718f, 0.00060701f, 0.01846071f, 0.0f, 0.0f, 0.0f, 0.0f,
0.0f
}, {
0.00631752f, 0.00224540f, 0.00301397f, 0.00285226f,
0.00094867f, 0.00191155f, 0.00293898f, 0.00381962f, 0.00116422f,
0.00173565f, 0.00250962f, 0.00312633f, 0.00087787f, 0.00119036f,
0.00180037f, 0.01346609f, 0.0f, 0.0f, 0.0f, 0.0f
}, {
0.00389995f, 0.00186053f, 0.00220144f, 0.00180488f, 0.00073798f,
0.00154526f, 0.00216760f, 0.00214841f, 0.00077747f, 0.00248968f,
0.00302273f, 0.00250862f, 0.00093371f, 0.00107595f, 0.00147982f,
0.00487295f, 0.01299436f, 0.0f, 0.0f, 0.0f
}, {
0.00039119f,
0.00029139f, 0.00021006f, 0.00016015f, 0.00010666f, 0.00020592f,
0.00023815f, 0.00038786f, 0.00019097f, 0.00039549f, 0.00076736f,
0.00028448f, 0.00016253f, 0.00085751f, 0.00015674f, 0.00026525f,
0.00024961f, 0.00563625f, 0.0f, 0.0f
}, {
0.00131840f,
0.00099430f, 0.00074960f, 0.00066005f, 0.00036626f, 0.00070192f,
0.00092548f, 0.00089301f, 0.00131038f, 0.00127857f, 0.00219713f,
0.00100817f, 0.00054105f, 0.00368739f, 0.00047608f, 0.00102648f,
0.00094759f, 0.00069226f, 0.00999315f, 0.0f
}, {
0.00533241f,
0.00169359f, 0.00136609f, 0.00127915f, 0.00119152f, 0.00132844f,
0.00178697f, 0.00194579f, 0.00071553f, 0.01117956f, 0.00914460f,
0.00210897f, 0.00197461f, 0.00256159f, 0.00135781f, 0.00241601f,
0.00343452f, 0.00038538f, 0.00148001f, 0.02075171f
}
};
public:
CalculateFeatures(MultiSequence *sequences, const ProbabilisticModel &model);
~CalculateFeatures();
string getFeatures()
{
return features;
}
string Calculation(MultiSequence *sequences, const ProbabilisticModel &model);
};
#endif