_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} /* -------------------------------------------------------------------------- */ /* Builds a vector of codon frequencies by multiplying observed frequencies */ /* -------------------------------------------------------------------------- */ function BuildCodonFrequencies (obsF) { PIStop = 1.0; result = {61,1}; hshift = 0; for (h=0; h<64; h=h+1) { first = h$16; second = h%16$4; third = h%4; if (_Genetic_Code[h]==10) { hshift = hshift+1; PIStop = PIStop+obsF[first][0]*obsF[second][1]*obsF[third][2]; continue; } result[h-hshift][0]=obsF[first][0]*obsF[second][1]*obsF[third][2]; } return result*(1.0/(PIStop)) }