one of the tantalizing questions raised by molecular biology is whether the basic structures of life as we know them arose through a darwinian evolutionary process and , if so , what were the evolutionary pressures acting on them ? the genetic code was initially believed to be universal throughout all living things , even though some variations in both nuclear and mitochondrial systems have recently been found ( see   for a review ) . these variations are , however , limited and correspond essentially to the reassignment of one or a few codons to another amino acid . the idea that the genetic code could have evolved to its present form has been repeatedly suggested . for instance , it has been proposed that early codes were simpler , in that they coded for only a few amino acids , and that the number of amino acids coded in the genetic code increased as the code evolved . several hypotheses have been put forward to explain the evolution of the genetic code to its present form , and to find out what the genetic code is optimized for . one possible scenario is that the genetic code evolved so as to minimize the consequence of errors during transcription and translation . to test this hypothesis , some researchers have tried to estimate the percentage of optimal achievement of the natural code by quantifying the cost of single - base changes . more recently , haig and hurst   and freeland and hurst   improved that approach by comparing the natural code with random codes . to this end , they defined a fitness function ,  , that measures the efficiency of the code in limiting the consequences of transcription and translation errors . this function  supposedly evolved towards a minimum through evolution . to measure how close the natural code is to the actual minimum of  , they generated random genetic codes , and computed the fraction of those that are better - that is , have a smaller value of  - than the natural code . they found that only a very small fraction of the random codes are better than the natural code , and concluded that the natural code is therefore optimal in that it minimizes the effect of translation and transcription errors . haig and hurst   tested several fitness functions ,  , based on different physicochemical parameters , and found that single - base changes in the natural code had the smallest average effect when using , as a cost measure , the change in polarity or hydropathy between the corresponding amino acids . these parameters , although not unique , are clearly biologically relevant , as they are related to hydrophobicity , a property known to be important in protein conformation ( see , for example ,   for reviews ) . changing , through a transcription or a translation error , a nonpolar amino acid into a polar one at some strategic position in the sequence of a protein can have dramatic consequences on its conformation . using these parameters , and assuming that all point mutations occur with the same frequency , haig and hurst   found that the fraction of random codes that beat the natural code is of the order of 10 . it has been shown experimentally that individual translation errors occur more frequently at the first and third codon positions than at the second , and that there are transition / transversion biases . taking this into account , freeland and hurst   proposed a modified fitness function  , which models more accurately the probability of translation errors . they found that with this improved modeling , the fraction of random genetic codes that are better than the natural one decreases from 10 to 10 . they retrieved from their calculations a well known property of the genetic code : single - base substitutions in the first and third codon position are strongly conservative with respect to changes in polarity . here , we highlight the importance of another parameter in the optimization of the genetic code , namely the frequency at which different amino acids occur in proteins . this frequency differs from protein to protein , and even from species to species , but there is a general pattern that prevails ( table 1 ) . in figure 1 , we have plotted the number of codons coding for the same amino acid ( synonyms ) versus the amino - acid frequency . the correlation between these two quantities , first noted by king and jukes , led us to suspect that the amino - acid frequency is an important parameter in the optimization of the genetic code , which should also be taken into account in the fitness function . our calculations indeed confirm that the genetic code is even more optimal with respect to translation errors if the amino - acid frequencies of table 1 are properly incorporated in . in addition , we bring further improvements to  by using quantities other than polarity to measure the roles of the different amino acids in protein conformation and stability . it should be stressed that the biological relevance of the parameters used in  is crucial in the estimation of the relative robustness of the natural code . indeed , one can always construct an artificial fitness function  such that the natural biological structure apparently lies at its minimum . clearly , the hydrophobicity parameters used by haig and hurst   are biologically motivated , but we would like to do better by refining our cost measure . in particular , we have devised a mutation matrix describing the average cost of single amino - acid substitutions in protein stability , obtained by computer experiments . for instance , it takes into account that mutating cysteine into any other amino acid may be very costly as it may break a disulfide bond . such an effect would not be apparent if only a single property , say hydrophobicity , was taken into account . we show that , with a fitness function  depending on this mutation matrix and the amino - acid frequencies , only about two out of 10 randomly generated codes are better than the natural code . this suggests that the genetic code is even better optimized to limit translation errors than was previously thought . it is built out of 64 codons , each consisting of three consecutive dna bases ( a , g , c , t ) or rna bases ( a , g , c , u ) . these 64 codons are divided into 21 sets of synonyms , which each code for one of the 20 natural amino acids or correspond to a stop signal ; hence , to each codon , c , an amino acid ( or stop signal ) a is assigned through a function a(c ) . consider now an error during transcription from dna to rna or during translation from rna to protein , in which codon c is mistaken for codon c ' . this error thus results in amino acid a(c ) being replaced by amino acid a ' = a(c ' ) . the associated cost is estimated by a function g(a , a ' ) , which measures the difference between the amino acids a and a ' with respect to their physicochemical properties or their role in ( de)stabilizing protein structures ; when a or a ' corresponds to a stop codon , we set g(a , a ' ) = 0 . different cost functions g will be discussed in the next section . following freeland and hurst , the fitness  of a code is measured by the average of the cost g over all codons c and all single - base errors c - > c ' where p(c ' | c ) is the probability of misreading codon c as codon c ' . if one focuses on transcription errors only , as do haig and hurst in , then all p(c'| c ) values must be taken as equal . but here we consider translation errors , as do free - land and hurst in , and hence p(c ' | c ) changes according to whether c and c ' differ in the first , second or third base , and lead to a transition or a transversion . a transition is the substitution of a purine ( a , g ) into another purine , or a pyrimidine ( c , u / t ) into another pyrimidine , whereas a transversion interchanges purines and pyrimidines . on the basis of experimental data indicating that transitions are more common than transversions , and that errors on the third base are more frequent than errors on the first base , which are themselves more frequent than errors on the second base , freeland and hurst   have chosen the following values of p(c ' |c ) , which we also use here : p(c ' | c ) = 1/n if c and c ' differ in the 3rd base only , p(c ' | c ) = 1/n if c and c ' differ in the 1st base only and cause a transition , p(c ' | c ) = 0.5/n if c and c ' differ in the 1st base only and cause a transversion , p(c ' | c ) = 0.5/n if c and c ' differ in the 2nd base only and cause a transition , p(c ' | c ) = 0.1/n if c and c ' differ in the 2nd base only and cause a transversion , p(c ' | c ) = 0 if c and c ' differ by more than 1 base . where n is a normalization factor ensuring that c'p(c ' | c ) = 1 . obviously , these probabilities only roughly approximate the true transition / transversion and base position biases . however , the computed fitness of the genetic code has been shown to be relatively insensitive to their precise values . let us now return to the correlations between the number of codons coding for an amino acid and the frequency of this amino acid ( see figure 1 ) . king and jukes , who first noted this correlation , suggested that most of the amino acids in genomes have arisen by random mutations that do not affect the properties and function of the proteins . as a consequence , the number of synonymous codons determines the frequency of amino acids . an alternative interpretation , assuming a very different chain of causality , is that the amino - acid frequencies are fixed by their physicochemical properties . for instance , tryptophan would be a rare amino acid because its specific properties are seldom needed in proteins or because it is difficult to synthesize . the correlation between the amino - acid frequencies and number of synonymous codons ( figure 1 ) would then be interpreted as being due to an adjustment of the natural genetic code to the frequency of the amino acids . independent of the assumed chain of causality , it is natural to expect that a codon error replacing a frequent amino - acid type with another leads to more absolute errors and thus has more consequences , at least on average , than an error affecting a rare amino acid . the frequencies with which the different amino acids occur in proteins , which are similar in different organisms ( table 1 ) , are only imperfectly taken into account in the fitness function  given by equation ( 1 ) , because of the imperfect correlation between amino - acid frequency and number of synonymous codons ( figure 1 ) . to account properly for the amino - acid frequencies , we propose a modified fitness function  : where p(a ) is the relative frequency of amino acid a , and n(c ) is the number of codons in the block to which c belongs . in other words , n(c ) is the number of synonyms coding for the amino acid a(c ) that c codes for . note that equation ( 2 ) supposes that there is no codon bias , that is , the different synonyms of a given amino acid appear with the same frequency . to measure the effect of the amino - acid frequency on the value of the fitness function  , we define , for the sake of comparison , another fitness function  where all the amino acids are supposed equally frequent , that is , p(a ) = 1/20 : the function g(a , a ' ) in equations ( 1 ) and ( 2 ) measures the cost - as far as protein stability and structure is concerned - of substituting amino acid a by a ' . hence , a natural choice for g consists of taking the squared difference in hydrophobicity h of the amino acids a and a ' : g ( a , a ' ) = ( h(a ) - h(a ' ) )   ( 4 ) there exist various hydrophobicity scales for amino acids . , which is the one used by haig and hurst   and freeland and hurst . in the second scale , h(a ) is the average solvent accessibility of amino acid a derived from a set of 141 well resolved and refined protein structures with low sequence identity ( see methods ) ; solvent accessibilities are computed using survol . although hydrophobic forces dominate in proteins , other types of interactions also contribute to protein stability ( see   for reviews ) . we therefore also attempted to devise a better cost function g(a , a ' ) , measuring more accurately the difference between amino acids a and a ' . this new function is inspired by recent computations of the change in free energy of a protein when a single amino acid is mutated . it is obtained by mutating in silico , in all proteins of the aforementioned set of 141 protein structures and at all positions , the wild - type amino acids into the 19 other possible ones , and evaluating the resulting changes in folding free energy with mean force potentials derived from the same structure dataset . the matrix elements m(a , a ' ) are obtained as the average of all the computed folding free - energy changes , which correspond to a substitution a  a ' . details on the procedure and the value of the matrix elements m(a , a ' ) are given in the methods section . this matrix is taken as a cost function : g ( a , a ' ) = m(a , a ' )   ( 5 ) for the purpose of comparing g with a reference matrix that exclusively reflects the structure of the genetic code , we define the cost function : g ( a , a ' ) = 3 - (a , a ' )   ( 6 ) where  ( a , a ' ) is zero when a and a ' coincide , and otherwise equal to the minimum number of bases that must be changed to transform a codon coding for a into a codon coding for a ' . as a last cost function , used only for comparison with earlier work , we consider the point accepted mutations 74 - 100 ( pam74 - 100 ) substitution matrix , one of the most commonly used matrices in the context of protein - sequence alignment : g ( a , a ' ) = pam74 - 100 ( a , a ' )   ( 7 ) this matrix is derived from the pattern of amino - acid substitution frequencies observed within naturally occurring pairs of highly diverged homologous protein sequences . however , the use of this matrix for measuring the genetic code 's fitness   has been criticized , as matrices derived from substitution patterns observed in homologous proteins reflect not only the similarity between amino acids with respect to their physicochemical and energetic properties , but also the facility with which one amino acid is mutated into another and thus their proximity in the genetic code . however , as the pam74 - 100 matrix is derived from highly diverged protein sequences , this effect can be expected to be relatively limited . this is indeed the case , as the linear correlation coefficient between the nondiagonal entries of g and g is only 0.43 . nevertheless , the correlation coefficient between g and g is still much lower , namely 0.19 , so that g may in no way be suspected to include information on proximity in the genetic code . finally , note that the correlation coefficient between g and g is equal to 0.60 ; these matrices thus share common features but contain also different information . this is not surprising considering that their derivations use very different starting points ( protein three - dimensional structures in one case , sequence similarity in the other ) . to evaluate the robustness of the natural genetic code with respect to translation errors , we computed the fitness functions  ,  and  using equations ( 1 ) to ( 3 ) for the natural genetic code , and compared it to the corresponding fitnesses of random codes . the random codes are obtained by maintaining the codon block structure of the natural genetic code , where each block corresponds to synonyms coding for the same amino acid ( or stop signal ) . when generating a random code , the stop signal is kept assigned to the same block as in the natural genetic code , whereas the different amino acids are randomly interchanged among the 20 remaining blocks . thus , each random code is simply specified by a different function a(c ) in equations ( 1 ) to ( 3 ) . this is the procedure previously used by haig and hurst   and freeland and hurst . thus , in a first stage , we computed the fitness functions  and  for the natural genetic code and for 10 randomly generated codes , using the three cost functions g , g and g. we then calculated the fraction f of random codes whose value of  is lower than that of the natural code . this fraction is supposedly a good estimate of the relative merit of the natural genetic code comparative to other codes . it appears that this fraction f is always smaller for  than for . this is especially true for the cost function g where f is 300 times smaller . this result indicates that the natural code appears to be better optimized with respect to translation errors if the amino - acid frequencies are taken into account . to investigate this further , we have analyzed which of the cost functions g , g or g genetic code appears to be best optimized for . we compared the fraction f of better codes for each of the cost functions using the fitness function . for the hydrophobicity functions g and g , the result is roughly the same : f is about 0.5 - 1.0 in 10 . the relative statistical error on this value is of the order of n , where n is the number of random codes better than the natural one that were found in our sample of 10 random codes ; thus , n is about 650 - 1,200 , and the error is insignificant . for the mutational cost function g this result shows that the natural genetic code appears even more optimal if the cost function g is used than if hydrophobicity - based cost functions are considered . as g has been computed from protein stability changes effected by point mutations , we may conclude that the genetic code is optimized in such a way as to limit the effect of translation errors on the three - dimensional structure and stability of the coded proteins . note that the improvement brought by the choice of g results from the fact that it probably better accounts for the cost of a mutation than a mere difference of hydrophobicity ; for example , glycine , proline and cysteine have close neighbors in hydrophobicity , whereas the cost of their mutation as accounted for by g is high . this is due to their special role in determining protein structure : glycine and proline can adopt backbone torsion angles essentially inaccessible to other amino acids , and cysteine can form disulfide bonds . to check the significance of this result , we have computed the fraction f of random codes that beat the natural one for random choices of the amino - acid frequencies , distinct from the natural frequencies p(a ) . we have generated 10 sets of random p(a ) values , and , for each of them , estimated the fraction f ( out of a sample of 10 random codes ) . the percentage of random amino - acid frequency sets that result in a lower fraction f than the natural frequencies is shown in table 3 . we find that a random assignment of the amino - acid frequencies does not decrease / in most ( at least 97% ) of the cases , and this tendency persists for all cost functions g. thus , the probability that the decrease of f , observed in table 2 , when passing from  to  , was due to chance is quite limited . we may therefore conclude that the genetic code is optimized so as to take into account the natural amino - acid frequencies . we also investigated whether the result that the natural code is better optimized if amino - acid frequencies are taken into account does not depend crucially on the amino - acid frequencies used . for this purpose , we calculated the fraction f of random codes with lower  value than the genetic code for the four sets of amino - acid frequencies listed in table 1 , which are computed from genomes of eukaryotes , archaea , bacteria and from all these genomes together . the results turn out to be essentially insensitive to the chosen frequency set : the fractions f differ at most by a factor of two , which leaves all conclusions unchanged . we have also included in table 2 the results based on the fitness function . it can be argued that this function partly takes , but imperfectly , the amino - acid frequencies into account . indeed , for this fitness function each codon is assigned the same weight , which corresponds to each amino acid being assigned a frequency proportional to the number of synonyms n(a ) coding for it . in the case of the natural genetic code , this frequency corresponds approximately to the amino - acid frequency as there is a correlation between n(a ) and p(a ) , as shown in figure 1 . but for random codes , where the amino acids are randomly interchanged between the codon blocks , this correspondence breaks down . thus , the way in which  takes amino - acid frequencies into account depends on the code considered . this explains why the fraction f of random codes better than the natural one is roughly of the same order using  and . note that f is always larger for than for  , indicating again the importance of the amino acid frequencies in the optimality of the genetic code . for sake of comparison , we have added in table 2 the values of the fraction f of random codes with a lower  value than the natural one , using the cost functions g and g , which include information about the structure of the genetic code . with g , the fraction f is the same as with g , whereas with g , we did not find any random code better than the natural one among the 10 random codes tested . to estimate f without having to generate a larger ensemble we computed , from the values of  for the 10 random codes , the probability function  (  ) to have a given value of . we fitted log( (  ) ) to a polynomial of fourth degree , and extrapolated this curve down to the value of  for the natural code . this provides an estimate of the fraction f of random codes that have a lower  value . we found with this procedure that / is of the order of 10 with g , and thus about 10 times smaller than with g andg . it is not surprising that the fraction f of random codes that does better than the natural code is extremely small for g , as this matrix exclusively reflects the proximity of amino acids in the genetic code and renders the issue of the code 's fitness tautologous . it can indeed be argued that g contains information on the proximity of amino acids in the genetic code , superimposed on the desired measure of their similarity in preserving protein structure , because it is computed from amino - acid substitutions in families of evolutionarily related proteins , which are more frequent between amino acids that are closer in the genetic code . the fact that g and g yield similar f values ( see table 2 ) can be taken to indicate that this is not the case , and thus that both these cost functions can reliably be used to estimate the code 's fitness against translation errors . it could , however , also be argued that g describes protein structure less well than g and includes somewhat more information about the genetic code ( as monitored by correlation coefficients of 0.43 and 0.19 of gand g with respect to g ) . these two effects tend to compensate each other , and could be expected to yield similar f values for g and g. it therefore seems safer to use g as cost function , because , owing to its very definition , it seems to capture important structural information and to be independent of the code 's structure . we also investigated how optimal the genetic code is with respect to amino - acid interchanges that do not affect codon degeneracy . we exhaustively generated all alternative codes that preserve the amino - acid degeneracy and computed the fraction f of these codes that do better than the natural code with respect to mistranslation . we found that f is of the order of 10 for the three fitness functions  ,  and  ( table 4 ) . it is thus similar to the f value computed on the unrestricted set of alternative codes for  and  , and much larger for . this result simply reflects the correlation between the codon degeneracy and the amino - acid frequency ( figure 1 ) . indeed , this correlation implies that a much larger proportion of the better codes maintain the degeneracy , if the frequency of the amino acids is taken into account in the fitness function , as in . in contrast , in  and  the amino - acid frequency is not considered and f is of the same order with the restricted and unrestricted sets . it has been proposed that the genetic code has evolved from a simpler ancestral code , encoding only a few amino acids present at early times , and that new amino acids appearing as biosynthetic derivatives of the original ones were incorporated by subdivision and reassignment of their synonymous codons . this so - called coevolution hypothesis is supported by the observation that biosynthetically related amino acids are close within the genetic code . to investigate the optimality of the genetic code in the coevolution framework , we computed the fraction f of alternative codes that perform better than the natural code against translation errors and that differ from the natural code by shuffling amino acids belonging to the same biosynthetic pathway . we found that f is equal to 2.9  10 , whereas it is equal to 2  10 for the unrestricted set allowing all shufflings ( table 4 ) . this means that the fraction f of better codes is somewhat larger in the biosynthesis - restricted set than in the complete set , and thus that the optimality rate is slightly lower . this result can also be viewed differently . when considering the total number of codes in the two sets ( which are of the order of 10 and 10 ) , it means that there are only six codes that beat the natural code in the restricted set , whereas there are 10 such codes in the unrestricted set . this is particularly striking given that our definitions of cost functions and sets of biosynthetically related amino acids only constitute approximations . we can thus conclude that the genetic code is quite robust against mistranslation in the space of all alternative codes , and is close to being fully optimal if historical biosynthetic constraints are taken into account . a complementary measure of the optimality of the genetic code is its percentage of optimization , defined as 100%(code - mean)/(best - mean ) , where code is the fitness of the genetic code , best fitness of the best of all possible codes and mean the average fitness over all codes . this measure indicates how close the fitness value of the genetic code is to the fitness value of the optimal code . note however that this optimality measure has no absolute meaning and may not be compared among fitness functions  defined on the basis of different cost functions g ; to illustrate this , consider the following example : if g is defined by |h(a)-h(a')| instead of ( h(a)-h(a ' ) ) ( see equation ( 4 ) ) , the fraction f of better codes remains unchanged but the percentage of optimality does change . it is , however , meaningful to compare the percentage of optimization of the genetic code in the unrestricted and biosynthesis restricted sets with a same g function . for  , we find that this percentage is equal to 97% and 98% in the two sets , respectively . this indicates that the fitness value of the genetic code is not very far from that of the best possible code , whether focusing on the subset of alternative codes preserving biosynthetic proximities , or considering all possible codes . it is built out of 64 codons , each consisting of three consecutive dna bases ( a , g , c , t ) or rna bases ( a , g , c , u ) . these 64 codons are divided into 21 sets of synonyms , which each code for one of the 20 natural amino acids or correspond to a stop signal ; hence , to each codon , c , an amino acid ( or stop signal ) a is assigned through a function a(c ) . consider now an error during transcription from dna to rna or during translation from rna to protein , in which codon c is mistaken for codon c ' . this error thus results in amino acid a(c ) being replaced by amino acid a ' = a(c ' ) . the associated cost is estimated by a function g(a , a ' ) , which measures the difference between the amino acids a and a ' with respect to their physicochemical properties or their role in ( de)stabilizing protein structures ; when a or a ' corresponds to a stop codon , we set g(a , a ' ) = 0 . different cost functions g will be discussed in the next section . following freeland and hurst , the fitness  of a code is measured by the average of the cost g over all codons c and all single - base errors c - > c ' where p(c ' | c ) is the probability of misreading codon c as codon c ' . if one focuses on transcription errors only , as do haig and hurst in , then all p(c'| c ) values must be taken as equal . but here we consider translation errors , as do free - land and hurst in , and hence p(c ' | c ) changes according to whether c and c ' differ in the first , second or third base , and lead to a transition or a transversion . a transition is the substitution of a purine ( a , g ) into another purine , or a pyrimidine ( c , u / t ) into another pyrimidine , whereas a transversion interchanges purines and pyrimidines . on the basis of experimental data indicating that transitions are more common than transversions , and that errors on the third base are more frequent than errors on the first base , which are themselves more frequent than errors on the second base , freeland and hurst   have chosen the following values of p(c ' |c ) , which we also use here : p(c ' | c ) = 1/n if c and c ' differ in the 3rd base only , p(c ' | c ) = 1/n if c and c ' differ in the 1st base only and cause a transition , p(c ' | c ) = 0.5/n if c and c ' differ in the 1st base only and cause a transversion , p(c ' | c ) = 0.5/n if c and c ' differ in the 2nd base only and cause a transition , p(c ' | c ) = 0.1/n if c and c ' differ in the 2nd base only and cause a transversion , p(c ' | c ) = 0 if c and c ' differ by more than 1 base . where n is a normalization factor ensuring that c'p(c ' | c ) = 1 . obviously , these probabilities only roughly approximate the true transition / transversion and base position biases . however , the computed fitness of the genetic code has been shown to be relatively insensitive to their precise values . let us now return to the correlations between the number of codons coding for an amino acid and the frequency of this amino acid ( see figure 1 ) . king and jukes , who first noted this correlation , suggested that most of the amino acids in genomes have arisen by random mutations that do not affect the properties and function of the proteins . as a consequence , an alternative interpretation , assuming a very different chain of causality , is that the amino - acid frequencies are fixed by their physicochemical properties . for instance , tryptophan would be a rare amino acid because its specific properties are seldom needed in proteins or because it is difficult to synthesize . the correlation between the amino - acid frequencies and number of synonymous codons ( figure 1 ) would then be interpreted as being due to an adjustment of the natural genetic code to the frequency of the amino acids . independent of the assumed chain of causality , it is natural to expect that a codon error replacing a frequent amino - acid type with another leads to more absolute errors and thus has more consequences , at least on average , than an error affecting a rare amino acid . the frequencies with which the different amino acids occur in proteins , which are similar in different organisms ( table 1 ) , are only imperfectly taken into account in the fitness function  given by equation ( 1 ) , because of the imperfect correlation between amino - acid frequency and number of synonymous codons ( figure 1 ) . to account properly for the amino - acid frequencies , we propose a modified fitness function  : where p(a ) is the relative frequency of amino acid a , and n(c ) is the number of codons in the block to which c belongs . in other words , n(c ) is the number of synonyms coding for the amino acid a(c ) that c codes for . note that equation ( 2 ) supposes that there is no codon bias , that is , the different synonyms of a given amino acid appear with the same frequency . to measure the effect of the amino - acid frequency on the value of the fitness function , we define , for the sake of comparison , another fitness function  where all the amino acids are supposed equally frequent , that is , p(a ) = 1/20 : the function g(a , a ' ) in equations ( 1 ) and ( 2 ) measures the cost - as far as protein stability and structure is concerned - of substituting amino acid a by a ' . hence , a natural choice for g consists of taking the squared difference in hydrophobicity h of the amino acids a and a ' : g ( a , a ' ) = ( h(a ) - h(a ' ) )   ( 4 ) there exist various hydrophobicity scales for amino acids . , which is the one used by haig and hurst   and freeland and hurst . in the second scale , h(a ) is the average solvent accessibility of amino acid a derived from a set of 141 well resolved and refined protein structures with low sequence identity ( see methods ) ; solvent accessibilities are computed using survol . although hydrophobic forces dominate in proteins , other types of interactions also contribute to protein stability ( see   for reviews ) . we therefore also attempted to devise a better cost function g(a , a ' ) , measuring more accurately the difference between amino acids a and a ' . this new function is inspired by recent computations of the change in free energy of a protein when a single amino acid is mutated . it is obtained by mutating in silico , in all proteins of the aforementioned set of 141 protein structures and at all positions , the wild - type amino acids into the 19 other possible ones , and evaluating the resulting changes in folding free energy with mean force potentials derived from the same structure dataset . the matrix elements m(a , a ' ) are obtained as the average of all the computed folding free - energy changes , which correspond to a substitution a  a ' . details on the procedure and the value of the matrix elements m(a , a ' ) are given in the methods section . this matrix is taken as a cost function : g ( a , a ' ) = m(a , a ' )   ( 5 ) for the purpose of comparing g with a reference matrix that exclusively reflects the structure of the genetic code , we define the cost function : g ( a , a ' ) = 3 - (a , a ' )   ( 6 ) where  ( a , a ' ) is zero when a and a ' coincide , and otherwise equal to the minimum number of bases that must be changed to transform a codon coding for a into a codon coding for a ' . as a last cost function , used only for comparison with earlier work , we consider the point accepted mutations 74 - 100 ( pam74 - 100 ) substitution matrix , one of the most commonly used matrices in the context of protein - sequence alignment : g ( a , a ' ) = pam74 - 100 ( a , a ' )   ( 7 ) this matrix is derived from the pattern of amino - acid substitution frequencies observed within naturally occurring pairs of highly diverged homologous protein sequences . however , the use of this matrix for measuring the genetic code 's fitness   has been criticized , as matrices derived from substitution patterns observed in homologous proteins reflect not only the similarity between amino acids with respect to their physicochemical and energetic properties , but also the facility with which one amino acid is mutated into another and thus their proximity in the genetic code . however , as the pam74 - 100 matrix is derived from highly diverged protein sequences , this effect can be expected to be relatively limited . this is indeed the case , as the linear correlation coefficient between the nondiagonal entries of g and g is only 0.43 . nevertheless , the correlation coefficient between g and g is still much lower , namely 0.19 , so that g may in no way be suspected to include information on proximity in the genetic code . finally , note that the correlation coefficient between g and g is equal to 0.60 ; these matrices thus share common features but contain also different information . this is not surprising considering that their derivations use very different starting points ( protein three - dimensional structures in one case , sequence similarity in the other ) . to evaluate the robustness of the natural genetic code with respect to translation errors , we computed the fitness functions  ,  and  using equations ( 1 ) to ( 3 ) for the natural genetic code , and compared it to the corresponding fitnesses of random codes . the random codes are obtained by maintaining the codon block structure of the natural genetic code , where each block corresponds to synonyms coding for the same amino acid ( or stop signal ) . when generating a random code , the stop signal is kept assigned to the same block as in the natural genetic code , whereas the different amino acids are randomly interchanged among the 20 remaining blocks . thus , each random code is simply specified by a different function a(c ) in equations ( 1 ) to ( 3 ) . this is the procedure previously used by haig and hurst   and freeland and hurst . thus , in a first stage , we computed the fitness functions  and  for the natural genetic code and for 10 randomly generated codes , using the three cost functions g , g and g. we then calculated the fraction f of random codes whose value of  is lower than that of the natural code . this fraction is supposedly a good estimate of the relative merit of the natural genetic code comparative to other codes . it appears that this fraction f is always smaller for  than for . this is especially true for the cost function g where f is 300 times smaller . this result indicates that the natural code appears to be better optimized with respect to translation errors if the amino - acid frequencies are taken into account . to investigate this further , we have analyzed which of the cost functions g , g or g genetic code appears to be best optimized for . we compared the fraction f of better codes for each of the cost functions using the fitness function . for the hydrophobicity functions g and g , the result is roughly the same : f is about 0.5 - 1.0 in 10 . the relative statistical error on this value is of the order of n , where n is the number of random codes better than the natural one that were found in our sample of 10 random codes ; thus , n is about 650 - 1,200 , and the error is insignificant . for the mutational cost function g , f is several orders of magnitude lower , namely 2 in 10 . this result shows that the natural genetic code appears even more optimal if the cost function g is used than if hydrophobicity - based cost functions are considered . as g has been computed from protein stability changes effected by point mutations , we may conclude that the genetic code is optimized in such a way as to limit the effect of translation errors on the three - dimensional structure and stability of the coded proteins . note that the improvement brought by the choice of g results from the fact that it probably better accounts for the cost of a mutation than a mere difference of hydrophobicity ; for example , glycine , proline and cysteine have close neighbors in hydrophobicity , whereas the cost of their mutation as accounted for by g is high . this is due to their special role in determining protein structure : glycine and proline can adopt backbone torsion angles essentially inaccessible to other amino acids , and cysteine can form disulfide bonds . to check the significance of this result , we have computed the fraction f of random codes that beat the natural one for random choices of the amino - acid frequencies , distinct from the natural frequencies p(a ) . we have generated 10 sets of random p(a ) values , and , for each of them , estimated the fraction f ( out of a sample of 10 random codes ) . the percentage of random amino - acid frequency sets that result in a lower fraction f than the natural frequencies is shown in table 3 . we find that a random assignment of the amino - acid frequencies does not decrease / in most ( at least 97% ) of the cases , and this tendency persists for all cost functions g. thus , the probability that the decrease of f , observed in table 2 , when passing from  to  , was due to chance is quite limited . we may therefore conclude that the genetic code is optimized so as to take into account the natural amino - acid frequencies . we also investigated whether the result that the natural code is better optimized if amino - acid frequencies are taken into account does not depend crucially on the amino - acid frequencies used . for this purpose , we calculated the fraction f of random codes with lower  value than the genetic code for the four sets of amino - acid frequencies listed in table 1 , which are computed from genomes of eukaryotes , archaea , bacteria and from all these genomes together . the results turn out to be essentially insensitive to the chosen frequency set : the fractions f differ at most by a factor of two , which leaves all conclusions unchanged . we have also included in table 2 the results based on the fitness function . it can be argued that this function partly takes , but imperfectly , the amino - acid frequencies into account . indeed , for this fitness function each codon is assigned the same weight , which corresponds to each amino acid being assigned a frequency proportional to the number of synonyms n(a ) coding for it . in the case of the natural genetic code , this frequency corresponds approximately to the amino - acid frequency as there is a correlation between n(a ) and p(a ) , as shown in figure 1 . but for random codes , where the amino acids are randomly interchanged between the codon blocks , this correspondence breaks down . thus , the way in which  takes amino - acid frequencies into account depends on the code considered . this explains why the fraction f of random codes better than the natural one is roughly of the same order using  and . note that f is always larger for than for  , indicating again the importance of the amino acid frequencies in the optimality of the genetic code . for sake of comparison , we have added in table 2 the values of the fraction f of random codes with a lower  value than the natural one , using the cost functions g and g , which include information about the structure of the genetic code . with g , the fraction f is the same as with g , whereas with g , we did not find any random code better than the natural one among the 10 random codes tested . to estimate f without having to generate a larger ensemble we computed , from the values of  for the 10 random codes , the probability function  (  ) to have a given value of . we fitted log( (  ) ) to a polynomial of fourth degree , and extrapolated this curve down to the value of  for the natural code . this provides an estimate of the fraction f of random codes that have a lower  value . we found with this procedure that / is of the order of 10 with g , and thus about 10 times smaller than with g andg . it is not surprising that the fraction f of random codes that does better than the natural code is extremely small for g , as this matrix exclusively reflects the proximity of amino acids in the genetic code and renders the issue of the code 's fitness tautologous . it can indeed be argued that g contains information on the proximity of amino acids in the genetic code , superimposed on the desired measure of their similarity in preserving protein structure , because it is computed from amino - acid substitutions in families of evolutionarily related proteins , which are more frequent between amino acids that are closer in the genetic code . the fact that g and g yield similar f values ( see table 2 ) can be taken to indicate that this is not the case , and thus that both these cost functions can reliably be used to estimate the code 's fitness against translation errors . it could , however , also be argued that g describes protein structure less well than g and includes somewhat more information about the genetic code ( as monitored by correlation coefficients of 0.43 and 0.19 of gand g with respect to g ) . these two effects tend to compensate each other , and could be expected to yield similar f values for g and g. it therefore seems safer to use g as cost function , because , owing to its very definition , it seems to capture important structural information and to be independent of the code 's structure . we also investigated how optimal the genetic code is with respect to amino - acid interchanges that do not affect codon degeneracy . we exhaustively generated all alternative codes that preserve the amino - acid degeneracy and computed the fraction f of these codes that do better than the natural code with respect to mistranslation . we found that f is of the order of 10 for the three fitness functions  ,  and  ( table 4 ) . it is thus similar to the f value computed on the unrestricted set of alternative codes for  and  , and much larger for . this result simply reflects the correlation between the codon degeneracy and the amino - acid frequency ( figure 1 ) . indeed , this correlation implies that a much larger proportion of the better codes maintain the degeneracy , if the frequency of the amino acids is taken into account in the fitness function , as in . in contrast , in  and  the amino - acid frequency is not considered and f is of the same order with the restricted and unrestricted sets . it has been proposed that the genetic code has evolved from a simpler ancestral code , encoding only a few amino acids present at early times , and that new amino acids appearing as biosynthetic derivatives of the original ones were incorporated by subdivision and reassignment of their synonymous codons . this so - called coevolution hypothesis is supported by the observation that biosynthetically related amino acids are close within the genetic code . to investigate the optimality of the genetic code in the coevolution framework , we computed the fraction f of alternative codes that perform better than the natural code against translation errors and that differ from the natural code by shuffling amino acids belonging to the same biosynthetic pathway . we found that f is equal to 2.9  10 , whereas it is equal to 2  10 for the unrestricted set allowing all shufflings ( table 4 ) . this means that the fraction f of better codes is somewhat larger in the biosynthesis - restricted set than in the complete set , and thus that the optimality rate is slightly lower . this result can also be viewed differently . when considering the total number of codes in the two sets ( which are of the order of 10 and 10 ) , it means that there are only six codes that beat the natural code in the restricted set , whereas there are 10 such codes in the unrestricted set . this is particularly striking given that our definitions of cost functions and sets of biosynthetically related amino acids only constitute approximations . we can thus conclude that the genetic code is quite robust against mistranslation in the space of all alternative codes , and is close to being fully optimal if historical biosynthetic constraints are taken into account . a complementary measure of the optimality of the genetic code is its percentage of optimization , defined as 100%(code - mean)/(best - mean ) , where code is the fitness of the genetic code , best fitness of the best of all possible codes and mean the average fitness over all codes . this measure indicates how close the fitness value of the genetic code is to the fitness value of the optimal code . note however that this optimality measure has no absolute meaning and may not be compared among fitness functions  defined on the basis of different cost functions g ; to illustrate this , consider the following example : if g is defined by |h(a)-h(a')| instead of ( h(a)-h(a ' ) ) ( see equation ( 4 ) ) , the fraction f of better codes remains unchanged but the percentage of optimality does change . it is , however , meaningful to compare the percentage of optimization of the genetic code in the unrestricted and biosynthesis restricted sets with a same g function . for , we find that this percentage is equal to 97% and 98% in the two sets , respectively . this indicates that the fitness value of the genetic code is not very far from that of the best possible code , whether focusing on the subset of alternative codes preserving biosynthetic proximities , or considering all possible codes . our results confirm and specify those of freeland and hurst : the genetic code seems structured so as to minimize the consequences of translation errors on the three - dimensional structure and stability of the coded proteins . we have shown that , using the cost function g which best reflects the roles of various amino acids in protein structures , and taking amino - acid frequencies into account , about 2 out of 10 random codes do better than the natural code . 2  10 possible codes preserving the codon block structure , which means that we can expect about 10 better codes overall . moreover , if the codon block structure is not preserved , the number of possible codes is larger by orders of magnitude , and therefore the number of codes better than the natural one will certainly be much larger . however , if we preserved the block structure and in addition restricted the space of alternative codes by interchanging only amino acids belonging to the same biosynthetic pathway , we found that there are only six codes performing better than the natural code . the genetic code thus seems quite robust with respect to mistranslation compared to alternative codes , and almost fully optimal if the constraint is imposed that biosynthetically related amino acids are encoded in codons that are close within the genetic code . this does not prove , but is in agreement with , the coevolution hypothesis , which assumes that the genetic code has evolved from an simpler ancestral code of only a few amino acids , by subdivision and reassignment of synonymous codons , and that the present genetic code has kept imprints of this evolution . so we can assert from our analysis that the genetic code has been optimized through evolution up to a certain point , even though it is probably not fully optimal , at least with respect to the parameters considered here , except perhaps if historical , biosynthesis - related , constraints are imposed . our analysis does not , however , give us much information about the mechanism of this evolution as there is unfortunately no trace left of evolution of the code or amino - acid frequencies in early times . for instance , we do not know whether the relative frequency of occurrence of amino acids in proteins adapted so as to increase the optimality of the genetic code with respect to translation errors , or , on the contrary , whether the genetic code evolved to take into account pre - existing amino - acid frequencies . we can , however , argue that if the amino - acid frequencies adapted to the genetic code , as assumed by king and jukes , a discrepancy in amino - acid composition between frequently and infrequently expressed genes might be detectable today ( unless the period during which evolution took place was long enough for this discrepancy to vanish ) . if , alternatively , the genetic code adapted to the amino - acid frequencies , and thus if these frequencies acted as an evolutionary pressure , one can imagine two scenarios . either the code optimized to take into account the prebiotic frequencies of the amino acids that became involved in it , or it optimized for the amino - acid frequencies of already formed proteins ( or of a subset of them ) that were important for life and maybe linked to the code 's control . perhaps can we assume , more realistically , that the genetic code and amino - acid frequencies evolved together during some evolutionary period , thereby approaching an optimal code / amino - acid relation . more generally , the parameters that acted as evolutionary pressure on the genetic code probably included all the mechanisms that encode and maintain the genetic information , and were not just restricted to the frequency of amino acids and the preservation of protein structure . for example , the genetic code is obviously related to the translation apparatus , composed of the ribosomes and trnas , whose action we described schematically here by the probabilities p(c ' | c ) to misread codon c as c ' . all these mechanisms probably evolved together with the genetic code during the early stages of life . although the code still evolves today , as reflected by its departure from universality in some organisms , its evolution is very limited and concerns only the reassignment of a few codons . as the same change sometimes recurs in different lineages , the code seems to have reached the bottom of a funnel in the evolutionary landscape that contains several roughly equivalent optimal codes . but apart from such restricted modifications , the code no longer evolves significantly , and has not undergone important modifications since an early stage in the development of life . this stability probably arose because even small modifications in the code would have entailed loss of functionality of genes that were already being expressed . moreover , the advent of more sophisticated transcription / translation control mechanisms , which involve huge protein systems , could have decreased the evolutionary pressure on the genetic code . even though our present information on the genetic code is insufficient to discriminate between evolutionary scenarios , our analysis enables us to put some constraints on the situation at the time when evolution of the code was pretty much frozen . in particular , it appears that the frequencies of the amino acids that were used in proteins synthesized at that time were similar to the present frequencies . we do not know what determines the present amino - acid frequencies , but presumably they result , at least in part , from the amino acids ' physicochemical properties . for instance , the ratio of hydrophobic to hydrophilic amino acids is intrinsically related to the globular structure of proteins and certainly contributes to the pressure on amino - acid frequencies . thus , we can assert that some of the pressures that determine the present amino - acid frequencies were already present at the time the code took on its definitive form . in addition , the increased optimality of the genetic code with respect to g implies that the three - dimensional structure of proteins probably played an equally important role in fixing the structure of the code . as the three - dimensional structure of a protein essentially determines its function , this suggests , more generally , that the protein function acted as a main evolutionary pressure on the code structure . consequently , at the time when the genetic code took its present form , primitive life was presumably already synthesizing complex proteins . this provides a tentative picture of primitive life at that time : the translation apparatus was similar to the present one , and organisms were made of complex proteins whose amino - acid frequencies were comparable to the present ones . the derivation is based on a dataset of 141 high - resolution protein structures determined by x - ray crystallography and listed in . to avoid bias , these 141 proteins are chosen to present either less than 20% sequence identity or less than 25% sequence identity and no structural similarity . the protein main chains are described by their heavy atoms , and each side chain is represented by a pseudo - atom c. for a given amino - acid type , the c has a well defined position relative to the main chain , corresponding to the geometric average of all heavy side - chain atoms of this type in the dataset ; for glycine , the c pseudo - atom is positioned on the c. side - chain degrees of freedom are thus neglected . each residue , at each position of each of the 141 proteins , is mutated in turn into the 19 non - wild - type amino acids . the mutations are made by keeping the main - chain structure unchanged , and substituting the c of the given amino acid by that of the mutant amino acid . for each of these mutations , the change in folding free energy is evaluated using the database - derived potentials and the procedure detailed below . for each substitution of amino acid a into a ' , the average of all computed changes in folding free energy , at all protein positions , is computed and defined as minus the matrix element m(a , a ' ) . we then symmetrize m by setting m(a , a ' ) = [ m(a , a')+m(a',a)]/2 and only consider the lower half of m(a < a ' ) . this procedure does not define the diagonal elements of m. on the basis of the principle that the structural role of a given amino acid is fulfilled by no other amino acid better than by itself , we assign to all the diagonal element the same maximum value : m(a , a ) = max [ m(a',a " ) ] + 1 . then , to simplify m without modifying its structure , we center it around its mean value : finally , we multiply all matrix elements m(a , a ' ) by 2 and replace them by the closest integer . the potentials we use to evaluate the protein conformations are derived from observed frequencies of sequence and structure patterns in the aforementioned dataset of 141 proteins . we consider two types of potentials , called torsion   and c -c   potentials . they take into account the propensities of single residues and residue pairs to be associated with a (  ,  ,  ) backbone torsion angle domain . we use two variants of the torsion potential , called torsionshort - range and torsionmiddle - range . both are computed from propensities of a (  ,  ,  ) domain ti , at position i along the sequence , or pairs of domains ( ti , tj ) , at positions i and j , to be associated with an amino acid ak at position k. but we have k - 1  i , j  k + 1 for the torsionshort - range potential and k - 8  i , j  k + 8 for the torsionmiddle - range potential . the folding free energy  g(s , c ) of a sequence s in the conformation c computed from these propensities is expressed as : where p are normalized frequencies , n is the number of residues in the sequence s , k is the boltzmann constant and t is a conformational temperature taken to be room temperature . the normalization factor k ensures that the contribution to g(s , c ) of each residue in the window [ k - 1 , k + 1 ] for the torsionshort - range potential or [ k - 8 , k + 8 ] for the torsionmiddle - range potential is counted once . they are based on propensities of pairs of amino acids ( ai , aj ) at position i and j along the sequence to be separated by a spatial distance dij , calculated between the pseudo - atoms c. we consider two variants of c - c potentials . the first one , called c - clong_range potential , describes purely nonlocal interactions along the sequence , and only takes into account residues separated by at least 15 residues along the sequence , that is j  i + 16 . the second one , simply called c - c potential , though dominated by nonlocal interactions , possesses a local interaction component . the nonlocal component is obtained by considering together the frequencies of all residues separated by seven sequence positions and more , thus with j  i + 8 . the local component is obtained by computing separately the frequencies of residues separated by one to six positions along the sequence , for i + 1 < j < i + 8 . the folding free energies are expressed as : with j  i + 16 and the normalized frequencies p independent of j - i for the c - clong_range potential , and i + 1 < j and the normalized frequencies p independent of j - i for j  i + 8 for the c - c potential . the discretization of the spatial distances dij is performed by dividing the distances between 3 and 8  into 25 bins of 0.2  width and merging the distances greater than 8  . to increase the reliability of the statistics , these bins are smoothed by combining the counts in each bin with those of the 10 flanking bins at each side . the predominance of the central bin is preserved by weighting the counts from each flanking bin by a factor 1/n , where n is the position relative to the central bin ; n is equal to 1 for the two closest bins and to 10 for the two most distant bins . the so - defined folding free energies are reliable for common amino acids and structure motifs , but not for less common ones . to correct for the sparse data , we substitute the sequence - specific frequencies p(c , s ) , where s denotes a sequence pattern and c a structure motif , which appear in expressions ( 9 ) and ( 10 ) immediately above defining the torsion and c - c folding free energies , by a linear combination of these frequencies and the product of the separate frequencies of s and c , denoted p(s ) and p(c ) respectively : where m is the number of occurrences of the sequence pattern s in the dataset , and  a parameter . this expression ensures that the sequence - specific contribution dominates for rare sequence patterns and tends to zero for frequent ones . this behavior is modulated by the parameter  , which we consider here equal to 50 . to estimate the stability changes caused by a single - site mutation , we compute the folding free energy changes as : where cm and cw are the mutant and wild - type conformations and sm and sw the mutant and wild - type sequences , respectively . with this convention , g is positive when the mutation is destabilizing , and negative when it is stabilizing . the conformations cm and cw of the mutant and wild - type protein are assumed to be nearly identical . more precisely , the backbone conformations are taken as identical and only the position of the c pseudo - atom , which is amino - acid dependent , is different in the mutant and wild - type structures . the folding free energies of the wild - type and mutant proteins are computed with linear combinations of the torsion and c - c potentials described in the previous section . previous analyses   have shown that the combination that gives the best evaluation of the g values depends on the solvent accessibility , a of the mutated residue ; a is defined as the solvent - accessible surface in the protein structure , computed by survol , multiplied by 100 and divided by its solvent - accessible surface in an extended tripeptide gly - x - gly . when the mutated residue is at the surface , with a solvent accessibility a equal to or larger than 50% , the optimal folding free - energy change has been shown to be equal to : when the mutated residue is half buried , half exposed to the solvent , with a solvent accessibility between 20 and 40% , the optimal folding free energy is : finally , when the mutated residue is totally buried in the protein core , with a solvent accessibility less than or equal to 20% , the optimal folding free energy is : when the mutated residue has a solvent accessibility comprised between 40 and 50% , we do not evaluate its folding free energy . we have indeed observed that in this case , the solvent accessibility of the mutated residue is not a good measure to guide the choice of the optimal potential . the derivation is based on a dataset of 141 high - resolution protein structures determined by x - ray crystallography and listed in . to avoid bias , these 141 proteins are chosen to present either less than 20% sequence identity or less than 25% sequence identity and no structural similarity . the protein main chains are described by their heavy atoms , and each side chain is represented by a pseudo - atom c. for a given amino - acid type , the c has a well defined position relative to the main chain , corresponding to the geometric average of all heavy side - chain atoms of this type in the dataset ; for glycine , the c pseudo - atom is positioned on the c. side - chain degrees of freedom are thus neglected . each residue , at each position of each of the 141 proteins , is mutated in turn into the 19 non - wild - type amino acids . the mutations are made by keeping the main - chain structure unchanged , and substituting the c of the given amino acid by that of the mutant amino acid . for each of these mutations , the change in folding free energy is evaluated using the database - derived potentials and the procedure detailed below . for each substitution of amino acid a into a ' , the average of all computed changes in folding free energy , at all protein positions , is computed and defined as minus the matrix element m(a , a ' ) . we then symmetrize m by setting m(a , a ' ) = [ m(a , a')+m(a',a)]/2 and only consider the lower half of m(a < a ' ) . this procedure does not define the diagonal elements of m. on the basis of the principle that the structural role of a given amino acid is fulfilled by no other amino acid better than by itself , we assign to all the diagonal element the same maximum value : m(a , a ) = max [ m(a',a " ) ] + 1 . then , to simplify m without modifying its structure , we center it around its mean value : finally , we multiply all matrix elements m(a , a ' ) by 2 and replace them by the closest integer . the potentials we use to evaluate the protein conformations are derived from observed frequencies of sequence and structure patterns in the aforementioned dataset of 141 proteins . we consider two types of potentials , called torsion   and c -c   potentials . they take into account the propensities of single residues and residue pairs to be associated with a (  ,  ,  ) backbone torsion angle domain . we use two variants of the torsion potential , called torsionshort - range and torsionmiddle - range . both are computed from propensities of a (  ,  ,  ) domain ti , at position i along the sequence , or pairs of domains ( ti , tj ) , at positions i and j , to be associated with an amino acid ak at position k. but we have k - 1  i , j  k + 1 for the torsionshort - range potential and k - 8  i , j  k + 8 for the torsionmiddle - range potential . the folding free energy  g(s , c ) of a sequence s in the conformation c computed from these propensities is expressed as : where p are normalized frequencies , n is the number of residues in the sequence s , k is the boltzmann constant and t is a conformational temperature taken to be room temperature . the normalization factor k ensures that the contribution to g(s , c ) of each residue in the window [ k - 1 , k + 1 ] for the torsionshort - range potential or [ k - 8 , k + 8 ] for the torsionmiddle - range potential is counted once . they are based on propensities of pairs of amino acids ( ai , aj ) at position i and j along the sequence to be separated by a spatial distance dij , calculated between the pseudo - atoms c. we consider two variants of c - c potentials . the first one , called c - clong_range potential , describes purely nonlocal interactions along the sequence , and only takes into account residues separated by at least 15 residues along the sequence , that is j  i + 16 . the second one , simply called c - c potential , though dominated by nonlocal interactions , possesses a local interaction component . the nonlocal component is obtained by considering together the frequencies of all residues separated by seven sequence positions and more , thus with j  i + 8 . the local component is obtained by computing separately the frequencies of residues separated by one to six positions along the sequence , for i + 1 < j < i + 8 . the folding free energies are expressed as : with j  i + 16 and the normalized frequencies p independent of j - i for the c - clong_range potential , and i + 1 < j and the normalized frequencies p independent of j - i for j  i + 8 for the c - c potential . the discretization of the spatial distances dij is performed by dividing the distances between 3 and 8  into 25 bins of 0.2  width and merging the distances greater than 8  . to increase the reliability of the statistics , these bins are smoothed by combining the counts in each bin with those of the 10 flanking bins at each side . the predominance of the central bin is preserved by weighting the counts from each flanking bin by a factor 1/n , where n is the position relative to the central bin ; n is equal to 1 for the two closest bins and to 10 for the two most distant bins . the so - defined folding free energies are reliable for common amino acids and structure motifs , but not for less common ones . to correct for the sparse data , we substitute the sequence - specific frequencies p(c , s ) , where s denotes a sequence pattern and c a structure motif , which appear in expressions ( 9 ) and ( 10 ) immediately above defining the torsion and c - c folding free energies , by a linear combination of these frequencies and the product of the separate frequencies of s and c , denoted p(s ) and p(c ) respectively : where m is the number of occurrences of the sequence pattern s in the dataset , and  a parameter . this expression ensures that the sequence - specific contribution dominates for rare sequence patterns and tends to zero for frequent ones . this behavior is modulated by the parameter  , which we consider here equal to 50 . to estimate the stability changes caused by a single - site mutation , we compute the folding free energy changes as : where cm and cw are the mutant and wild - type conformations and sm and sw the mutant and wild - type sequences , respectively . with this convention , g is positive when the mutation is destabilizing , and negative when it is stabilizing . the conformations cm and cw of the mutant and wild - type protein are assumed to be nearly identical . more precisely , the backbone conformations are taken as identical and only the position of the c pseudo - atom , which is amino - acid dependent , is different in the mutant and wild - type structures . the folding free energies of the wild - type and mutant proteins are computed with linear combinations of the torsion and c - c potentials described in the previous section . previous analyses   have shown that the combination that gives the best evaluation of the g values depends on the solvent accessibility , a of the mutated residue ; a is defined as the solvent - accessible surface in the protein structure , computed by survol , multiplied by 100 and divided by its solvent - accessible surface in an extended tripeptide gly - x - gly . when the mutated residue is at the surface , with a solvent accessibility a equal to or larger than 50% , the optimal folding free - energy change has been shown to be equal to : when the mutated residue is half buried , half exposed to the solvent , with a solvent accessibility between 20 and 40% , the optimal folding free energy is : finally , when the mutated residue is totally buried in the protein core , with a solvent accessibility less than or equal to 20% , the optimal folding free energy is : when the mutated residue has a solvent accessibility comprised between 40 and 50% , we do not evaluate its folding free energy . we have indeed observed that in this case , the solvent accessibility of the mutated residue is not a good measure to guide the choice of the optimal potential . the relative frequency p(a ) ( in % ) of amino acid a ( right - hand column of table 1 ) , as a function of the number of synonyms n(a ) that code for it . the mean frequencies of the individual amino acids ( p(a ) ) in the genomes of living organisms the frequencies p(a ) were computed as averages over the frequencies observed in genomes of archaea ( aeropyrum pernix k1 , archaeoglobus fulgidus , halobacterium sp . nrc-1 , methanococcus jannaschii , methanobacterium thermoautotrophicum , pyrococcus abyssi , pyrococcus horikoshi and thermoplasma acidophilum ) , bacteria ( aquifex aeolicus , bacillus halodurans , bacillus subtilis , borrelia burgdorferi , buchnera aphidicola , campylobacter jejuni , chlamydia trachomatis , deinococcus radiodurans , escherichia coli k-12 , haemophilus influenzae , mycobacterium leprae , mycobacterium tuberculosis , mycoplasma genitalium , mycoplasma pneumoniae , pasteurella multocida , pseudomonas aeruginosa , rickettsia prowazekii , thermotoga maritima , treponema pallidum , ureaplasma parvum , vibrio cholerae and xylella fastidiosa ) and eukaryotes ( arabidopsis thaliana , caenorhabditis elegans , drosophila melanogaster , homo sapiens and saccharomyces cerevisiae ) . fraction of random codes that are fitter than the genetic code fraction f of random codes that have a lower value of the fitness function ,  or  ) than the natural code , using each of the four cost functions g , g , g , g and g. values marked with an asterisk have been obtained by extrapolation as explained in text . the number of randomly generated codes is equal to 10 and the amino - acid frequencies used are the average ones listed in the right - hand column of table 1 . percentage of random amino - acid frequency assignments yielding lower fractions f than the natural one percentage of the sets of random amino - acid frequency assignments for which the fraction f of random codes that beat the natural code is lower than the corresponding fraction computed with the natural frequency p(a ) values . this percentage is estimated for the four cost functions - g , g , g and g - on the basis of 100 random frequencies and , for each of them , 10 random codes . for all cost functions except g , we were only able to give an upper bound ( estimated to be equal to 1% ) , because our sample of random codes is too small and we did not find any random frequency set for which f is lower than that obtained with the natural frequencies . fraction f for different sets of allowed amino - acid interchanges in the alternative codes fraction f of random codes that have a lower value of the fitness function (  ,  or  ) than the natural code , using the cost function g. for the unrestricted set , the f values were estimated from 10 randomly generated codes , where the only constraint is the preservation of the code 's block structure ( as in table 2 ) . for the biosynthesis - restricted set , only permutations of amino acids sharing the same metabolic pathway were considered , that is , interchanges of amino acids contained in one of the four sets { f , s , y , c , w } , { l , p , h , q , r } , { i , m , t , n , k } , { v , a , d , e , g } ( single - letter amino - acid notation ) . as the number of alternative codes is reasonable ( 207,360,000 ) , they have not been randomly chosen , but all have been tested . the degeneracy - restricted set contains results obtained by shuffling only amino acids with the same degeneracy in the natural code , corresponding to the sets { m , w } , { c , d , e , f , h , k , n , q , y } , { i } , { a , g , p , t , v } , { l , r , s}. here also , all 522,547,200 possible codes have been systematically tested . the percentage of optimization of the natural code compared to the optimal alternative ones , as defined in the text , is given in parentheses for . for the two restricted sets , for which all alternative codes were exhaustively generated , the  value of the optimal code was computed exactly . for the unrestricted set , the optimal  value was taken as the best of the unrestricted and two restricted sets .