  Models of codon evolution are commonly used to identify positive selection.
Positive selection is typically a heterogeneous process, i.e., it acts on some
branches of the evolutionary tree and not others. Previous work on DNA models
showed that when evolution occurs under a heterogeneous process it is important
to consider the property of model closure, because non-closed models can give
biased estimates of evolutionary processes. The existing codon models that
account for the genetic code are not closed; to establish this it is enough to
show that they are not linear (meaning that the sum of two codon rate matrices
in the model is not a matrix in the model). This raises the concern that a
single codon model fit to a heterogeneous process might mis-estimate both the
effect of selection and branch lengths.
  Codon models are typically constructed by choosing an underlying DNA model
(e.g., HKY) that acts identically and independently at each codon position, and
then applying the genetic code via the parameter $\omega$ to modify the rate of
transitions between codons that code for different amino acids. Here we use
simulation to investigate the accuracy of estimation of both the selection
parameter $\omega$ and branch lengths in cases where the underlying DNA process
is heterogeneous but $\omega$ is constant. We find that both $\omega$ and
branch lengths can be mis-estimated in these scenarios. Errors in $\omega$ were
usually less than 2% but could be as high as 17%. We also assessed if choosing
different underlying DNA models had any affect on accuracy, in particular we
assessed if using closed DNA models gave any advantage. However, a DNA model
being closed does not imply that the codon model constructed from it is closed,
and in general we found that using closed DNA models did not decrease errors in
the estimation of $\omega$.
