1 /* -*- mode: c; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */
3 /*********************************************************************
4 * Clustal Omega - Multiple sequence alignment
6 * Copyright (C) 2010 University College Dublin
8 * Clustal-Omega is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License as
10 * published by the Free Software Foundation; either version 2 of the
11 * License, or (at your option) any later version.
13 * This file is part of Clustal-Omega.
15 ********************************************************************/
18 * RCS $Id: hhmatrices-C.h 199 2011-02-21 18:24:49Z fabian $
21 // Substitution matrices and their background frequencies
23 // The following background frequencies were calculated by the formula pa = (P[a,b]/(pa*pb))^(-1) * (1,...,1)
24 // For the Blousum50-matrix this becomes pb[a]= SUM_(b=1,20) (2^(BLOSUM50[a,b]/3))^(-1)
25 // A R N D C Q E G H I L K M F P S T W Y V
26 // Gonnet 7.68,5.14,4.02,5.41,1.89,3.27,5.99,7.56,3.69,5.06,10.01,5.97,2.20,3.50,4.54,4.67,7.12,1.25,3.95,7.28
27 // BLOSUM50 8.24,6.24,4.46,4.77,2.03,2.90,6.78,6.69,2.53,6.89,10.7 ,5.04,1.49,4.93,3.97,5.95,6.13,1.34,3.45,6.28
29 const float Gonnet[]={
30 // A R N D C Q E G H I L K M F P S T W Y V
31 10227, 3430, 2875, 3869, 1625, 2393, 4590, 6500, 2352, 3225, 5819, 4172, 1435, 1579, 3728, 4610, 6264, 418, 1824, 5709, // A
32 3430, 7780, 2209, 2589, 584, 2369, 3368, 3080, 2173, 1493, 3093, 5701, 763, 859, 1893, 2287, 3487, 444, 1338, 2356, // R
33 2875, 2209, 3868, 3601, 501, 1541, 2956, 3325, 1951, 1065, 2012, 2879, 532, 688, 1480, 2304, 3204, 219, 1148, 1759, // N
34 3869, 2589, 3601, 8618, 488, 2172, 6021, 4176, 2184, 1139, 2151, 3616, 595, 670, 2086, 2828, 3843, 204, 1119, 2015, // D
35 1625, 584, 501, 488, 5034, 355, 566, 900, 516, 741, 1336, 591, 337, 549, 419, 901, 1197, 187, 664, 1373, // C
36 2393, 2369, 1541, 2172, 355, 1987, 2891, 1959, 1587, 1066, 2260, 2751, 570, 628, 1415, 1595, 2323, 219, 871, 1682, // Q
37 4590, 3368, 2956, 6021, 566, 2891, 8201, 3758, 2418, 1624, 3140, 4704, 830, 852, 2418, 2923, 4159, 278, 1268, 2809, // E
38 6500, 3080, 3325, 4176, 900, 1959, 3758,26066, 2016, 1354, 2741, 3496, 741, 797, 2369, 3863, 4169, 375, 1186, 2569, // G
39 2352, 2173, 1951, 2184, 516, 1587, 2418, 2016, 5409, 1123, 2380, 2524, 600, 1259, 1298, 1642, 2446, 383, 876, 1691, // H
40 3225, 1493, 1065, 1139, 741, 1066, 1624, 1354, 1123, 6417, 9630, 1858, 1975, 2225, 1260, 1558, 3131, 417, 1697, 7504, // I
41 5819, 3093, 2012, 2151, 1336, 2260, 3140, 2741, 2380, 9630,25113, 3677, 4187, 5540, 2670, 2876, 5272, 1063, 3945,11005, // L
42 4172, 5701, 2879, 3616, 591, 2751, 4704, 3496, 2524, 1858, 3677, 7430, 949, 975, 2355, 2847, 4340, 333, 1451, 2932, // K
43 1435, 763, 532, 595, 337, 570, 830, 741, 600, 1975, 4187, 949, 1300, 1111, 573, 743, 1361, 218, 828, 2310, // M
44 1579, 859, 688, 670, 549, 628, 852, 797, 1259, 2225, 5540, 975, 1111, 6126, 661, 856, 1498, 1000, 4464, 2602, // F
45 3728, 1893, 1480, 2086, 419, 1415, 2418, 2369, 1298, 1260, 2670, 2355, 573, 661,11834, 2320, 3300, 179, 876, 2179, // P
46 4610, 2287, 2304, 2828, 901, 1595, 2923, 3863, 1642, 1558, 2876, 2847, 743, 856, 2320, 3611, 4686, 272, 1188, 2695, // S
47 6264, 3487, 3204, 3843, 1197, 2323, 4159, 4169, 2446, 3131, 5272, 4340, 1361, 1498, 3300, 4686, 8995, 397, 1812, 5172, // T
48 418, 444, 219, 204, 187, 219, 278, 375, 383, 417, 1063, 333, 218, 1000, 179, 272, 397, 4101, 1266, 499, // W
49 1824, 1338, 1148, 1119, 664, 871, 1268, 1186, 876, 1697, 3945, 1451, 828, 4464, 876, 1188, 1812, 1266, 9380, 2227, // Y
50 5709, 2356, 1759, 2015, 1373, 1682, 2809, 2569, 1691, 7504,11005, 2932, 2310, 2602, 2179, 2695, 5172, 499, 2227,11569};// V
52 const float Blosum30[]= {
53 // A R N D C Q E G H I L K M F P S T W Y V
57 0.0043,0.0026,0.0027,0.0095,
58 0.0014,0.0011,0.0010,0.0010,0.0070,
59 0.0031,0.0031,0.0014,0.0018,0.0007,0.0039,
60 0.0044,0.0031,0.0024,0.0037,0.0018,0.0028,0.0094,
61 0.0052,0.0032,0.0032,0.0035,0.0011,0.0020,0.0035,0.0173,
62 0.0016,0.0014,0.0011,0.0011,0.0004,0.0010,0.0018,0.0015,0.0060,
63 0.0040,0.0022,0.0024,0.0018,0.0012,0.0016,0.0023,0.0036,0.0012,0.0072,
64 0.0056,0.0039,0.0032,0.0043,0.0023,0.0027,0.0051,0.0051,0.0022,0.0066,0.0139,
65 0.0044,0.0043,0.0027,0.0032,0.0010,0.0021,0.0053,0.0039,0.0013,0.0026,0.0044,0.0063,
66 0.0018,0.0012,0.0009,0.0008,0.0004,0.0007,0.0012,0.0013,0.0008,0.0014,0.0027,0.0017,0.0012,
67 0.0027,0.0023,0.0017,0.0011,0.0008,0.0010,0.0016,0.0022,0.0008,0.0027,0.0055,0.0023,0.0008,0.0077,
68 0.0028,0.0021,0.0012,0.0021,0.0007,0.0015,0.0030,0.0030,0.0014,0.0017,0.0027,0.0029,0.0005,0.0011,0.0091,
69 0.0056,0.0035,0.0028,0.0034,0.0013,0.0021,0.0038,0.0051,0.0017,0.0033,0.0047,0.0042,0.0010,0.0027,0.0024,0.0075,
70 0.0040,0.0019,0.0024,0.0024,0.0009,0.0016,0.0023,0.0028,0.0010,0.0027,0.0046,0.0025,0.0010,0.0016,0.0020,0.0041,0.0046,
71 0.0005,0.0007,0.0002,0.0004,0.0003,0.0004,0.0007,0.0011,0.0002,0.0005,0.0009,0.0006,0.0002,0.0007,0.0004,0.0005,0.0003,0.0027,
72 0.0014,0.0022,0.0008,0.0015,0.0004,0.0011,0.0016,0.0016,0.0010,0.0018,0.0045,0.0017,0.0007,0.0024,0.0011,0.0017,0.0014,0.0009,0.0044,
73 0.0056,0.0031,0.0022,0.0027,0.0012,0.0015,0.0026,0.0033,0.0012,0.0063,0.0074,0.0030,0.0015,0.0032,0.0017,0.0036,0.0036,0.0005,0.0024,0.0083};
75 const float Blosum40[]= {
76 // A R N D C Q E G H I L K M F P S T W Y V
80 0.0032,0.0021,0.0031,0.0126,
81 0.0015,0.0007,0.0007,0.0009,0.0093,
82 0.0026,0.0024,0.0017,0.0016,0.0004,0.0048,
83 0.0040,0.0026,0.0023,0.0048,0.0010,0.0032,0.0118,
84 0.0066,0.0023,0.0035,0.0031,0.0012,0.0020,0.0028,0.0260,
85 0.0014,0.0012,0.0013,0.0014,0.0003,0.0010,0.0015,0.0014,0.0060,
86 0.0037,0.0017,0.0017,0.0016,0.0008,0.0012,0.0018,0.0024,0.0009,0.0105,
87 0.0050,0.0030,0.0021,0.0027,0.0015,0.0023,0.0036,0.0034,0.0017,0.0082,0.0209,
88 0.0041,0.0051,0.0027,0.0030,0.0010,0.0026,0.0045,0.0035,0.0013,0.0023,0.0037,0.0099,
89 0.0017,0.0010,0.0007,0.0007,0.0003,0.0007,0.0010,0.0013,0.0007,0.0018,0.0037,0.0012,0.0018,
90 0.0022,0.0016,0.0013,0.0013,0.0008,0.0008,0.0015,0.0021,0.0009,0.0031,0.0055,0.0018,0.0011,0.0105,
91 0.0027,0.0014,0.0014,0.0019,0.0005,0.0013,0.0026,0.0028,0.0008,0.0020,0.0021,0.0023,0.0007,0.0010,0.0151,
92 0.0060,0.0025,0.0030,0.0030,0.0013,0.0026,0.0034,0.0052,0.0013,0.0025,0.0034,0.0034,0.0011,0.0019,0.0022,0.0089,
93 0.0040,0.0019,0.0022,0.0024,0.0011,0.0015,0.0025,0.0029,0.0009,0.0028,0.0039,0.0029,0.0011,0.0019,0.0022,0.0043,0.0070,
94 0.0007,0.0005,0.0003,0.0003,0.0001,0.0004,0.0005,0.0008,0.0002,0.0005,0.0009,0.0005,0.0002,0.0008,0.0003,0.0004,0.0003,0.0045,
95 0.0019,0.0016,0.0010,0.0011,0.0004,0.0010,0.0014,0.0017,0.0012,0.0020,0.0031,0.0017,0.0010,0.0032,0.0009,0.0015,0.0014,0.0008,0.0060,
96 0.0054,0.0023,0.0017,0.0022,0.0012,0.0014,0.0025,0.0028,0.0008,0.0083,0.0082,0.0027,0.0018,0.0031,0.0018,0.0032,0.0040,0.0005,0.0020,0.0113};
98 const float Blosum50[]= {
99 // A R N D C Q E G H I L K M F P S T W Y V
102 0.0024,0.0020,0.0101,
103 0.0026,0.0019,0.0035,0.0161,
104 0.0015,0.0005,0.0006,0.0005,0.0091,
105 0.0022,0.0025,0.0016,0.0017,0.0004,0.0057,
106 0.0034,0.0029,0.0023,0.0048,0.0006,0.0033,0.0141,
107 0.0062,0.0020,0.0031,0.0028,0.0009,0.0017,0.0023,0.0316,
108 0.0012,0.0013,0.0015,0.0011,0.0003,0.0010,0.0013,0.0011,0.0064,
109 0.0035,0.0015,0.0013,0.0012,0.0008,0.0011,0.0015,0.0018,0.0007,0.0140,
110 0.0048,0.0028,0.0017,0.0018,0.0014,0.0019,0.0026,0.0027,0.0013,0.0104,0.0304,
111 0.0033,0.0064,0.0027,0.0026,0.0006,0.0029,0.0043,0.0028,0.0014,0.0017,0.0027,0.0130,
112 0.0016,0.0009,0.0007,0.0005,0.0004,0.0008,0.0008,0.0009,0.0005,0.0022,0.0042,0.0010,0.0029,
113 0.0020,0.0012,0.0009,0.0008,0.0006,0.0007,0.0012,0.0015,0.0009,0.0030,0.0058,0.0012,0.0012,0.0154,
114 0.0022,0.0011,0.0011,0.0015,0.0004,0.0011,0.0019,0.0019,0.0006,0.0013,0.0017,0.0018,0.0005,0.0007,0.0171,
115 0.0062,0.0025,0.0032,0.0028,0.0011,0.0022,0.0030,0.0044,0.0012,0.0021,0.0029,0.0031,0.0010,0.0016,0.0018,0.0111,
116 0.0039,0.0021,0.0026,0.0022,0.0010,0.0015,0.0024,0.0025,0.0009,0.0029,0.0038,0.0026,0.0011,0.0015,0.0016,0.0047,0.0100,
117 0.0005,0.0004,0.0002,0.0002,0.0001,0.0003,0.0004,0.0005,0.0002,0.0005,0.0008,0.0004,0.0003,0.0009,0.0002,0.0003,0.0004,0.0059,
118 0.0015,0.0013,0.0009,0.0009,0.0004,0.0009,0.0012,0.0012,0.0013,0.0018,0.0027,0.0013,0.0007,0.0039,0.0006,0.0013,0.0012,0.0008,0.0077,
119 0.0054,0.0020,0.0015,0.0016,0.0013,0.0014,0.0020,0.0022,0.0007,0.0107,0.0092,0.0022,0.0021,0.0030,0.0016,0.0029,0.0041,0.0005,0.0018,0.0164};
121 const float Blosum65[]= {
122 // A R N D C Q E G H I L K M F P S T W Y V
125 0.0019,0.0019,0.0148,
126 0.0021,0.0015,0.0037,0.0225,
127 0.0016,0.0004,0.0004,0.0004,0.0127,
128 0.0018,0.0024,0.0015,0.0016,0.0003,0.0076,
129 0.0029,0.0025,0.0021,0.0049,0.0003,0.0034,0.0168,
130 0.0057,0.0016,0.0027,0.0024,0.0007,0.0013,0.0018,0.0396,
131 0.0010,0.0013,0.0014,0.0009,0.0002,0.0010,0.0013,0.0009,0.0096,
132 0.0031,0.0012,0.0009,0.0011,0.0012,0.0008,0.0012,0.0013,0.0006,0.0191,
133 0.0043,0.0023,0.0013,0.0014,0.0016,0.0016,0.0019,0.0020,0.0009,0.0115,0.0388,
134 0.0032,0.0062,0.0024,0.0024,0.0005,0.0030,0.0040,0.0024,0.0012,0.0015,0.0024,0.0166,
135 0.0013,0.0007,0.0005,0.0004,0.0004,0.0007,0.0006,0.0007,0.0003,0.0025,0.0052,0.0008,0.0045,
136 0.0016,0.0009,0.0007,0.0007,0.0005,0.0005,0.0008,0.0011,0.0008,0.0030,0.0056,0.0009,0.0012,0.0186,
137 0.0021,0.0009,0.0008,0.0011,0.0003,0.0008,0.0014,0.0013,0.0005,0.0009,0.0013,0.0015,0.0004,0.0005,0.0195,
138 0.0065,0.0022,0.0030,0.0027,0.0011,0.0018,0.0029,0.0037,0.0011,0.0017,0.0024,0.0030,0.0008,0.0012,0.0016,0.0137,
139 0.0037,0.0017,0.0022,0.0019,0.0009,0.0013,0.0021,0.0022,0.0007,0.0027,0.0033,0.0023,0.0010,0.0012,0.0013,0.0048,0.0133,
140 0.0004,0.0003,0.0002,0.0001,0.0002,0.0002,0.0002,0.0004,0.0002,0.0004,0.0007,0.0003,0.0002,0.0009,0.0001,0.0003,0.0003,0.0074,
141 0.0013,0.0009,0.0007,0.0006,0.0004,0.0006,0.0008,0.0008,0.0016,0.0015,0.0023,0.0010,0.0006,0.0043,0.0004,0.0010,0.0009,0.0010,0.0113,
142 0.0049,0.0015,0.0011,0.0012,0.0014,0.0011,0.0016,0.0017,0.0006,0.0120,0.0094,0.0019,0.0023,0.0025,0.0012,0.0023,0.0035,0.0004,0.0015,0.0206};
145 const float Blosum80[]= {
146 // A R N D C Q E G H I L K M F P S T W Y V
149 0.0016,0.0017,0.0166,
150 0.0018,0.0013,0.0037,0.0262,
151 0.0015,0.0003,0.0004,0.0003,0.0172,
152 0.0017,0.0024,0.0014,0.0014,0.0003,0.0094,
153 0.0028,0.0023,0.0019,0.0048,0.0003,0.0035,0.0208,
154 0.0053,0.0015,0.0025,0.0022,0.0006,0.0011,0.0017,0.0463,
155 0.0009,0.0012,0.0012,0.0008,0.0002,0.0011,0.0012,0.0008,0.0104,
156 0.0027,0.0010,0.0007,0.0008,0.0011,0.0007,0.0010,0.0009,0.0004,0.0220,
157 0.0036,0.0018,0.0011,0.0011,0.0014,0.0014,0.0015,0.0016,0.0008,0.0111,0.0442,
158 0.0029,0.0061,0.0022,0.0020,0.0004,0.0028,0.0036,0.0020,0.0010,0.0012,0.0019,0.0190,
159 0.0011,0.0006,0.0004,0.0003,0.0004,0.0007,0.0006,0.0005,0.0003,0.0025,0.0052,0.0007,0.0053,
160 0.0014,0.0007,0.0006,0.0006,0.0005,0.0005,0.0006,0.0009,0.0007,0.0027,0.0052,0.0007,0.0010,0.0211,
161 0.0021,0.0009,0.0007,0.0009,0.0003,0.0007,0.0012,0.0010,0.0004,0.0007,0.0012,0.0012,0.0003,0.0004,0.0221,
162 0.0064,0.0020,0.0029,0.0024,0.0010,0.0017,0.0026,0.0034,0.0010,0.0015,0.0021,0.0026,0.0007,0.0010,0.0014,0.0167,
163 0.0036,0.0015,0.0020,0.0016,0.0009,0.0012,0.0019,0.0019,0.0007,0.0024,0.0028,0.0020,0.0009,0.0011,0.0011,0.0048,0.0156,
164 0.0003,0.0002,0.0001,0.0001,0.0001,0.0002,0.0002,0.0003,0.0001,0.0003,0.0006,0.0002,0.0002,0.0007,0.0001,0.0002,0.0002,0.0087,
165 0.0011,0.0007,0.0006,0.0005,0.0003,0.0005,0.0006,0.0006,0.0016,0.0013,0.0020,0.0008,0.0005,0.0046,0.0003,0.0009,0.0008,0.0010,0.0148,
166 0.0046,0.0013,0.0009,0.0010,0.0013,0.0010,0.0015,0.0014,0.0005,0.0123,0.0089,0.0015,0.0022,0.0022,0.0010,0.0021,0.0033,0.0004,0.0012,0.0246};
169 // prediction accuracy of Psipred:
170 // Ppred[cf][B][A] = P(A,B,cf)/P(A)/P(B,cf) = P(A|B,cf)/P(A)
171 // A = observed ss state B = predicted ss state cf = confidence value of prediction
172 //float Ppred[MAXCF][NSSPRED][NDSSP]=
175 //pred/obs - H E ~ S T G B
176 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000 , // - conf=-
177 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000 , // H
178 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000 , // E
179 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000 , // ~
180 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000 , // - conf=0
181 1.000, 1.128, 0.519, 0.834, 0.957, 1.488, 2.106, 1.085 , // H
182 1.000, 0.233, 2.240, 1.216, 0.913, 0.519, 0.923, 1.759 , // E
183 1.000, 0.640, 1.017, 1.122, 1.069, 1.242, 2.140, 1.999 , // ~
184 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000 , // - conf=1
185 1.000, 1.251, 0.485, 0.771, 0.847, 1.371, 2.266, 0.864 , // H
186 1.000, 0.222, 2.542, 1.069, 0.804, 0.428, 0.671, 1.728 , // E
187 1.000, 0.474, 1.103, 1.295, 1.232, 1.214, 1.835, 1.989 , // ~
188 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000 , // - conf=2
189 1.000, 1.383, 0.426, 0.637, 0.778, 1.349, 2.436, 0.824 , // H
190 1.000, 0.202, 2.769, 0.999, 0.714, 0.320, 0.551, 1.566 , // E
191 1.000, 0.395, 1.005, 1.407, 1.376, 1.336, 1.725, 2.063 , // ~
192 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000 , // - conf=3
193 1.000, 1.531, 0.369, 0.552, 0.682, 1.280, 2.420, 0.698 , // H
194 1.000, 0.169, 2.970, 0.954, 0.556, 0.273, 0.489, 1.504 , // E
195 1.000, 0.352, 0.843, 1.515, 1.542, 1.456, 1.684, 1.958 , // ~
196 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000 , // - conf=4
197 1.000, 1.750, 0.305, 0.444, 0.537, 1.134, 2.295, 0.600 , // H
198 1.000, 0.124, 3.179, 0.847, 0.513, 0.228, 0.413, 1.897 , // E
199 1.000, 0.282, 0.718, 1.664, 1.630, 1.577, 1.625, 1.877 , // ~
200 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000 , // - conf=5
201 1.000, 1.952, 0.250, 0.353, 0.456, 0.982, 2.050, 0.466 , // H
202 1.000, 0.102, 3.464, 0.699, 0.453, 0.174, 0.284, 1.357 , // E
203 1.000, 0.227, 0.574, 1.782, 1.846, 1.681, 1.418, 1.885 , // ~
204 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000 , // - conf=6
205 1.000, 2.183, 0.171, 0.263, 0.319, 0.792, 1.933, 0.345 , // H
206 1.000, 0.079, 3.712, 0.612, 0.281, 0.133, 0.196, 1.089 , // E
207 1.000, 0.173, 0.458, 1.915, 2.007, 1.766, 1.220, 1.704 , // ~
208 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000 , // - conf=7
209 1.000, 2.389, 0.132, 0.192, 0.224, 0.605, 1.605, 0.183 , // H
210 1.000, 0.053, 3.997, 0.449, 0.201, 0.072, 0.141, 0.919 , // E
211 1.000, 0.109, 0.328, 2.013, 2.304, 1.882, 0.960, 1.512 , // ~
212 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000 , // - conf=8
213 1.000, 2.668, 0.065, 0.098, 0.144, 0.354, 1.059, 0.102 , // H
214 1.000, 0.029, 4.285, 0.284, 0.113, 0.044, 0.059, 0.522 , // E
215 1.000, 0.053, 0.200, 2.099, 2.444, 2.133, 0.671, 1.290 , // ~
216 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000 , // - conf=9
217 1.000, 2.966, 0.009, 0.023, 0.036, 0.113, 0.214, 0.017 , // H
218 1.000, 0.010, 4.555, 0.119, 0.027, 0.010, 0.013, 0.209 , // E
219 1.000, 0.026, 0.101, 2.576, 1.853, 2.204, 0.308, 0.499 // ~
224 // //pred/obs - H E ~ S T G B
225 // 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000 , // - conf=-
226 // 1.000, 2.000, 0.500, 1.000, 1.000, 1.000, 1.000, 0.500, // H
227 // 1.000, 0.500, 2.000, 0.500, 1.000, 1.000, 0.500, 1.000, // E
228 // 1.000, 1.000, 1.000, 2.000, 2.000, 2.000, 1.000, 1.000, // ~
229 // 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000 , // - conf=0
230 // 1.000, 2.000, 0.500, 1.000, 1.000, 1.000, 1.000, 0.500, // H
231 // 1.000, 0.500, 2.000, 0.500, 1.000, 1.000, 0.500, 1.000, // E
232 // 1.000, 1.000, 1.000, 2.000, 2.000, 2.000, 1.000, 1.000, // ~
233 // 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000 , // - conf=1
234 // 1.000, 2.000, 0.500, 1.000, 1.000, 1.000, 1.000, 0.500, // H
235 // 1.000, 0.500, 2.000, 0.500, 1.000, 1.000, 0.500, 1.000, // E
236 // 1.000, 1.000, 1.000, 2.000, 2.000, 2.000, 1.000, 1.000, // ~
237 // 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000 , // - conf=2
238 // 1.000, 2.000, 0.500, 1.000, 1.000, 1.000, 1.000, 0.500, // H
239 // 1.000, 0.500, 2.000, 0.500, 1.000, 1.000, 0.500, 1.000, // E
240 // 1.000, 1.000, 1.000, 2.000, 2.000, 2.000, 1.000, 1.000, // ~
241 // 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000 , // - conf=3
242 // 1.000, 2.000, 0.500, 1.000, 1.000, 1.000, 1.000, 0.500, // H
243 // 1.000, 0.500, 2.000, 0.500, 1.000, 1.000, 0.500, 1.000, // E
244 // 1.000, 1.000, 1.000, 2.000, 2.000, 2.000, 1.000, 1.000, // ~
245 // 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000 , // - conf=4
246 // 1.000, 2.000, 0.500, 1.000, 1.000, 1.000, 1.000, 0.500, // H
247 // 1.000, 0.500, 2.000, 0.500, 1.000, 1.000, 0.500, 1.000, // E
248 // 1.000, 1.000, 1.000, 2.000, 2.000, 2.000, 1.000, 1.000, // ~
249 // 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000 , // - conf=5
250 // 1.000, 2.000, 0.500, 1.000, 1.000, 1.000, 1.000, 0.500, // H
251 // 1.000, 0.500, 2.000, 0.500, 1.000, 1.000, 0.500, 1.000, // E
252 // 1.000, 1.000, 1.000, 2.000, 2.000, 2.000, 1.000, 1.000, // ~
253 // 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000 , // - conf=6
254 // 1.000, 2.000, 0.500, 1.000, 1.000, 1.000, 1.000, 0.500, // H
255 // 1.000, 0.500, 2.000, 0.500, 1.000, 1.000, 0.500, 1.000, // E
256 // 1.000, 1.000, 1.000, 2.000, 2.000, 2.000, 1.000, 1.000, // ~
257 // 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000 , // - conf=7
258 // 1.000, 2.000, 0.500, 1.000, 1.000, 1.000, 1.000, 0.500, // H
259 // 1.000, 0.500, 2.000, 0.500, 1.000, 1.000, 0.500, 1.000, // E
260 // 1.000, 1.000, 1.000, 2.000, 2.000, 2.000, 1.000, 1.000, // ~
261 // 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000 , // - conf=8
262 // 1.000, 2.000, 0.500, 1.000, 1.000, 1.000, 1.000, 0.500, // H
263 // 1.000, 0.500, 2.000, 0.500, 1.000, 1.000, 0.500, 1.000, // E
264 // 1.000, 1.000, 1.000, 2.000, 2.000, 2.000, 1.000, 1.000, // ~
265 // 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000 , // - conf=9
266 // 1.000, 2.000, 0.500, 1.000, 1.000, 1.000, 1.000, 0.500, // H
267 // 1.000, 0.500, 2.000, 0.500, 1.000, 1.000, 0.500, 1.000, // E
268 // 1.000, 1.000, 1.000, 2.000, 2.000, 2.000, 1.000, 1.000, // ~
271 float Pobs[]={0, 0.3268,0.2119,0.2061,0.0913,0.1143,0.0376,0.0120};
276 1.00, 0.00, 0.00, 0.00,
277 0.00, 0.94, 0.00, 0.04,
278 0.00, 0.00, 0.92, 0.04,
279 0.00, 0.06, 0.08, 0.92
282 //psipred accuracy for confidence values 0-9
283 const float p_acc[]={0.00,0.47,0.53,0.56,0.58,0.62,0.69,0.74,0.82,0.88,0.96};
289 SetBlosumMatrix(const float BlosumXX[])
292 if (v>=3) printf("Using the BLOSUM%2i matrix\n",par.matrix);
294 for (pb[a]=0.0f, b=0; b<=a; ++b,++n)
295 P[a][b] = BlosumXX[n];
297 for (b=a+1; b<20; ++b)
299 for (a=0; a<20; ++a) P[a][20]=P[20][a]=1.0f;
303 /////////////////////////////////////////////////////////////////////////////////////
305 * @brief Set (global variable) substitution matrix with derived matrices and background frequencies
308 SetSubstitutionMatrix()
314 case 0: //Gonnet matrix
315 if (v>=3) cout<<"Using the Gonnet matrix ";
317 for (pb[a]=0.0f, b=0; b<20; ++b)
318 P[a][b] = 0.000001f*Gonnet[a*20+b];
319 for (a=0; a<20; ++a) P[a][20]=P[20][a]=1.0f;
323 SetBlosumMatrix(Blosum30);
326 SetBlosumMatrix(Blosum40);
329 SetBlosumMatrix(Blosum50);
332 SetBlosumMatrix(Blosum65);
335 SetBlosumMatrix(Blosum80);
339 // Check transition probability matrix, renormalize P and calculate pb[a]
342 for (b=0; b<20; ++b) sumab+=P[a][b];
344 for (b=0; b<20; ++b) P[a][b]/=sumab;
346 for (pb[a]=0.0f, b=0; b<20; ++b) pb[a]+=P[a][b];
348 //Compute similarity matrix for amino acid pairs (for calculating consensus sequence)
351 Sim[a][b] = P[a][b]*P[a][b]/P[a][a]/P[b][b];
353 //Precompute matrix R for amino acid pseudocounts:
356 R[a][b] = P[a][b]/pb[b]; //R[a][b]=P(a|b)
358 //Precompute matrix R for amino acid pseudocounts:
361 S[a][b] = log2(R[a][b]/pb[a]); // S[a][b] = log2(P(a,b)/P(a)/P(b))
363 // Evaluate sequence identity underlying substitution matrix
368 float entropy_pb=0.0f;
370 for (a=0; a<20; ++a) id+=P[a][a];
371 for (a=0; a<20; ++a) entropy_pb-=pb[a]*log2(pb[a]);
375 entropy-=P[a][b]*log2(R[a][b]);
376 mut_info += P[a][b]*S[a][b];
379 printf(": sequence identity = %2.0f%%; entropy per column = %4.2f bits (out of %4.2f); mutual information = %4.2f bits\n",100*id,entropy,entropy_pb,mut_info);
382 if (v>=4) //Debugging: probability matrix and dissimilarity matrix
384 cout<<"Check matrix: before renormalization sum P(a,b)= "<<sumab<<"...\n";//PRINT
385 cout<<" A R N D C Q E G H I L K M F P S T W Y V\n";
387 for (a=0; a<20; a++) printf("%4.1f ",100*pb[a]);
388 cout<<endl<<"\nSubstitution matrix log2( P(a,b)/p(a)/p(b) ) (in bits):\n";
389 cout<<" A R N D C Q E G H I L K M F P S T W Y V\n";
393 for (a=0; a<20; a++) printf("%4.1f ",S[a][b]);
396 cout<<endl<<"\nOdds matrix P(a,b)/p(a)/p(b):\n";
397 cout<<" A R N D C Q E G H I L K M F P S T W Y V\n";
401 for (a=0; a<20; a++) printf("%4.1f ",P[b][a]/pb[a]/pb[b]);
404 cout<<endl<<"\nMatrix of conditional probabilities P(a|b) = P(a,b)/p(b) (in %):\n";
405 cout<<" A R N D C Q E G H I L K M F P S T W Y V\n";
409 for (a=0; a<20; a++) printf("%4.1f ",100*R[b][a]);
412 cout<<endl<<"\nProbability matrix P(a,b) (in %):\n";
413 cout<<" A R N D C Q E G H I L K M F P S T W Y V\n";
417 for (a=0; a<20; a++) printf("%5.0f ",1000000*P[b][a]);
420 cout<<endl<<"Similarity matrix P(a,b)^2/P(a,a,)/P(b,b) (in %):\n";
421 cout<<" A R N D C Q E G H I L K M F P S T W Y V\n";
425 for (a=0; a<20; a++) printf("%4.0f ",100*Sim[b][a]);
435 /////////////////////////////////////////////////////////////////////////////////////
437 * @brief Set secondary structure substitution matrix
440 SetSecStrucSubstitutionMatrix()
442 int A; //observed ss state (determined dssp)
443 int B,BB; //predicted ss states (by psipred)
444 int cf,ccf; //confidence value of prediction
445 float P73[NDSSP][NSSPRED][MAXCF]; //P73[cf][B][A] = P(A,B,cf)/P(A)/P(B,cf) = P(A|B,cf)/P(A)
448 // S73[A][B][cf][b] = score for matching observed ss state A in query with state B in template
449 // predicted with confidence cf, when query and template columns are diverged by b units
450 for (cf=0; cf<MAXCF; cf++)
451 for (A=0; A<NDSSP; A++)
452 for (B=0; B<NSSPRED; B++)
454 P73[A][B][cf] = 1.-par.ssa + par.ssa*Ppred[cf*NSSPRED*NDSSP + B*NDSSP + A];
455 S73[A][B][cf] = log2(P73[A][B][cf]);
458 for (B=0; B<NSSPRED; B++)
459 for (cf=0; cf<MAXCF; cf++)
460 for (BB=0; BB<NSSPRED; BB++)
461 for (ccf=0; ccf<MAXCF; ccf++)
464 for (A=1; A<NDSSP; A++)
465 sum += P73[A][B][cf] * P73[A][BB][ccf] * Pobs[A];
466 S33[B][cf][BB][ccf] = log2(sum);
468 } /* this is the end of SetSecStrucSubstitutionMatrix() */