# Reversible Mutations

In the previous post about mutation predictions I only considered mutations in one direction (for example, from functional to non-functional gene sequences (while non-functional to non-functional mutations were ignored because the outcome is the same).)  However, some mutations can be thought of as reversible.  We could think of a nucleotide position mutating from an "A" to any other base-pair state ("C," "G," or "T") and then back again to an "A."  Or, we could think about changes in a codon that alternate between two different amino acids.  For example "CAT" and "CAC" both code for histidine while "CAA" and "CAG" both code for glutamine in the corresponding polypeptide (protein).  The only change is at the third position so a "T" or "C" is one amino acid and an "A" or "G" is the other.  As the sequence mutates and evolves between these four bases at this position we could think about this as reversible between two amino acid states.

Another type of mutation is even closer to the sense of reversible.  Transposable elements are small stretches of DNA that can insert into a gene sequence, sometimes inactivating the gene, and then later excise out of the sequence, which might restore the original function.  In fact, transposable elements (or "TE's") are quite common in the genome of many organisms.  In the image below is an example from corn (in which TE's were first discovered).  Starting with an individual that has a TE inserted into a gene that produces the purple pigment (so no pigment is produced and the kernels are white) the TE can excise in certain cells (giving purple spots) and may even excise in the germ-line cells so that the next generation has completely restored pigment production.

We can write down the expected frequency in the next generation with reversible mutations as a recursion.  To be an allele at frequency $p$ in generation $g$ you are either already a $p$ type allele in the previous generation $g-1$ and did not mutate away with a mutation rate of $\mu$ (red) or you were the alternative allele at a frequency of $1-p$ and mutated at a rate of $\nu$ (blue).  (Incidentally, the "or" in the sentence implies that we add these two outcomes together rather than multiply because they are mutually exclusive; the allele either mutated or it did not; while the two "and"s in the sentence imply multiplying, the mutation rate and the allele frequency are independent events that have to co-occur to have the effect we are focusing on.)

$p_g=\color{red}{p_{g-1}(1-\mu)} + \color{blue}{(1-p_{g-1})\nu}$.

We could also write this from the alternative alleles point of view $q=1-p$.

$q_g=\color{red}{q_{g-1}(1-\nu)} + \color{blue}{(1-q_{g-1})\mu}$.

Either way works the same in the end, but for the rest of this we are using the $p$ version.

At equilibrium $p_g=p_{g-1}$ so setting the allele frequencies between generations equal to each other gives:

$p=p(1-\mu)+(1-p)\nu$.

Subtract $p$ from both sides to get the terms together.

$p-p=p(1-\mu)+(1-p)\nu-p$

$0=p(1-\mu)+(1-p)\nu-p$

Multiply everything out.

$0=p-p\mu+\nu-p\nu-p$

cancel out $p-p$ on the right

$0=-p\mu+\nu-p\nu$

rearrange

$0=-p\mu-p\nu+\nu$

factor

$0=-p(\mu+\nu)+\nu$

subtract $\nu$ from both sides

$-\nu=-p(\mu+\nu)$

multiply both sides by negative one

$\nu=p(\mu+\nu)$

solve for $p$

$p=\frac{\nu}{\mu+\nu}$

This gives us the equilibrium allele frequency as determined by the forward and backward mutation rates.  Equilibrium values are often designated with a "hat" symbol like this:

$\hat{p}=\frac{\nu}{\mu+\nu}$

From looking at this equation you can see the the equilibrium frequency of an allele is given by the mutation rate to the allele state as a fraction out of the total of the mutation rates, $\frac{\nu}{\mu+\nu}$.  So for example, if $\nu$ is one half of the total rate of mutations (in other words if $\nu=\mu$) then $\hat{p}=\frac{1}{1+1}=\frac{1}{2}$. This seems to make intuitive sense, if different alleles are mutating into each other at the same rate, then over enough time the population will be made up of a 50/50 ratio of the alleles.

Going back to the original equation and multiplying everything out to rearrange the right hand side:

$p_g=p_{g-1}(1-\mu)+(1-p_{g-1})\nu$

$p_g=p_{g-1}-p_{g-1}\mu+\nu-p_{g-1}\nu$

$p_g=p_{g-1}-p_{g-1}\mu-p_{g-1}\nu+\nu$

$p_g=p_{g-1}(1-\mu-\nu)+\nu$

$p_g=p_{g-1}(1-\mu-\nu)+\nu$

$p_{g-1}=p_{g-2}(1-\mu-\nu)+\nu$

$p_{g-2}=p_{g-3}(1-\mu-\nu)+\nu$

substituting back in gives:

$p_g=p_{g-1}(1-\mu-\nu)+\nu$

$p_g=(p_{g-2}(1-\mu-\nu)+\nu)(1-\mu-\nu)+\nu$

$p_g=((p_{g-3}(1-\mu-\nu)+\nu)(1-\mu-\nu)+\nu)(1-\mu-\nu)+\nu$

which is

$p_g=p_{g-3}(1-\mu-\nu)^3+\nu(1-\mu-\nu)^2+\nu(1-\mu-\nu)+\nu$

which can be written in a summation series as

$p_g=p_0(1-\mu-\nu)^g + \displaystyle{\sum_{n=0}^{g-1}} \nu(1-\mu-\nu)^n$

or (pulling $\nu$ out of the sum)

$p_g=p_0(1-\mu-\nu)^g + \nu \displaystyle{\sum_{n=0}^{g-1}} (1-\mu-\nu)^n$

I'm not sure this is very helpful.  The sum on the right is hard to work with.  It would probably be easier to plot the change over time by simply iterating the original recursion equation.  However, one interesting thing about the equation above is the term $p_0(1-\mu-\nu)^g$ goes to zero as $g$ becomes large because a large number of numbers less than one are being multiplied together.  This makes sense because as $g$ becomes large the equilibrium is approached and the initial condition $p_0$ matters less and less.  In fact, using this logic, and letting $g$ go to infinity, $\infty$, we could write down:

$\hat{p}=\frac{\nu}{\mu+\nu}=\nu \displaystyle{\sum_{n=0}^{\infty}} (1-\mu-\nu)^n$

dividing by $\nu$ gives:

$\frac{1}{\mu+\nu}= \displaystyle{\sum_{n=0}^{\infty}} (1-\mu-\nu)^n$

which makes sense in the sense that the equilibrium allele frequency is only a function of the mutation rates (again the starting point should disappear because after an infinite number of steps toward a single equilibrium the result will be the same no matter where you started).

Is it known in general that this infinite series reduction pattern is true?  If we set $b=\mu+\nu$ then

$\frac{1}{\mu+\nu}= \displaystyle{\sum_{n=0}^{\infty}} (1-\mu-\nu)^n$

becomes:

$\frac{1}{b}= \displaystyle{\sum_{n=0}^{\infty}} (1-b)^n$.

Then setting $a=1-b$ gives:

$\frac{1}{1-a}= \displaystyle{\sum_{n=0}^{\infty}} a^n$

This is a classic result of an infinite sum of a geometric series.  (It is called geometric because raising $a$ to the $n$ is like adding dimensions in geometry.  $a^0$ is a point; $a^1$ is a line of length $a$; $a^2$ is a square with sides of length $a$; $a^3$ is a cube with edges of length $a$; etc.)

Also, looking at $p_g=p_0(1-\mu-\nu)^g + \nu \displaystyle{\sum_{n=0}^{g-1}} (1-\mu-\nu)^n$ again.  If we have a total mutation rate $M=\mu+\nu$ then the first part of the equation, $p_0(1-\mu-\nu)^g = p_0(1-M)^g$, is basically the same as the simpler model of irreversible mutation, $p_g=p_0(1-\mu)^g$.  So we can interpret the first part of this equation, $p_0(1-\mu-\nu)^g$, as the fraction of alleles that have not mutated yet.  Of course this will disappear as the equilibrium is approached.

Backing up to

$p_g=p_0(1-\mu-\nu)^g + \nu \displaystyle{\sum_{n=0}^{g-1}} (1-\mu-\nu)^n$

and looking at the part on the right.  Now that we realize this is a geometric series we might be able to reduce the finite series.

A finite geometric series can be reduced by

$\frac{1-a^g}{1-a}= \displaystyle{\sum_{n=0}^{g-1}} a^n$            (link)

As above, substituting $a=1-b=1-(\mu+\nu)=1-\mu-\nu$ and realizing $1-a=b=\mu+\nu$

$\nu \displaystyle{\sum_{n=0}^{g-1}} (1-\mu-\nu)^n = \nu \frac{1 - (1-\mu-\nu)^g}{\mu+\nu} = \frac{\nu - \nu(1-\mu-\nu)^g}{\mu+\nu}$.

Again, as $g$ goes to infinity $(1-\mu-\nu)^g$ goes to zero and $\frac{\nu - \nu(1-\mu-\nu)^g}{\mu+\nu}$ becomes $\frac{\nu}{\mu+\nu}$.

So, to be able to directly calculate the allele frequency at any point along the way as reversible mutations drive the system from a starting point toward equilibrium the equation is:

$p_g=p_0(1-\mu-\nu)^g +\frac{\nu- \nu (1-\mu-\nu)^g}{\mu+\nu}$,

which can be simplified to:

$p_g=\frac{\nu+(p_0(\mu+\nu)-\nu)(1-\mu-\nu)^g}{\mu+\nu}$.

This can be divided into an equilibrium component $\frac{\nu}{\mu+\nu}$ and a component quantifying the deviation from equilibrium due to the starting point $p_0$ and the time since starting $g$:

$p_g=\frac{\nu}{\mu+\nu}+\frac{(p_0(\mu+\nu)-\nu)(1-\mu-\nu)^g}{\mu+\nu}$

or

$p_g=\hat{p}+\frac{(p_0(\mu+\nu)-\nu)(1-\mu-\nu)^g}{\mu+\nu}$

Here is an example plot showing the predicted decline in allele frequency from 100% (blue) and the rise from 0% (red) compared to the equilibrium (yellow) where one mutation rate is a fifth of the other: $\nu = 10^{-4}$ and $\mu= 2 \times 10^{-5}$.  (Generations is on the x-axis and allele frequency is on the y-axis.)

So, by 50,000 generations, which again is not that long compared to geologic timescales, the allele frequency is predicted to essentially arrive at an equilibrium.  In this case we expect it to be $0.8\bar{3} = \frac{5}{6} = \frac{10}{12} = \frac{10^{-4}}{10^{-4} + 2 \times 10^{-5}} = \frac{\nu}{\nu + \mu}$

Exactly how long does it take to converge?  The allele frequency trajectories asymptotically approach equilibrium so they will never be exactly equal.  We could however ask when the difference is below a certain threshold.  If we start one $p_0=1$ and the other $p_0=0$ this is the largest difference, $d$, we can begin with.  The difference between the two trajectories is (with zero and 1 substituted for $p_0$ in red):

$d=(\frac{\nu}{\mu+\nu}+\frac{(\color{red}{1}(\mu+\nu)-\nu)(1-\mu-\nu)^g}{\mu+\nu}) - (\frac{\nu}{\mu+\nu}+\frac{(\color{red}{0}(\mu+\nu)-\nu)(1-\mu-\nu)^g}{\mu+\nu})$

We can immediately get rid of the difference in the equilibrium components $\frac{\nu}{\mu+\nu}-\frac{\nu}{\mu+\nu}$, which is zero.  Also multiplying by one and zero simplifies the equation a little more.  Long story short, a lot cancels out and we end up with something familiar:

$d=(1-\mu-\nu)^g$,

which makes a lot of sense.  We realized above that this was the fraction that had not yet mutated, which is the reason the curve deviates from equilibrium (i.e. starting points are different).

Solving for $g$ to get the number of generations gives us:

$g=\frac{\log(d)}{\log(1-\mu-\nu)}$.

Plugging in the mutation rates from the example above we find that the difference in highest and lowest trajectories drops to less than 1% after 38,375 generations.

The probability that a transposable element inserts into a specific gene sequence is very small.  Once it is inserted (and sticking with simplistic assumptions here) the probability it will excise is likely much higher than the insertion in the first place.  Say we had data from huge fields of purple kernel color corn that had been maintained for many generations.  In, let's say, 3% of these we find a mutation due to a transposable element that prevents the pigment from being produced.  Assuming the population is at or very near to equilibrium what can we say about the insertion versus excision relative mutation rates?

$\hat{p}=\frac{\nu}{\mu+\nu}$

can be rearranged to

$\frac{1}{\hat{p}} - 1 = \frac{\mu}{\nu}$.

Setting $\hat{p} = 0.03$ gives

$\frac{\mu}{\nu} \approx 32$

So in this example, the excision rate is approximately 32 times higher than the insertion rate.  (If you define $\mu$ as the excision rate and $\nu$ as the insertion rate.  We can alternatively set $\hat{p} = 1 - 0.03 = 0.97$ and switch the symbols for the insertion and excision rates but the result is the same.)

Backing up to a more basic level, why is there an equilibrium at all?  We might also intuitively think that if one mutation rate is higher than the other that we would eventually end up with all of one type (allele) in the population.  (Actually this can happen when we start talking about drift in finite population but we are still ignoring that at the moment and pretending populations are so large that they are essentially infinite and even tiny fractions will be present.)  The trick to thinking about this is that as one allele becomes rarer it is a smaller target for mutations in the population.  As it becomes more common and in more copies there are more opportunities for mutations to occur to change the allele into a different form.  This frequency effect "buffers" the alleles towards intermediate frequencies, so an allele is never quite lost or fixed and we end up with an equilibrium.