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 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272
|
/* define the standard genetic code */
/* AAA,AAC,AAG....TTA,TTC,TTG,TTT - 64 all in all*/
_Genetic_Code = {
{14,13,14,13,7,7,7,7,19, 5,19, 5,2,2,3,2,
12,11,12,11,6,6,6,6,19,19,19,19,1,1,1,1,
16,15,16,15,8,8,8,8,20,20,20,20,4,4,4,4,
10,9, 10,9, 5,5,5,5,10,17,18,17,1,0,1,0}
};
/*
here's how codes translate to aminoacids
0 == Phe
1 == Leu
2 == Ile
3 == Met
4 == Val
5 == Ser
6 == Pro
7 == Thr
8 == Ala
9 == Tyr
10 == Stop
11 == His
12 == Gln
13 == Asn
14 == Lys
15 == Asp
16 == Glu
17 == Cys
18 == Trp
19 == Arg
20 == Gly
*/
MG94_1 = {61,61};
MG94_2 = {61,61};
NICETY_LEVEL = 3;
/* a flag to control Mac version responsiveness */
/* defines a sparse transition probabilities matrix
now we'll go through the matrix and assign the elements based on syn/non-syn status*/
hshift = 0;
for (h=0; h<64; h=h+1)
{
if ((h==56)||(h==50)||(h==48))
{
hshift = hshift+1;
continue;
}
vshift = hshift;
for (v = h+1; v<64; v=v+1)
{
/*first check to see if the transition is one step*/
diff = v-h;
/*if the diff is less than 4 then there is a change in the 3rd slot only
if the diff is divisible by 4 but not by 16 then there is a change in the 2nd slot only
if the diff is divisible by 16 then there is a change in the 1st slot only
*/
if ((v==56)||(v==50)||(v==48))
{
vshift = vshift+1;
continue;
}
if ((h$4==v$4)||((diff%4==0)&&(h$16==v$16))||(diff%16==0))
/* the transition is one-step and now we will determine whether it is syn or non-syn */
{
if (h$4==v$4)
{
transition = v%4;
transition2= h%4;
}
else
{
if(diff%16==0)
{
transition = v$16;
transition2= h$16;
}
else
{
transition = v%16$4;
transition2= h%16$4;
}
}
if (_Genetic_Code[0][h]==_Genetic_Code[0][v])
{
MG94_1[h-hshift][v-vshift] := synRate*observedFreq1__[transition__][0];
MG94_1[v-vshift][h-hshift] := synRate*observedFreq1__[transition2__][0];
MG94_2[h-hshift][v-vshift] := synRate*observedFreq2__[transition__][0];
MG94_2[v-vshift][h-hshift] := synRate*observedFreq2__[transition2__][0];
}
else
{
MG94_1[h-hshift][v-vshift] := nonSynRate*observedFreq1__[transition__][0];
MG94_1[v-vshift][h-hshift] := nonSynRate*observedFreq1__[transition2__][0];
MG94_2[h-hshift][v-vshift] := nonSynRate*observedFreq2__[transition__][0];
MG94_2[v-vshift][h-hshift] := nonSynRate*observedFreq2__[transition2__][0];
}
}
}
}
/* the following function compute equil. codon frequencies */
function BuildCodonFrequencies (obsF)
{
PIStop = 1-obsF[3][0]*obsF[0][0]*obsF[2][0]-obsF[3][0]*obsF[2][0]*obsF[0][0]-obsF[3][0]*obsF[0][0]*obsF[0][0];
result = {61,1};
hshift = 0;
for (h=0; h<64; h=h+1)
{
if ((h==56)||(h==50)||(h==48))
{
hshift = hshift+1;
continue;
}
first = h$16;
second = h%16$4;
third = h%4;
result[h-hshift][0]=obsF[first][0]*obsF[second][0]*obsF[third][0]/PIStop;
}
return result;
}
|