1 | #include "muscle.h" |
---|
2 | #include "profile.h" |
---|
3 | |
---|
4 | // Original: |
---|
5 | //HYDROPHILIC_CONTEXT 0 6 -0.3969495574 |
---|
6 | //HYDROPHILIC_CONTEXT 1 6 -0.9407126603 |
---|
7 | //HYDROPHILIC_CONTEXT 2 6 -0.4968150972 |
---|
8 | //HYDROPHILIC_CONTEXT 3 6 -0.271646023 |
---|
9 | //HYDROPHILIC_CONTEXT 4 6 0.006990406416 |
---|
10 | //HYDROPHILIC_CONTEXT 5 6 0.1381111256 |
---|
11 | //HYDROPHILIC_CONTEXT 6 6 0.2541439872 |
---|
12 | |
---|
13 | // Blosum62: |
---|
14 | //HYDROPHILIC_CONTEXT 0 6 -0.2448419585 |
---|
15 | //HYDROPHILIC_CONTEXT 1 6 -0.8734889946 |
---|
16 | //HYDROPHILIC_CONTEXT 2 6 -0.5724336598 |
---|
17 | //HYDROPHILIC_CONTEXT 3 6 -0.2670439975 |
---|
18 | //HYDROPHILIC_CONTEXT 4 6 0.004844647323 |
---|
19 | //HYDROPHILIC_CONTEXT 5 6 0.1812057148 |
---|
20 | //HYDROPHILIC_CONTEXT 6 6 0.1036540864 |
---|
21 | |
---|
22 | static SCORE Factors[7] = |
---|
23 | { |
---|
24 | (SCORE) -0.2448419585, |
---|
25 | (SCORE) -0.8734889946, |
---|
26 | (SCORE) -0.5724336598, |
---|
27 | (SCORE) -0.2670439975, |
---|
28 | (SCORE) 0.004844647323, |
---|
29 | (SCORE) 0.1812057148, |
---|
30 | (SCORE) 0.1036540864 |
---|
31 | }; |
---|
32 | |
---|
33 | static bool Hydrophilic[20] = |
---|
34 | { |
---|
35 | false, // A |
---|
36 | false, // C |
---|
37 | true, // D |
---|
38 | true, // E |
---|
39 | false, // F |
---|
40 | true, // G |
---|
41 | false, // H |
---|
42 | false, // I |
---|
43 | true, // K |
---|
44 | false, // L |
---|
45 | false, // M |
---|
46 | true, // N |
---|
47 | true, // P |
---|
48 | true, // Q |
---|
49 | true, // R |
---|
50 | true, // S |
---|
51 | false, // T |
---|
52 | false, // V |
---|
53 | false, // Y |
---|
54 | false, // W |
---|
55 | }; |
---|
56 | |
---|
57 | bool IsHydrophilic(const FCOUNT fcCounts[]) |
---|
58 | { |
---|
59 | for (unsigned uLetter = 0; uLetter < 20; ++uLetter) |
---|
60 | if (fcCounts[uLetter] > 0.0 && Hydrophilic[uLetter]) |
---|
61 | return false; |
---|
62 | return true; |
---|
63 | } |
---|
64 | |
---|
65 | static double HydrophilicFraction(const FCOUNT fcCounts[]) |
---|
66 | { |
---|
67 | double TotalAll = 0.0; |
---|
68 | double TotalHydrophilic = 0.0; |
---|
69 | for (unsigned uLetter = 0; uLetter < 20; ++uLetter) |
---|
70 | { |
---|
71 | FCOUNT Freq = fcCounts[uLetter]; |
---|
72 | TotalAll += Freq; |
---|
73 | if (Hydrophilic[uLetter]) |
---|
74 | TotalHydrophilic += Freq; |
---|
75 | } |
---|
76 | return TotalHydrophilic / TotalAll; |
---|
77 | } |
---|
78 | |
---|
79 | void TomHydro(ProfPos *Prof, unsigned uLength) |
---|
80 | { |
---|
81 | if (ALPHA_Amino != g_Alpha) |
---|
82 | return; |
---|
83 | if (uLength < 6) |
---|
84 | return; |
---|
85 | |
---|
86 | for (unsigned uColIndex = 3; uColIndex < uLength - 2; ++uColIndex) |
---|
87 | { |
---|
88 | // 6-residue window: |
---|
89 | // xxxxxx |
---|
90 | // AARNCARNGTAGCATNAC |
---|
91 | // AARN----------TNAC |
---|
92 | |
---|
93 | double dCount = 0.0; |
---|
94 | for (unsigned uColIndexW = uColIndex - 3; uColIndexW < uColIndex + 3; |
---|
95 | ++uColIndexW) |
---|
96 | { |
---|
97 | const ProfPos &PP = Prof[uColIndexW]; |
---|
98 | dCount += HydrophilicFraction(PP.m_fcCounts); |
---|
99 | } |
---|
100 | // Round to nearest integer |
---|
101 | unsigned uCount = (unsigned) (dCount + 0.5); |
---|
102 | if (uCount > 6) |
---|
103 | uCount = 6; |
---|
104 | SCORE dFactor = Factors[uCount]; |
---|
105 | ProfPos &PP = Prof[uColIndex]; |
---|
106 | PP.m_scoreGapOpen += dFactor; |
---|
107 | PP.m_scoreGapClose += dFactor; |
---|
108 | } |
---|
109 | } |
---|