| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
#include <esl_config.h> |
| 9 |
#include <p7_config.h> |
| 10 |
#include "config.h" |
| 11 |
|
| 12 |
#include <math.h> |
| 13 |
#include <float.h> |
| 14 |
#include <string.h> |
| 15 |
#include <ctype.h> |
| 16 |
|
| 17 |
#include "easel.h" |
| 18 |
#include "esl_vectorops.h" |
| 19 |
|
| 20 |
#include "hmmer.h" |
| 21 |
|
| 22 |
#include "infernal.h" |
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
int |
| 31 |
p7_ProfileConfig5PrimeTrunc(P7_PROFILE *gm, int L) |
| 32 |
{ |
| 33 |
int status; |
| 34 |
int k; |
| 35 |
|
| 36 |
|
| 37 |
assert(! p7_IsLocal(gm->mode)); |
| 38 |
|
| 39 |
|
| 40 |
for (k = 1; k <= gm->M; k++) |
| 41 |
p7P_TSC(gm, k-1, p7P_BM) = log(1. / gm->M); |
| 42 |
|
| 43 |
|
| 44 |
|
| 45 |
|
| 46 |
|
| 47 |
gm->mode = p7_UNIGLOCAL; |
| 48 |
|
| 49 |
|
| 50 |
|
| 51 |
|
| 52 |
gm->xsc[p7P_N][p7P_MOVE] = gm->xsc[p7P_E][p7P_MOVE] = 0.0f; |
| 53 |
gm->xsc[p7P_N][p7P_LOOP] = gm->xsc[p7P_E][p7P_LOOP] = -eslINFINITY; |
| 54 |
|
| 55 |
|
| 56 |
|
| 57 |
gm->L = 0; |
| 58 |
if ((status = p7_ReconfigLength5PrimeTrunc(gm, L)) != eslOK) return status; |
| 59 |
|
| 60 |
return eslOK; |
| 61 |
} |
| 62 |
|
| 63 |
|
| 64 |
|
| 65 |
int |
| 66 |
p7_ProfileConfig3PrimeTrunc(const P7_HMM *hmm, P7_PROFILE *gm, int L) |
| 67 |
{ |
| 68 |
int status; |
| 69 |
int k; |
| 70 |
float Z; |
| 71 |
|
| 72 |
|
| 73 |
assert(! p7_IsLocal(gm->mode)); |
| 74 |
|
| 75 |
|
| 76 |
|
| 77 |
Z = log(hmm->t[0][p7H_MD]); |
| 78 |
p7P_TSC(gm, 0, p7P_BM) = log(1.0 - hmm->t[0][p7H_MD]); |
| 79 |
for (k = 1; k < hmm->M; k++) |
| 80 |
{ |
| 81 |
p7P_TSC(gm, k, p7P_BM) = Z + log(hmm->t[k][p7H_DM]); |
| 82 |
Z += log(hmm->t[k][p7H_DD]); |
| 83 |
} |
| 84 |
|
| 85 |
|
| 86 |
|
| 87 |
|
| 88 |
gm->mode = p7_UNILOCAL; |
| 89 |
|
| 90 |
|
| 91 |
|
| 92 |
|
| 93 |
gm->xsc[p7P_C][p7P_MOVE] = gm->xsc[p7P_E][p7P_MOVE] = 0.0f; |
| 94 |
gm->xsc[p7P_C][p7P_LOOP] = gm->xsc[p7P_E][p7P_LOOP] = -eslINFINITY; |
| 95 |
|
| 96 |
|
| 97 |
|
| 98 |
gm->L = 0; |
| 99 |
if ((status = p7_ReconfigLength3PrimeTrunc(gm, L)) != eslOK) return status; |
| 100 |
|
| 101 |
return eslOK; |
| 102 |
} |
| 103 |
|
| 104 |
|
| 105 |
|
| 106 |
int |
| 107 |
p7_ProfileConfig5PrimeAnd3PrimeTrunc(P7_PROFILE *gm, int L) |
| 108 |
{ |
| 109 |
assert(gm->mode == p7_LOCAL); |
| 110 |
|
| 111 |
|
| 112 |
|
| 113 |
|
| 114 |
gm->xsc[p7P_N][p7P_MOVE] = gm->xsc[p7P_C][p7P_MOVE] = gm->xsc[p7P_E][p7P_MOVE] = 0.0f; |
| 115 |
gm->xsc[p7P_N][p7P_LOOP] = gm->xsc[p7P_C][p7P_LOOP] = gm->xsc[p7P_E][p7P_LOOP] = -eslINFINITY; |
| 116 |
gm->nj = 0.0f; |
| 117 |
gm->L = L; |
| 118 |
gm->mode = p7_UNILOCAL; |
| 119 |
|
| 120 |
|
| 121 |
return eslOK; |
| 122 |
} |
| 123 |
|
| 124 |
|
| 125 |
|
| 126 |
int |
| 127 |
p7_ReconfigLength5PrimeTrunc(P7_PROFILE *gm, int L) |
| 128 |
{ |
| 129 |
float ploop, pmove; |
| 130 |
|
| 131 |
|
| 132 |
|
| 133 |
|
| 134 |
|
| 135 |
assert(gm->mode == p7_UNIGLOCAL); |
| 136 |
|
| 137 |
|
| 138 |
|
| 139 |
|
| 140 |
pmove = (1.0f + gm->nj) / ((float) L + 1.0f + gm->nj); |
| 141 |
ploop = 1.0f - pmove; |
| 142 |
gm->xsc[p7P_C][p7P_LOOP] = gm->xsc[p7P_J][p7P_LOOP] = log(ploop); |
| 143 |
gm->xsc[p7P_C][p7P_MOVE] = gm->xsc[p7P_J][p7P_MOVE] = log(pmove); |
| 144 |
gm->L = L; |
| 145 |
return eslOK; |
| 146 |
} |
| 147 |
|
| 148 |
|
| 149 |
|
| 150 |
|
| 151 |
int |
| 152 |
p7_ReconfigLength3PrimeTrunc(P7_PROFILE *gm, int L) |
| 153 |
{ |
| 154 |
float ploop, pmove; |
| 155 |
|
| 156 |
|
| 157 |
|
| 158 |
|
| 159 |
|
| 160 |
assert(gm->mode == p7_UNILOCAL); |
| 161 |
|
| 162 |
|
| 163 |
|
| 164 |
|
| 165 |
pmove = (1.0f + gm->nj) / ((float) L + 1.0f + gm->nj); |
| 166 |
ploop = 1.0f - pmove; |
| 167 |
gm->xsc[p7P_N][p7P_LOOP] = gm->xsc[p7P_J][p7P_LOOP] = log(ploop); |
| 168 |
gm->xsc[p7P_N][p7P_MOVE] = gm->xsc[p7P_J][p7P_MOVE] = log(pmove); |
| 169 |
gm->L = L; |
| 170 |
return eslOK; |
| 171 |
} |