\section{Introduction} This paper is a continuation of our work \cite{HP} where we studied the non uniqueness for the ab-family of equations in non periodic case. The goal of this paper is to prove the same result in periodic case. We consider the Cauchy problem for the  ab- family of equations
	\begin{align}\label{eq1}
	&u_t+u^2u_x-au_x^3+D^{-2}\partial_x\big[\frac{b}{3} u^3+\frac{6-6a-b}{2}uu_x^2\big]+D^{-2}\big[\frac{2a+b-2}{2}u_x^3\big]=0
	\\
	&u(x,0) = u_0(x), \label{eq1-data}
	\end{align}
	where $u_0(x) \in H^s (\mathbb R)$, for $s<3/2$ and $t\in \mathbb R, \ x\in \frac{\mathbb R}{2\pi \mathbb Z}$.

	The two parameters $a$, $b\in \mathbb R$ and we will assume $a\neq 0$.  $u_t$
	and $u_x$ denote the derivatives of $u$ with respect to $t$ and $x$, $\partial_x$
	denotes differentiation with respect to $x$, and the non-local operator
	$D^{-2} = (1-\partial_x^2)^{-1}$
	is the inverse Fourier transform of $(1+\xi^2)^{-1} $. The local form of ab-family is given by
	\begin{equation}\label{eq111}
	\begin{split}
	(1-\partial_x^2)u_t+(b+1)u^2u_x-3au_x^3-(6a+b)uu_xu_{xx}
	+ 6au_xu_{xx}^2-u^2u_{xxx}+3au_x^2u_{xxx}=0.
	\end{split}
	\end{equation}

	Peakon traveling wave solutions were discovered in 1978 by Fornberg and Whitham \cite{FW} and then by Camassa and Holm [CH] in their quest for a water wave model that could capture wave breaking. Peakons have discontinous spatial derivatives at their peaks so they make sense only as distributional solutions, see \cite{Ama} for details. The periodic one peakon of the ab-family (\ref{eq1}) is given by
	$$
	u(x,t) = \pm \sqrt{c}\big(1+(1-a)\sinh^2\pi\big)^{-1/2}\cosh({[x-ct]_p-\pi}).
	$$

	where $c>0$ and   where $[.]_p$ makes a quantity $2\pi$ periodic via $[x]_p=x-2\pi\lfloor{\frac{x}{2\pi}\rfloor}.$

	The well-posedness theory for the ab-family is not completely understood. Two members of ab-family (\ref{eq1}) have been studied extensively in different contexts by several researchers. In particular, the choice of parameters $a = 1/3$, $b = 2$ corresponds to the Fokas-Olver-Rosenau-Qiao (FORQ) equation derived in Fokas \cite{F}, Fuchssteiner \cite{Fu}, Olver and Rosenau \cite{OR}, and Qiao \cite{Q};
	while the choice a = 0, b = 3 gives the Novikov equation (NE) derived by Novikov \cite{N}. Himonas and Mantzavinos \cite{HMA} showed that FORQ is well-posed in $H^s$, with $s>5/2$ and this was extended to a four-parameter family in \cite{HMA2} which includes the $ab$-family. A nonuniqueness result by Himonas and Holliman \cite{AH} showed that the FORQ equation is ill-posed in $H^s$ for any $s<3/2$ for both periodic and non-periodic case. There is no theory concerning well-posedness in the gap $3/2\le s\le 5/2$. In contrast, the NE is well-posed in $H^s$ for all $s>3/2$, see \cite{BO} for details, and Himonas, Kenig and Holliman \cite{HKM} showed ill-posedness in $H^s$ for $s<3/2$. Both the ill-posedness results for the NE equation and the FORQ equation study the behavior of the solution near the time of collision of a 2-peakon solution. We use similar idea of constructing specific 2-peakon solutions and the existence of collision time to prove  non-uniqueness for the ab-family of equations in $H^s$ for all $s<3/2$ in our earlier paper \cite{HP}. Perhaps the most interesting phenomenon discovered in our paper \cite{HP}, is that multipeakon solutions to the ab-equation interact unlike classical solitons. For some values of $a$ and $b$,  we proved that our 2-peakon solutions are entangled and do not seem to separate and  smaller solitons can begin behind larger solitons, and yet, they collide. The main theorem of this paper is stated  as below.
	\begin{theorem}\label{main-thm} For all $b \in \mathbb{R}$ and $a \neq 0$, solutions to the Cauchy problem for the ab- family of equations are not unique in $H^s$ on circle when $ s<3/2$.
	\end{theorem}
	Our proof of nonuniqueness for the periodic case follows the same strategy as used in  the real line case \cite{HP}. The paper is organized as follows. In the next section, we study the relationship between the system of ODEs with multipeakon solutions of the ab-family of equations on circle.  Later we will prove that the collision profile is indeed a single peakon solution and use this to establish the nonuniqueness.

	\section{The ODE System}

	\begin{lemma}{ \cite{Ama} } The   periodic 2-peakon  function
		\begin{equation}\label{eq4}
		u(x,t)=p_1(t)\cosh([x-q_1(t)]_p-\pi)+ p_2(t)\cosh([x-q_2(t)]_p-\pi),
		\end{equation}
		solves the ab-equation on circle if and only if the positions $q_1, q_2$ and the momenta $p_1, p_2$ satisfy the $4\times 4$ system of ordinary differential equations:
		\begin{equation} \label{eq5}
		\begin{split}
		q_1^{'} & = p_1^2[1+(1-a)\sinh ^2\pi]+2p_1p_2\cosh \pi \cosh ([q_1-q_2]_p-\pi)+p_2^2[1+(1-3a)\sinh^2([q_1-q_2]_p-\pi)],\\
		q_2^{'}& = p_2^2[1+(1-a)\sinh ^2\pi]+2p_1p_2\cosh \pi \cosh ([q_2-q_1]_p-\pi)+p_1^2[1+(1-3a)\sinh^2([q_2-q_1]_p-\pi)],\\
		p_1^{'}& = (2-b)p_1p_2 \sinh([q_1-q_2]_p-\pi)\cdot [p_1\cosh \pi +p_2 \cosh([q_1-q_2]_p-\pi)],\\
		p_2^{'}& = (2-b)p_1p_2 \sinh([q_2-q_1]_p-\pi)\cdot [p_2\cosh \pi +p_1 \cosh([q_2-q_1]_p-\pi)],
		\end{split}
		\end{equation}
		where $[.]_p$ makes a quantity $2\pi$ periodic via $[x]_p=x-2\pi\lfloor{\frac{x}{2\pi}\rfloor}.$
	\end{lemma}

	The solution $u$ is a $2\pi$ periodic function and for simplicity, we will restrict our attention to the interval $[0, 2 \pi].$ We define
	$
	q(t) \  \dot= \ q_2 - q_1,
	$
	$h \  \dot= \ p_2 - p_1$, $w\dot = p_1 +p_2$
	and $z \  \dot= \ p_1 p_2$.
	\begin{align}\label{qhwz-system}
	\begin{aligned}[c]
	q' &=  hw\big[(1-a) \sinh^2\pi +(3a-1)\sinh^2([q]_p-\pi)\big].,\\
	h' &= (2-b) wz \sinh([q]_p-\pi)\big[\cosh(\pi)+\cosh([q]_p-\pi) \big],\\
	w' &=(2-b) hz\sinh([q]_p-\pi)\big[\cosh(\pi)-\cosh([q]_p-\pi) \big] ,\\
	z' &= -(2-b) hwz \sinh([q]_p-\pi)\cosh([q]_p-\pi) ,
	\end{aligned}
	\qquad
	\begin{aligned}[c]
	q(0)&= q_2(0) - q_1(0) =  \mu   ,\\
	h(0)&= p_2(0) - p_1(0) = h_0,\\
	w(0) &= p_1(0) + p_2(0) = w_0, \\
	z(0)&= p_1(0)  p_2(0) = z_0,
	\end{aligned}
	\end{align}
	where  $\mu, h_0, w_0, z_0$ are any real numbers. We will assume that, $q_1 (0)= 0$
	and $q_2(0) = \mu >0$, and therefore, by continuity,  $q(t) \ge 0$ for some
	$0 \le t \le T^c$, where $T^c $ is the collision time. From the system of equations (\ref{eq5}), we have
	\begin{equation}\label{eq6}
	\begin{split}
	q^{'}=q_2^{'}- q_1^{'} & =(p_2^2-p_1^2)\big[(1-a) \sinh^2\pi +(3a-1)\sinh^2([q]_p-\pi)\big].
	\end{split}
	\end{equation}
	Additionally, we define  $p(t)=p_2^2(t)-p_1^2(t)$. Now,
	\begin{equation}\label{eq7}
	\begin{split}
	p^{'}=2p_2p_2^{'}- 2p_1p_1^{'} & =2(2-b)p_1p_2 \sinh([q_2-q_1]_p-\pi)\big[(p_1^2+p_2^2)\cosh\pi+2p_1p_2\cosh([q_2-q_1]_p-\pi)\big].
	\end{split}
	\end{equation}

	If  $a=1/3$, then $\big[(1-a) \sinh^2\pi +(3a-1)\sinh^2([q]_p-\pi)\big] =2/3 \sinh^2\pi$. We set $q(0)=\mu>0$ to be a small positive number. Else, we can always find a number $c, \ 1<c<2$  such that
	$$
	0<  \mu = \mu(a) =[\mu]_p= \pi +\sinh^{-1}\bigg(\pm \sqrt{\frac{a(c+\sinh^2\pi)-1}{3a-1}}\bigg) ,
	$$
	which implies
	$$
	L_a(\mu) \ \dot = \ \big[(1-a) \sinh^2\pi +(3a-1)\sinh^2([\mu]_p-\pi)\big] = c a .
	$$
	We note that as $ q$ tends to $0$, $\big[(1-a) \sinh^2\pi +(3a-1)\sinh^2([q]_p-\pi)\big]$ tends to $2a\sinh^2\pi$, and therefore, the sign of this term remains constant. Also, $L_a(\mu) $ can never take the value $0$ when $a\neq 0$ on the domain $ \mu \ge 0$.
	\begin{proposition}
		If  $a \neq 0 $, the initial value problem \eqref{qhwz-system} has a unique smooth solution on some positive time interval. Furthermore, the functions $h(t )$ and $w(t)$ and $z(t)$ remain  bounded for all $ q(t)\geq 0 $.

	\end{proposition}

	\begin{proof}
		The right hand side of the  system \eqref{qhwz-system} is smooth in the arguments $q,h,w,z$ and therefore, by the ODE theorem, has a solution on some time interval $[0, T)$, $T>0$. We define $E(x)=\cosh([x]_p-\pi)$ and $E^{'}(x)=\sinh([x]_p-\pi).$ We now derive the relations between $h, w, z$ and $q$ from (\ref{qhwz-system}).
		\begin{align}\label{qhwz1-system}
		\begin{aligned}[c]
		q' &=  hw\big[(1-a) \sinh^2\pi +(3a-1)(E^{'}(q))^2\big],\\
		h' &= (2-b) wz E^{'}(q)\big[\cosh(\pi)+E(q) \big],\\
		w' &=(2-b) hzE^{'}(q)\big[\cosh(\pi)-E(q) \big] ,\\
		z' &= -(2-b) hwz E(q)E^{'}(q).
		\end{aligned}
		\end{align}
		We follow the same strategy as in the non-periodic case.\\
		\textbf{Expressing $z$ interms of $q$:} Beginning with $z$, from the equations (\ref{qhwz1-system}) with $z'$ and $q'$ we find
		\begin{align*}
		\frac{z'}{z} = \frac{ -(2-b)E(q)E^{'}(q)q'}
		{ \big[(1-a) \sinh^2\pi +(3a-1)(E^{'}(q))^2\big]}.
		\end{align*}
		Therefore, we have
		\begin{align*}
		\frac{d}{dt} \ln|z|  =  \frac{(2-b)}{2(1-3a)}  \frac{d}{dt } \ln |(1-a) \sinh^2\pi +(3a-1)(E^{'}(q))^2 | .
		\end{align*}
		If $z_0 >0$, then by continuity, we can assume $z>0$ for some time and $|z| = z$. Likewise, if $z_0 < 0$, we will assume $|z| = -z$. In either case, integrating from $0$ to $t$ yields,
		\begin{align}
		\ln \left( \frac{z(t)}{z_0} \right) =  \frac{(2-b)}{2(1-3a)} \ln \left(  \frac{ (1-a) \sinh^2\pi +(3a-1)(E^{'}(q))^2  }{  (1-a) \sinh^2\pi +(3a-1)(E^{'}(\mu))^2  }  \right) .
		\end{align}
		We exponentiate and rearrange terms to find the expression $z$ interms of $q$

		\begin{align}\label {z-eq}
		z(t) =    z_0  \left(  \frac{ (1-a) \sinh^2\pi +(3a-1)(E^{'}(q))^2  }{ (1-a) \sinh^2\pi +(3a-1)(E^{'}(\mu))^2 }  \right)^{  \frac{(2-b)}{2(1-3a)}} .
		\end{align}
		From here we can conclude that $z(t) $ remains bounded for all $ t \in [0, T^c]$, since neither the numerator nor the denominator take the value $0$. \\

		\textbf{Expressing $h$ interms of $q$:} Now, we  will use the above formula for $z(t)$ to find $h(t)$. We have
		\begin{align*}
		\frac{h'}{q'} =  \frac{(2-b) wz E^{'}(q)\big[\cosh(\pi)+E(q) \big] } {  hw\big[(1-a) \sinh^2\pi +(3a-1)(E^{'}(q))^2\big]},
		\end{align*}
		or rearranging we find

		\begin{align*}
		h h'  =  z\cdot   \frac{(2-b) E^{'}(q)\big[\cosh(\pi)+E(q) \big]q^{'} } {  \big[(1-a) \sinh^2\pi +(3a-1)(E^{'}(q))^2\big]}.
		\end{align*}
		We substitute the formula found for $z$ in equation \eqref {z-eq} to get
		\begin{align*}
		h h'  = z_0  \left(  \frac{ (1-a) \sinh^2\pi +(3a-1)(E^{'}(q))^2  }{ (1-a) \sinh^2\pi +(3a-1)(E^{'}(\mu))^2 }  \right)^{  \frac{(2-b)}{2(1-3a)}}  \frac{(2-b) E^{'}(q)\big[\cosh(\pi)+E^(q) \big]q^{'} } {  \big[(1-a) \sinh^2\pi +(3a-1)(E^{'}(q))^2\big]} .
		\end{align*}
		We define
		\begin{align}\label{f-def}
		g(q) \ \dot = z_0  \left(  \frac{ (1-a) \sinh^2\pi +(3a-1)(E^{'}(q))^2  }{ (1-a) \sinh^2\pi +(3a-1)(E^{'}(\mu))^2 }  \right)^{  \frac{(2-b)}{2(1-3a)}}  \frac{(2-b) E^{'}(q) } {  \big[(1-a) \sinh^2\pi +(3a-1)(E^{'}(q))^2\big]},
		\end{align}
		and then define
		$$
		G_1 (q) \ \dot = \ \int_0^t   (\cosh(\pi)+E(q)) g(q)  dq  .
		$$
		Since $g(q)$ is smooth and bounded for all $q \ge 0$ (since the denominator is singular only when $a = 0$), $G(q) $ remains smooth, bounded  and differentiable for all $0\le t\le T^c$.
		Therefore,
		$$
		h^2   = h_0^2 + 2 G_1(q) ,
		$$
		remains bounded for all $0\le t \le T^c$.\\
		\textbf{Expressing $w$ interms of $q$:} Next we solve for $w(t)$. We rearrange the equations for $w'$ and $q'$ to find
		\begin{align*}
		ww' =  z\cdot   \frac{(2-b) E^{'}(q)\big[\cosh(\pi)-E(q) \big]q^{'} } {  \big[(1-a) \sinh^2\pi +(3a-1)(E^{'}(q))^2\big]}  = (\cosh(\pi)-E(q) ) g(q) q',
		\end{align*}
		where we used the definition of $g(q)$ found in equation \eqref{f-def} and the formula for $z$ found in equation \eqref {z-eq}.

		Define
		$$
		G_2 (q) \ \dot = \ \int _0^t (\cosh(\pi)-E(q) ) g(q) dq ,
		$$
		we find
		$$
		w^2 = w_0^2 + 2 G_2 (q),
		$$
		and similarly to $h$, $w$ remains smooth and bounded for all $0\le t \le T^c$.
	\end{proof}
	Since $p_1 = \frac12(w-h)$ and $p_2 = \frac12(h+w)$, the above proposition shows that as long as $ q \ge 0$, $p_1, p_2 <\infty$. We will next  choose the initial values for $p_1(0)$ and $p_2(0)$ to be consistent with the above proposition and which will necessarily lead to a collision time $T^c<\infty.$ We will show that $T^c$ exists  and find an upper bound by showing $q'(t)$ is bounded by a negative number so long as $q(t)$ remains non-negative. More precisely, we will prove the following Theorem.
	\begin{theorem} {\label{thm2}}For all $b \in \mathbb {R} $ and $a\neq 0$, there exists an initial multipeakon profile on circle such that for some $\epsilon>0$,  $\frac{dq}{dt} < -\epsilon  <0$ for $t\in [0, T^c)$ (and hence $T^c<\infty$) or there exists a time $T^p$ such that at least one of $p_1(T^p)  =0$ or $p_2(T^p) = 0$.
	\end{theorem}

	\begin{proof} If $\min\{T^p, T^c\} = T^p$ and $T^p<\infty$, we are done. Therefore, we will assume $p_1(t)$ and $p_2(t)$ do not equal zero. By continuity, whatever the sign of their initial data is, we may assume the solutions take as well.
		We will prove the theorem in four cases, based upon the values of $a$ and $b$, omitting the trivial case when $b=2$. For each case, we will consider the function $p(t)$ and $q(t)$. From (\ref{eq6}) and (\ref{eq7}),
		\begin{align}\label{eq110}
		q'(t) &=p(t)\big[(1-a) \sinh^2\pi +(3a-1)\sinh^2([q]_p-\pi)\big],
		\\
		\label{eq10}
		p'(t)&=2(b-2)p_1p_2 \sinh(\pi-[q]_p)\big[(p_1^2+p_2^2)\cosh\pi+2p_1p_2\cosh([q]_p-\pi)\big].
		\end{align}

		\noindent{\bf Case 1: $ a>0, b>2$.}
		We take the initial data
		$$
		p_1(0)=\alpha + \delta,\ q_1(0)=0, \ p_2(0)= -\alpha,\ q_2(0)=\mu.
		$$

		By the choice of our initial data:
		$$p(0)=p_2^2(0)-p_1^2(0)= -(2\alpha \delta + \delta^2)<0, \text{ and } q(0)=q_2(0)-q_1(0)= \mu >0. $$

		Since $p_2(0)=-\alpha <0$ and $p_1(0)= \alpha + \delta >0, \ p_1(0)p_2(0) <0$ and by continuity $p_1(t)p_2(t) <0$.

		We will now show that for all $0\le t \le T^c$,
		$$\frac{dp}{dt}=2(b-2)p_1p_2 \sinh(\pi-[q]_p)\big[(p_1^2+p_2^2)\cosh\pi+2p_1p_2\cosh([q]_p-\pi)\big]<0.$$
		Indeed, the following calculation shows that  $\big[(p_1^2+p_2^2)\cosh\pi+2p_1p_2\cosh([q]_p-\pi)\big]>0.$
		Use the fact that  $\cosh\pi > \cosh([q]_p-\pi)$
		to compute
		\begin{equation}
		\begin{split}
		\big[(p_1^2+p_2^2)\cosh\pi+2p_1p_2\cosh([q]_p-\pi)\big]\geq
		& (p_1^2+p_2^2)\cosh([q]_p-\pi)+2p_1p_2 \cosh([q]_p-\pi)\\
		& = (p_1+p_2)^2\cosh([q]_p-\pi)\geq 0.
		\end{split}
		\end{equation}

		We notice that for all $0\le t \le T^c$ either $ \sinh(\pi-[q]_p)\geq0$ or $\sinh(\pi-[q]_p)\leq0.$  \\
		\textbf{Remarks}: We may assume the case with $ \sinh(\pi-[q]_p)\geq0$. Otherwise we may need to choose the different initial profile such that $\frac{dp}{dt}$ becomes negative by having $p_1p_2>0.$ That means we need to treat the case differently by having a initial profile (similar to the case 2 below).$$
		p_1(0)=\alpha +\delta,\ q_1(0)=0, \ p_2(0)= \alpha ,\ q_2(0)=\mu.
		$$ Either way, our method works and gives the same result. \\[.1in]
		For simplicity, we may assume $ \sinh(\pi-[q]_p)\geq0$. Therefore, $\frac{dp}{dt} <0$. Now, we may use the fact that $p(t) < p(0)<0$.  Substituting this into  equation (\ref{eq110}), we have

		$$\frac{dq}{dt} \leq  p(0)\big[(1-a) \sinh^2\pi +(3a-1)\sinh^2([q]_p-\pi)\big] .$$

		The right hand side is negative, since initially $0< a \le L_a(\mu)  = ca \le 2a$, and as $q  $ decreases,
		$$
		ca \le\big[(1-a) \sinh^2\pi +(3a-1)\sinh^2([q]_p-\pi)\big]  \le 2a.
		$$
		Therefore we compute $\epsilon$:
		$$\frac{dq}{dt} \leq a p(0) = -a(2\alpha \delta + \delta^2) =-\epsilon <0 $$  Hence, either $p_1(t) = 0$, $p_2(t) = 0$, or $q(t) = 0$ in finite time.  \\[.1in]
		\textbf{Note: } We assume that $ \sinh(\pi-[q]_p)\geq0$ for all our cases. We can proof the theorem similarly with the case $ \sinh(\pi-[q]_p)\leq0$  but only difference will be to choose different initial profile as described above in the case 1. That means there exist an initial profile which guarantees the statement of the theorem.

		\noindent{\bf Case 2: $a>0, b<2 $.} For this case, we take the two peakon initial profile:
		$$
		p_1(0)=\alpha +\delta,\ q_1(0)=0, \ p_2(0)= \alpha ,\ q_2(0)=\mu.
		$$
		By the choice of our initial data
		$$p(0)=p_2^2(0)-p_1^2(0)= -(2\alpha \delta + \delta^2)<0, \ q(0)=q_2(0)-q_1(0)= \mu >0. $$
		Since $ p_1(0)p_2(0) >0$, by continuity $p_1(t)p_2(t) >0$ for $t\in [0, T^c)$. We have
		$$\frac{dp}{dt}=2(b-2)p_1p_2 \sinh(\pi-[q]_p)\big[(p_1^2+p_2^2)\cosh\pi+2p_1p_2\cosh([q]_p-\pi)\big]<0.$$
		Thus,   $p(t)<p(0) <0 \ \forall t\in [0, T^c).$ Now from the equation (\ref{eq110}),

		$$\frac{dq(t)}{dt} \leq  p(0)\big[(1-a) \sinh^2\pi +(3a-1)\sinh^2([q]_p-\pi)\big]  \ \text{for} \ t\in [0, T^{c}],$$
		and, similarly to the first case
		$$\frac{dq(t)}{dt} \leq a p(0) = -a(2\alpha \delta + \delta^2)  =-\epsilon  <0.
		$$
		Thus, we have shown that there exists an initial profile such that either $p_1(t) = 0$, $p_2(t) = 0$, or $q(t) = 0$ in finite time.

		\noindent{\bf Case 3: $a<0, b>2$.}
		Similar to Case 2, we take the two peakon initial profile:
		$$
		p_1(0)=\alpha ,\ q_1(0)=0, \ p_2(0)= \alpha +\delta,\ q_2(0)=\mu.
		$$
		By the choice of our initial data
		$$p(0)=p_2^2(0)-p_1^2(0)= (2\alpha \delta + \delta^2)>0, \ q(0)=q_2(0)-q_1(0)= \mu >0. $$
		Also, by continuity $p_1(t)p_2(t) >0$. We will assume this hold for $t \in [0, T^c)$, thus
		$$\frac{dp}{dt}=2(b-2)p_1p_2 \sinh(\pi-[q]_p)\big[(p_1^2+p_2^2)\cosh\pi+2p_1p_2\cosh([q]_p-\pi)\big]>0.$$
		and therefore,   $p(t)>p(0)>0 $.

		Recalling the choice of $\mu$, we have $ L_a(\mu) =ca<0$ and $\Lim{q\to \ 0}L_a(q)=2a <0.$
		Hence,
		\begin{equation}\label{l-est}
		2a <L_a(q(t)) < ca <0, t\in [0, T^c) .
		\end{equation}
		Therefore,
		using equation (\ref{eq110}) we have
		$$\frac{dq(t)}{dt}=  p(t)L_a(q(t) )  \leq  p(0)\cdot ca = -\epsilon<0 .
		$$
		Again, this shows that there exists an initial profile such that $p_1(t) = 0$, $p_2(t) = 0$, or $q(t) = 0$ in finite time.

		\noindent{\bf Case 4: $a<0, b<2$.}
		Similar to Case 1, we take a  peakon-antipeakon initial profile:
		$$
		p_1(0)=-\alpha ,\ q_1(0)=0, \ p_2(0)= \alpha +\delta,\ q_2(0)=\mu,
		$$
		and as before, we will assume $T^c \le T^p$. By the choice of our initial data $$p(0)=p_2^2(0)-p_1^2(0)= (2\alpha \delta + \delta^2)>0, \text{ and }q(0)=q_1(0)-q_2(0)= \mu >0. $$
		Since $ p_1(0)p_2(0) <0$, by continuity $p_1(t)p_2(t) <0$, and therefore an argument similar to the argument presented in Case 1 shows
		$$\frac{dp}{dt}=2(b-2)p_1p_2 \sinh(\pi-[q]_p)\big[(p_1^2+p_2^2)\cosh\pi+2p_1p_2\cosh([q]_p-\pi)\big]>0,$$
		thus $p(t)>p(0)>0 \ \forall \ t\in [0, T^c).$
		Therefore, using equation \eqref{eq110} and the estimate in inequality \eqref{l-est} we have again
		$$\frac{dq(t)}{dt}= p(t)L_a(q(t)) \leq  a c \cdot p(0)   = -\epsilon<0 .$$
		This completes the fourth case, and we have shown that for every choice of $a$ and $b$, there is an initial profile which leads to  $\min\{T^p, T^c\} < \infty$.
	\end{proof}

	\textbf{Remarks:} We can actually estimate the time of collision $T^c$ by using above theorem (\ref{thm2}) and it is given by $$T^c \leq \frac{\mu}{\epsilon}.$$

	\subsection{Proof of Theorem \ref{main-thm}}
	To complete the proof of Theorem \ref{main-thm}, we will show that at time, $T = \min\{T^c, T^p\}$, the solution to the Cauchy problem of ab-family of equations \eqref{eq1}-\eqref{eq1-data} with the initial profiles depending upon $a$ and $b$, is either a single peakon or the zero solution. We define the collision function:
	\begin{equation}\label{eq18}
	C(x)=p^*\cosh([q ^*]_p-\pi),
	\end{equation}
	where if $T = T^c$, $q ^* = \Lim{t\to \ T^-} q_1(t) $ is the location of the collision and $p^{*}= \Lim{t\to \ T^-}(p_1(t)+p_2(t))$ is the magnitude of the collision. We define $q ^* = \Lim{t\to \ T^-} q_j(t) $. If $ T = T^p$, then  $\Lim{t\to \ T^-} p_i(t) = 0$, and $ \Lim{t\to \ T^-}p_j (t) \neq0$ for $i,j \in \{1,2\}$.  The choice in $q^*$ is irrelavent if both $p_1$ and $p_2$ converge to zero at time $T$, since $C(x) = 0$.
	Now we will show that the solution converges to the collision function as shown in the following lemma.
	\begin{lemma}
		The $H^{s}$  limit of $u$, as $t$ approaches $T$ from below is C:
		$$\lim_{t\to \ T^{-}}||u(t)-C||_{H^{s}} =0.$$
	\end{lemma}
	\begin{proof}
		We take the Fourier transform of $u$, and we have
		$$ \widehat{u}(\xi,t)= \sinh \pi \bigg(\frac{2p_1e^{-i\xi q_1}}{1+\xi^2}+\frac{2p_2e^{-i\xi q_2}}{1+\xi^2}\bigg).
		$$
		Similarly, we can find the Fourier transform of $C$ as
		$$ \widehat{C}(\xi)= \sinh \pi \frac{2p^{*}e^{-i\xi q^*}}{1+\xi^2}.
		$$
		Calculating the $H^{s}$ norm of $u(t)-C$ gives us
		$$\lim_{t\to \ T^{-}}||u(t)-C||_{H^{s}} ^2= 4\sinh^2 \pi \lim_{t\to \ T^{-}} \sum_{n\in Z} ({1+\xi^2})^{s-2} \big|p_1e^{-i\xi q_1}+p_2e^{-i\xi q_2}-p^{*}e^{-i\xi q^*}\big|^2.$$
		We can bound the quantity inside the absolute value by $(|p_1|+|p_2|+|p^*|) \leq M < \infty.$ Let $v(\xi)=(1+\xi^2)^{s-2}\cdot M^2$ then $v$ dominates our original summand and $v$ is itself summable when $s<3/2.$ Therefore, we may apply the Dominated Convergence Theorem and bring the limit inside the summation.
		\begin{equation}
		\lim_{t\to \ T^{-}}||u(t)-C||_{H^{s}} ^2=
		4\sum_{n\in Z} ({1+\xi^2})^{s-2} |p_1(T)e^{-i\xi q_1(T)}+p_2(T)e^{-i\xi q_2(T)}-p^*e^{-i\xi q^*}|^2.
		\end{equation}
		By definition of $p^*$ and $q^*$,  the term inside the integral is zero.
	\end{proof}
	\section*{Acknowledgement}
	The author like to express his sincere appreciation to John Holmes for his valuable comments and discussions.

	\bibliographystyle{plain}


\section{Introduction}
Massively parallel sequencing data generated by next-generation sequencing technologies is routinely used to interrogate SNVs in research samples ~\citep{koboldt2013next}.
For example, deep sequencing confirmed the degree of genetic heterogeneity of HIV and influenza ~\citep{flaherty2011ultrasensitive, ghedin2011deep}.
Many solid tumors are represented as having intra-tumor heterogeneity by DNA sequencing technology, where SNVs are rare in the population ~\citep{navin2010inferring}.
Also, whole genome sequencing has revealed that many beneficial mutations of minor allele frequencies are essential to respond to dynamic environments ~\citep{kvitek2013whole}.
However, rare SNVs identification in heterogeneous cell populations is challenging, because of the intrinsic error rate of next generation sequencing platform ~\citep{shendure2008next}.
Thus, there is a need for accurate and scalable statistical methods to uncover SNVs in heterogeneous samples.

A number of computational methods have been developed to detect SNVs in large scale genomic data sets.
These methods can be roughly categorized as probabilistic or heuristic or some combination.
Among all of the current probabilistic methods, the Bayesian probabilistic framework has been increasingly used to calculate the unobserved quantities such as variant allele frequency given the observed genomic sequencing data.
GATK ~\citep{mckenna2010genome} and SAMTools ~\citep{li2009sequence} use a naive Bayesian decision rule to call variants.
EBCall models sequencing errors based on a Beta-Binomial distribution, where the parameters and latent variables are estimated from a set of non-paired normal sequencing samples ~\citep{shiraishi2013empirical}.
However, the error rate of normal sequencing samples could be unmatched with the error rate of the target samples, which may cause a problem of making false negatives calls ~\citep{wang2013detecting}.
CRISP compares aligned reads across multiple pools to obtain sequencing errors, and then distinguishes true rare variants from the sequencing errors ~\citep{bansal2010statistical}.
However, the bottleneck of CRISP is its low computational efficiency due to a calculation of a large amount of contingency tables.

Generally, independent modeling method models the genotypes of tumour and normal samples separately and then looks for the difference between them.
In contrast to independently analyzing a tumour-normal pair, joint modeling method models a joint-genotype of the tumour and normal samples simultaneously.
JointSNVMix introduces two Bayesian probabilistic models (JointSNVMix1 and JointSNVMix2) to jointly analyze a tumour-normal paired allelic count of NGS data ~\citep{roth2012jointsnvmix}.
JointSNVMix derives an expectation maximization (EM) algorithm to calculate maximum a-posteriori (MAP) estimate of latent variables in a particular probabilistic graphical model.
Furthermore, \citet{roth2012jointsnvmix} reveals that the joint modeling method, JointSNVMix1, observes 80-fold reduction of false positives compared with its independent analogue (SNVMix1).
SomaticSniper ~\citep{larson2012somaticsniper} models the joint diploid genotype likelihoods for both tumour and normal samples.
Additionally, Strelka ~\citep{saunders2012strelka} models the joint probabilistic distribution of allele frequencies for both tumour and normal samples, which is demonstrated to be more accurate compared with the methods based on the estimated allele frequency tests between tumour and normal samples.

An alternative strategy to probabilistic methods is heuristic methods that use a set of criteria to select variant positions instead of modeling the data using probabilistic distributions.
VarScan is an example of a heuristic method that compares tumour and normal samples by satisfying some lower bounds, such as a certain variant allele frequency and a number of allele counts ~\citep{koboldt2012varscan}.
SNVer focuses on a frequentist method that is able to calculate $P$-values, but \citet{wei2011snver} pointed out that this approach fails to model sampling bias that will reduce the power of detecting true rare variants.

In previous work, we developed a Beta-Binomial model to characterize a null hypothesis error rate distribution at each position.
Using this rare variant detection (RVD) model, we call rare variants by comparing the error rate of the sample sequence data to a null distribution obtained from sequencing a known reference sample ~\citep{flaherty2011ultrasensitive}.
RVD can identify mutant positions at a 0.1\% fraction in mixed samples using high read depth data.

We improved upon that work, RVD2, by using hierarchical priors to tie parameters across positions~\citep{he2015rvd2}.
We derived a Markov Chain Monte Carlo (MCMC) sampling algorithm for posterior inference.
However, the main limitation of MCMC is that it is hard to diagnose convergence and may be slow to converge~\citep{jordan1999introduction}.
An alternative method, that we explore here, is to use variational inference, which is based on a proposed variational distribution over latent variables.
By optimizing variational parameters, we fit an approximate distribution that is close to the true posterior distribution in the sense of the Kullback-Liebler (KL) divergence.
Variational inference can now handle nonconjugate distributions and tends to be more computationally efficient than MCMC sampling~\citep{peterson1989explorations}.

Here, we propose a variational EM algorithm for our Bayesian statistical model to detect SNVs in heterogeneous NGS data.
We show that variational EM algorithm has comparable accuracy and efficiency compared with MCMC in a synthetic data set.
In section 2, we define the model structure.
In section 3, we derive our variational EM algorithm to approximate the posterior distribution over latent variables.
In section 4, we call a variant by a posterior difference hypothesis test between the key model parameters of a pair of samples.
In section 5, we compare the performance of the variational EM inference algorithm to the MCMC sampling method and the state-of-the-art methods using a synthetic data set.
We also show that our variational EM algorithm is able to detect rare variants and estimate non-reference allele frequency (NRAF) in a longitudinal directed evolution experimental data set.

\section{Model Structure}
Our Bayesian statistical model is shown as a graphical model in Figure~\ref{tbl:graphical_model}.
In the model, $r_{ji}$ is the number of reads with a non-reference base at location $j$ in experimental replicate $i$; $n_{ji}$ is the total number of reads at location $j$ in experimental replicate $i$.
The model parameters are:
\begin{description}[noitemsep]
  \item[$\mu_0$] a global non-reference read rate that captures the error rate across all the positions,
  \item[$M_0$] a global precision that captures the variation of the error rate across positions in a sequence,
  \item[$M_j$] a local precision that captures the variation of the error rate at position $j$ across different replicates.
\end{description}
The latent variables are:
\begin{description}[noitemsep]
  \item[$\mu_j \sim \text{Beta}(\mu_0, M_0)$] position-specific non-reference read rate for position $j$,
  \item[$\theta_{ji} \sim \text{Beta}(\mu_j, M_j)$] the non-reference read rate for position $j$ in replicate $i$.
\end{description}

In Figure~\ref{tbl:graphical_model}B, $\gamma$ is the parameter for the variational distribution for latent variable $\mu$,
and $\delta$ is the parameter for the variational distribution for latent variable $\theta$.
We describe $q(\mu)$ and $q(\theta)$ in detail in section 3.3

\begin{figure}[htpb]
\centering
\includegraphics[width=0.5\textwidth]{rvd3_model.png}
\caption{A. Graphical model representation of the model.
B. Graphical model representation of the variational approximation  to approximate the posterior distribution.
Observed random variables are shown as shaded nodes and latent random variables are unshaded.
The object of inference for the variational EM algorithm is the joint distribution $p(\mu, \theta|r, n)$.}
\label{tbl:graphical_model}
\end{figure}
The model generative process is as follows:
\begin{enumerate}[noitemsep]
    \item For each location $j \in [1, \ldots, J]$:
	\begin{enumerate}
		\item Draw an error rate $\mu_j \thicksim \text{Beta}(\mu_0, M_0)$
		\item For each replicate $i \in [1, \ldots, N]$:
		\begin{enumerate}
			\item Draw $\theta_{ji} \thicksim \text{Beta}(\mu_j, M_j)$
			\item Draw $r_{ji} | n_{ji} \thicksim \text{Binomial}(\theta_{ji}, n_{ji})$
		\end{enumerate}
	\end{enumerate}
\end{enumerate}

The joint distribution $p(r, \mu, \theta|n; \phi)$ given the parameters can be factorized as
\begin{equation}
    p(r, \mu, \theta| n; \phi) = p(r |\theta, n)p(\theta |\mu; M )p(\mu;\mu_0, M_0).
\end{equation}

\section{Variational Expectation Maximization (EM) Inference}
We developed a non-conjugate variational inference algorithm to approximate the posterior distribution,
\begin{equation}
	p(\mu, \theta | r, n; \phi)  = \frac{ p(r, \mu, \theta| n; \phi) } {p ( r | n; \phi)},
\end{equation}
where the parameters are $\phi \triangleq \{\mu_0, M_0, M\}$.
\subsection{Factorization}
We propose the following factorized variational distribution to approximate the true posterior over latent variables $\mu_j$ and $\theta_{ji}$.
Here, $q(\mu_j)$ approximates the variational posterior distribution of $\mu_j$, which represents the local error rate distribution in position $j$ across different replicates;
and $q(\theta_{ji})$ approximates the posterior distribution of $\theta_{ji}$, which is the error rate distribution in position $j$ replicate $i$.
\begin{equation}
  q(\mu, \theta) = q(\mu)q(\theta) = \prod_{j=1}^J q(\mu_{j}) \prod_{i=1}^N q(\theta_{ji}).
  \label{eq:vardist}
\end{equation}
\subsection{Evidence Lower Bound (ELBO)}
Given the variational distribution, $q$, the log-likelihood of the data is lower-bounded according to Jensen's inequality,
\begin{equation}
\begin{split}
\log p \left( r | \phi \right) &= \log \int_\mu \int_\theta p\left(r,\mu,\theta |n; \phi \right) d\theta d\mu \\
&= \log \int_\mu \int_\theta p\left(r,\mu,\theta |n; \phi \right)\frac{q\left(\mu,\theta \right) }{q\left(\mu,\theta \right) } d\theta d\mu \\
&\geq \int_\mu \int_\theta q\left(\mu,\theta \right) \log \frac{ p\left(r,\mu,\theta |n; \phi \right)}{q\left(\mu,\theta \right)} d\theta d\mu \\
&= E_q \left[ \log p\left(r,\mu,\theta |n; \phi \right)\right] - E_q \left[ \log q\left(\mu,\theta \right)\right] \\
&\triangleq \mathcal{L}(q, \phi).
\end{split}
\end{equation}

The function $\mathcal{L}(q, \phi)$ is the evidence of lower bound (ELBO) of the log-likelihood of the data, which is the sum of $q$-expected complete log-likelihood and the entropy of the variational distribution $q$.
The goal of variational inference is to maximize the ELBO.
Equivalently, $q$ is chosen by minimizing the KL divergence between the variational distribution and the true posterior distribution.

The ELBO can be expanded as
\begin{equation}
\begin{split}
\label{L}
\mathcal{L}(q, \phi) &= E_q \left[ \log p\left(r,\mu,\theta | n; \phi \right)\right] - E_q \left[ \log q\left(\mu,\theta \right)\right] \\
&= E_q \left[ \log p\left(r | \theta, n \right)\right] + E_q \left[ \log p\left(\theta | \mu; M \right)\right] + E_q \left[ \log p\left(\mu ; \mu_0, M_0 \right)\right]- E_q \left[ \log q\left(\mu \right)\right]- E_q \left[ \log q\left(\theta \right)\right]. \\
\end{split}
\end{equation}
We write out each component below.
The detail of the derivation of $E_q \left[ \log p\left(r | \theta, n \right)\right]$, $E_q \left[ \log p\left(\mu ; \mu_0, M_0 \right)\right]$, and $E_q \left[ \log p\left(\theta | \mu; M \right)\right]$ is shown in Appendix~\ref{appendix:ELBO}.
\begin{equation}
\begin{split}
\label{r}
E_q \left[ \log p\left(r | \theta, n \right)\right] &= \sum_{j=1}^{J} \sum_{i=1}^{N} E_q  \left[ \log p \left( r_{ji} | \theta_{ji}, n_{ji} \right) \right] \\
&= \sum_{j=1}^{J} \sum_{i=1}^{N} \log \left( \frac{ \Gamma(n_{ji}+1) } { \Gamma(r_{ji}+1) \Gamma( n_{ji} - r_{ji} + 1 ) }\right)  \\
&\quad + \sum_{j=1}^{J} \sum_{i=1}^{N} \left\lbrace r_{ji} E_q \left[ \log \theta_{ji} \right] + (n_{ji} - r_{ji}) E_q  \left[  \log (1 - \theta_{ji}) \right] \right\rbrace
\end{split}
\end{equation}
\begin{equation}
\begin{split}
\label{mu}
E_q \left[ \log p\left(\mu ; \mu_0, M_0 \right)\right] &= \sum_{j=1}^{J} E_q  \left[ \log p\left( \mu_j; \mu_0, M_0 \right) \right] \\
&= J* \log \frac{ \Gamma(M_0) } { \Gamma(\mu_0 M_0) \Gamma(M_0 (1-\mu_0))} \\
&\quad + \sum_{j=1}^{J} \left\lbrace (M_0\mu_0 -1)E_q  \left[ \log \mu_j \right] + (M_0 ( 1 - \mu_0) - 1) E_q  \left[ \log (1 - \mu_j)\right]\right\rbrace
\end{split}
\end{equation}
\begin{equation}
\begin{split}
\label{theta}
E_q \left[ \log p\left(\theta | \mu; M \right)\right] &= \sum_{j=1}^{J} \sum_{i=1}^{N} E_q \left[ \log p\left(\theta_{ji} | \mu_j; M_j \right)\right] \\
&= N* \sum_{j=1}^{J} E_q  \left[ \log \left( \frac{ \Gamma(M_j) } { \Gamma(\mu_j M_j) \Gamma(M_j (1-\mu_j)) }\right) \right] \\
&\quad + \sum_{j=1}^{J} \sum_{i=1}^{N} \left\lbrace M_j E_q \left[ \mu_j \right] E_q \left[ \log \theta_{ji} \right] - E_q  \left[ \log \theta_{ji} \right] \right\rbrace\\
&\quad + \sum_{j=1}^{J} \sum_{i=1}^{N} \left\lbrace \left( M_j - 1 - M_j E_q\left[ \mu_j \right]  \right) E_q\left[ \log \left( 1 - \theta_{ji}\right) \right] \right\rbrace
\end{split}
\end{equation}

Therefore, we need to compute the following expectations with respect to the variational distribution:
$ E_q \left[ \log \theta_{ji} \right] $, $ E_q\left[ \log \left( 1 - \theta_{ji}\right) \right] $ , $ E_q  \left[ \log \mu_j \right] $ , $ E_q  \left[ \log (1 - \mu_j)\right] $, $ E_q \left[ \mu_j \right] $, and $ E_q\left[ \log \left( \frac{ \Gamma(M_j) } { \Gamma(\mu_j M_j) \Gamma(M_j (1-\mu_j)) }\right)\right] $.

We select the functional forms for the variational distributions $q(\theta)$ and $q(\mu)$ to facilitate these expected value computations.

\subsection{Variational Distributions}
Since $\theta$ and $r$ are conjugate pairs, the posterior distribution of $\theta_{ji}$ is a Beta distribution,
\begin{align}
&p(\theta_{ji}|r_{ji},n_{ji},\mu_j,M_j)
\thicksim \text{Beta}(r_{ji}+M_j \mu_j, n_{ji}-r_{ji}+M_j(1-\mu_j)).
\end{align}
Therefore, we propose a Beta distribution with parameter vector $\delta_{ji}$ as variational distribution,
\begin{align}
\theta_{ji} &\thicksim \text{Beta}(\delta_{ji1}, \delta_{ji2}) \nonumber.
\end{align}
The posterior distribution of $\mu_j$ is given by its Markov blanket,
\begin{align}
p(\mu_j|\theta_{ji},M_j,\mu_0,M_0)\propto p(\mu_j|\mu_0,M_0)p(\theta_{ji}|\mu_j,M_j).
\end{align}
This is not in the form of any known distribution.
But, since the support of $\mu_j$ is $[0,1]$, we propose a Beta distribution with parameter vector $\gamma_{j}$ as variational distribution,
\begin{align}
\mu_j &\thicksim \text{Beta}(\gamma_{j1}, \gamma_{j2}) \nonumber.
\end{align}
Given these variational distributions, we have
\begin{align}
E_q \left[ \log \theta_{ji} \right] &= \psi(\delta_{ji1}) - \psi(\delta_{ji1}+\delta_{ji2}) \nonumber \\
E_q \left[ \log \left( 1 - \theta_{ji}\right) \right]&= \psi(\delta_{ji2}) - \psi(\delta_{ji1}+\delta_{ji2}) \nonumber \\
E_q \left[ \mu_j \right] &= \frac{\gamma_{j1}}{\gamma_{j1} + \gamma_{j2}} \nonumber \\
E_q  \left[ \log \mu_j \right] &= \psi(\gamma_{j1}) - \psi(\gamma_{j1}+\gamma_{j2}) \nonumber \\
E_q  \left[ \log (1 - \mu_j)\right] &= \psi(\gamma_{j2}) - \psi(\gamma_{j1}+\gamma_{j2})\nonumber, \\
\end{align}
where $\psi$ is the digamma function.

Since there is no analytical representation for $ E_q\left[ \log \left( \frac{ \Gamma(M_j) } { \Gamma(\mu_j M_j) \Gamma(M_j (1-\mu_j)) }\right)\right] $, we must resort to numerical integration,

\begin{equation}\label{eqn:integration}
\begin{split}
E_q\left[ \log \left( \frac{ \Gamma(M_j) } { \Gamma(\mu_j M_j) \Gamma((1-\mu_j)M_j ) }\right)\right] &= \int_{0}^{1} q(\mu_j;\gamma_{j1}, \gamma_{j2}) \log \left( \frac{ \Gamma(M_j) } { \Gamma(\mu_j M_j) \Gamma((1-\mu_j)M_j ) }\right) d\mu_j.
\end{split}
\end{equation}
Here $q(\mu_j;\gamma_{j1}, \gamma_{j2})$ is the probability density function of the Beta distribution that is calculated using the Python built-in function \texttt{scipy.stats.beta.pdf},
and $\log \left( \frac{ \Gamma(M_j) } { \Gamma(\mu_j M_j) \Gamma((1-\mu_j)M_j ) }\right)$ is calculated using the Python built-in function \texttt{scipy.special.betaln}.
Unfortunately, this numerical integration step is computationally expensive.
Finally, the entropy terms can be computed as follows,
\begin{equation}
\begin{split}
E_q \left[ \log q\left(\mu \right)\right] &= \sum_{j=1}^{J} E_q \left[ \log q(\mu_j)\right] \\
&= -\sum_{j=1}^{J} \left\lbrace \log (B(\gamma_{j1},\gamma_{j2})) -(\gamma_{j1}-1)\psi(\gamma_{j1}) \right\rbrace \\
&\quad  + \sum_{j=1}^{J} \left\lbrace -(\gamma_{j2}-1)\psi(\gamma_{j2}) + (\gamma_{j1}+\gamma_{j2}-2)\psi(\gamma_{j1}+\gamma_{j2})\right\rbrace;
\end{split}
\end{equation}
and
\begin{equation}
\begin{split}
E_q \left[ \log q\left(\theta \right)\right] &= \sum_{j=1}^{J}\sum_{i=1}^{N} E_q\left[ \log q(\theta_{ji})\right] \\
&= -\sum_{j=1}^{J}\sum_{i=1}^{N} \left\lbrace \log (B(\delta_{ji1},\delta_{ji2}))-(\delta_{ji1}-1)\psi(\delta_{ji1}) \right\rbrace \\
&\quad + \sum_{j=1}^{J}\sum_{i=1}^{N} \left\lbrace -(\delta_{ji2}-1)\psi(\delta_{ji2}) + (\delta_{ji1}+\delta_{ji2}-2)\psi(\delta_{ji1}+\delta_{ji2})\right\rbrace.
\end{split}
\end{equation}
\subsection{Variational EM Algorithm}
Variational EM algorithm maximizes the ELBO on the true likelihood by alternating between maximization over $q$ (E-step) and maximization over $\phi= \left\{\mu_0, M_0, M \right\}$ (M-step).
\subsubsection{(E-step): Updating the variational distributions}
The terms in the ELBO that depend on $q(\theta_{ji} | \delta_{ji1}, \delta_{ji2})$ are
\begin{equation}\label{eqn:partial_theta}
\begin{split}
\mathcal{L}_{{[q(\theta_{ji})]}}
& = \sum_{j=1}^{J} \sum_{i=1}^{N} \left\lbrace r_{ji} E_q \left[ \log \theta_{ji} \right] + (n_{ji} - r_{ji}) E_q  \left[  \log (1 - \theta_{ji}) \right] \right\rbrace\\
&\quad  +  \sum_{j=1}^{J} \sum_{i=1}^{N} \left\lbrace M_j E_q \left[ \mu_j \right] E_q \left[ \log \theta_{ji} \right] - E_q  \left[ \log \theta_{ji} \right] + \left( M_j - 1 - M_j E_q\left[ \mu_j \right]  \right) E_q\left[ \log \left( 1 - \theta_{ji}\right) \right] \right\rbrace\\
&\quad - \sum_{j=1}^{J}\sum_{i=1}^{N} E_q\left[ \log q(\theta_{ji})\right]
\end{split}
\end{equation}

We update the variational parameters by numerically optimizing $\hat{\delta}_{ji1}, \hat{\delta}_{ji2} = \arg \max_{\delta_{ji1}, \delta_{ji2}} \mathcal{L}_{{[q(\theta_{ji})]}}$ subject to the constraints that $\delta_{ji1} \geq 0$ and $\delta_{ji2} \geq 0$ and conditioned on fixed values for the other model and variational parameters using Sequential Least SQuares Programming (SLSQP) ~\citep{kraft1988software}.

We update the variational distribution $q(\mu_j)$ using the partial ELBO depending on $\gamma_j$ from each position $j$ \eqref{eqn:partial_mu}.
\begin{equation}\label{eqn:partial_mu}
\begin{split}
\mathcal{L}_{{[q(\mu_j)]}}
& = N \sum_{j=1}^{J} E_q  \left[ \log \left( \frac{ \Gamma(M_j) } { \Gamma(\mu_j M_j) \Gamma(M_j (1-\mu_j)) }\right) \right] \\
&\quad + \sum_{j=1}^{J} \sum_{i=1}^{N} \left\lbrace M_j E_q \left[ \mu_j \right] E_q \left[ \log \theta_{ji} \right] - E_q  \left[ \log \theta_{ji} \right] + \left( M_j - 1 - M_j E_q\left[ \mu_j \right]  \right) E_q\left[ \log \left( 1 - \theta_{ji}\right) \right] \right\rbrace\\
&\quad + J \log \frac{ \Gamma(M_0) } { \Gamma(\mu_0 M_0) \Gamma(M_0 (1-\mu_0))} \\
&\quad + \sum_{j=1}^{J} \left\lbrace (M_0\mu_0 -1)E_q  \left[ \log \mu_j \right] + (M_0 ( 1 - \mu_0) - 1) E_q  \left[ \log (1 - \mu_j)\right]\right\rbrace\\
&\quad - \sum_{j=1}^{J} E_q \left[ \log q(\mu_j)\right]
\end{split}
\end{equation}
Again, we update the variational parameters by numerically optimizing $\hat{\gamma}_{j1}, \hat{\gamma}_{j2} = \arg \max_{\gamma_{j1}, \gamma_{j2}} \mathcal{L}_{{[q(\mu_{j})]}}$ subject to the constraints that $\gamma_{j1} \geq 0$ and $\gamma_{j2} \geq 0$ and conditioned on fixed values for the other model and variational parameters using SLSQP ~\citep{kraft1988software}.
The computational cost of optimizing \eqref{eqn:partial_mu} is high because of the quadrature of $E_q\left[ \log \left( \frac{ \Gamma(M_j) } { \Gamma(\mu_j M_j) \Gamma(M_j (1-\mu_j)) }\right)\right]$ in \eqref{eqn:integration}.

\subsubsection{(M-step): Updating the model parameters}
We can write out the ELBO as a function of each model parameter $\mu_0$, $M_0$, and $M_j$ as follows.

The ELBO with respect to $ \mu_0 $ is
\begin{equation}\label{eqn:mu_0}
\begin{split}
\mathcal{L}_{[\mu_0]}
&= -J*\log  \Gamma(\mu_0 M_0) - J*\log \Gamma(M_0 (1-\mu_0))
+ M_0\mu_0\sum_{j=1}^{J} \left\lbrace E_q  \left[ \log \mu_j \right]
- E_q  \left[ \log (1 - \mu_j)\right]\right\rbrace . \\
\end{split}
\end{equation}

The ELBO with respect to $ M_0 $ is
\begin{equation}\label{eqn:M_0}
\begin{split}
\mathcal{L}_{[M_0]}
&=J* \log \frac{ \Gamma(M_0) } { \Gamma(\mu_0 M_0) \Gamma(M_0 (1-\mu_0))}
+ M_0 \sum_{j=1}^{J} \left\lbrace \mu_0E_q  \left[ \log \mu_j \right] + ( 1 - \mu_0) E_q  \left[ \log (1 - \mu_j)\right]\right\rbrace.  \\
\end{split}
\end{equation}

The ELBO with respect to $M_j$ is
\begin{equation}\label{eqn:M}
\begin{split}
\mathcal{L}_{{[M_j]}}
&= N* \sum_{j=1}^{J} E_q  \left[ \log \left( \frac{ \Gamma(M_j) } { \Gamma(\mu_j M_j) \Gamma(M_j (1-\mu_j)) }\right) \right] \\
&\quad + M_j \sum_{j=1}^{J} \sum_{i=1}^{N} \left\lbrace E_q \left[ \mu_j \right] E_q \left[ \log \theta_{ji} \right] + \left( 1 - E_q\left[ \mu_j \right]  \right) E_q\left[ \log \left( 1 - \theta_{ji}\right) \right] \right\rbrace. \\
\end{split}
\end{equation}
We also use SLSQP to optimize the ELBO function with respect to each parameter, $\mu_0$, $M_0$, and $M_j$.
It is computationally easy to optimize $\mu_0$ \eqref{eqn:mu_0} and $M_0$ \eqref{eqn:M_0}.
However, it is costly for optimizing $M_j$ \eqref{eqn:M} because the quadrature is needed to calculate $ E_q\left[ \log \left( \frac{ \Gamma(M_j) } { \Gamma(\mu_j M_j) \Gamma(M_j (1-\mu_j)) }\right)\right] $ using \eqref{eqn:integration}.

The variational EM algorithm is summarized using pseudocode in Algorithm 1.
\begin{algorithm}[ht]
  \caption{Variational EM Inference}

  \begin{algorithmic}[1]

  \State Initialize $q(\theta, \mu)$ and $\hat{\phi}$

  \State // M-step

  \Repeat

    \State // E-step

	\Repeat

		\For {j = 1 to J}
			\For {i = 1 to N}
			\State Optimize $\mathcal{L}(q, \hat{\phi})$ over $q(\theta_{ji}; \delta_{ji}) = \text{Beta} (\delta_{ji})$
			\EndFor
		\EndFor

        \For {j = 1 to J}
            \State Optimize $\mathcal{L}(q, \hat{\phi})$ over $q(\mu_j; \gamma_j) = \text{Beta} (\gamma_j)$
        \EndFor

    \Until{change in $\mathcal{L}(q,\hat{\phi})$ is small}

    \State Set $\hat{\phi} \leftarrow \arg \max\limits_{\phi}
            \mathcal{L}(\hat{q},\phi)$
  \Until {change in $\mathcal{L}(\hat{q},\phi)$ is small}

  \end{algorithmic}

\end{algorithm}
\section{Hypothesis Testing}
The posterior distribution over $\mu_j^{\triangle} \mid r^{case}, r^{control} \triangleq \mu_j|r^{case} - \mu_j|r^{control}$ is the distribution over the change in the non-reference read rate at position $j$ between a case and control sample.
However, we cannot compute the posterior distribution, $\mu_j^{\triangle} | r^{case}, r^{control}$, because we do not have access to the component posterior distributions $\mu_j|r^{case}$ and $\mu_j|r^{case}$.
But, by approximating the distribution of $\mu_j|r^{case}$ and $\mu_j|r^{control}$ as Gaussians with moments matched to the variational posterior distributions, the distribution of $\mu_j^{\triangle} | r^{case}, r^{control}$ can be approximated as a Gaussian.

Under the variational approximation,
\begin{align}
  E_q[\mu_j|r^{case}] &= \frac{\gamma_{j1}^{case}}{\gamma_{j1}^{case} + \gamma_{j2}^{case}}
  \\
  \text{Var}_q[\mu_j|r^{case}] &= \frac{\gamma_{j1}^{case} \gamma_{j2}^{case}}{(\gamma_{j1}^{case} + \gamma_{j2}^{case} + 1)(\gamma_{j1}^{case} + \gamma_{j2}^{case})^2}
\end{align}
for $\mu_j|r^{case}$ and likewise for $\mu_j|r^{control}$.
We approximate the posterior for the case sample as
\begin{equation}
  \mu_j | r^{case} \sim \mathcal{N}(E_q[\mu_j|r^{case}], \text{Var}_q[\mu_j|r^{case}])
\end{equation}
and likewise for the control.
Then,
\begin{equation}
  \mu_j^{\triangle} \mid r^{case}, r^{control} \sim \mathcal{N}(E_q[\mu_j|r^{case}] - E_q[\mu_j|r^{control}], \text{Var}_q[\mu_j|r^{case}] + \text{Var}_q[\mu_j|r^{control}])
\end{equation}

Now, we can approximate the posterior probability of interest,
\begin{equation}
  \Pr( \mu_j^{\triangle} \geq \tau \mid r^{case}, r^{control} ),
\end{equation}
that is, the posterior probability that the difference in the non-reference read rate is greater than a fixed effect size $\tau$ (e.g. zero) for a one sided test.
For a two sided test, we compute the approximate probability
\begin{equation}
  \Pr( | \mu_j^{\triangle} | \geq \tau \mid r^{case}, r^{control}).
\end{equation}
A position is called a \textit{provisional variant} if $\Pr( | \mu_j^{\triangle} | \geq \tau \mid r^{case}, r^{control}) \geq 1-\alpha/2$, where the probability is approximated as described.

It is possible that a position is called a variant due to a differential non-reference read count, but no particular alternative base is more frequently observed than the others.
In this case, the likely case is a sequencing error that indiscriminately incorporates a non-reference base at the position.
To discriminate this non-biological cause from the interesting true variants we use a $\chi^2$ goodness-of-fit test for non-uniform base distribution~\citep{efron2010large, he2015rvd2}.
For each provisional variant, if we reject the null hypothesis that the distribution is uniform, we promote the position to a called variant.

\section{Results}

\subsection{Data Sets}

\subsubsection{Synthetic DNA Sequence Data}

Two random 400bp DNA sequences were synthesized. One sample with 14 loci variants is taken as the case and the other without variants is taken as the control.
Case and control samples were mixed to yield defined NRAF of 0.1\%, 0.3\%, 1.0\%, 10.0\%, and 100.0\%.
The details of the experimental protocol are available in \citet{flaherty2011ultrasensitive}.
The synthetic DNA data were downsampled by $10\times$, $100\times$, $1,000\times$, and $10,000\times$ using \texttt{picard} (v 1.96).
The final data set contains read pairs for six replicates for the control and cases at different NRAF levels.

\subsubsection{Longitudinal Directed Evolution Data}

The longitudinal yeast data comes from three strains of haploid S288c which were grown for 448 generations under limited-glucose (0.08\%).
The wild-type ancestral strain GSY1136 was sequenced as a reference.
Aliquots were taken about every 70 generations and sequenced.
The detail of library sequencing is described in \citet{kvitek2013whole}, \citet{bansal2010statistical}, and \citet{kao2008molecular}.
The Illumina sequencing data are available on the NCBI Sequence Read Archive (SRA054922)~\citep{kvitek2013whole}.
For this study, we received the original BAM files from one of the authors.
The aligned BAM files have $266$ - $1,046\times$ coverage.
We used \texttt{samtools} (v 1.1) with \texttt{-mpileup -C50} flags to convert BAM files to pileup files.
Then, we generated depth chart files, which are tab-delimited text files recording the count of the number of nucleotides in columns and genomic positions in rows.
We ran our variational inference algorithm on the depth chart files to identify SNVs.

\subsection{Performance on Synthetic DNA Data}

\subsubsection{Comparison of Sensitivity and Specificity}

We compared the performance of our variational EM algorithm and the MCMC sampling algorithm in terms of sensitivity and specificity (Table~\ref{tbl:statistics_mcmc_var}).
We used the posterior distribution test and $\chi^2$ test to detect variants for a broad range of median read depths and NRAFs.
The variational EM algorithm shows higher sensitivity and specificity than the MCMC algorithm in the events when NRAF is 0.1\%.
The variational EM algorithm has a higher specificity compared with the MCMC algorithm for a median read depth of $41,472\times$ at 0.3\% NRAF and $55,489\times$ at 1.0\% NRAF, but the sensitivity is slightly lower due to false negatives.
\begin{table}[ht]
\centering
\includegraphics[width=0.7\textwidth]{statistics_mcmc_var.png}
\vspace{5pt}
\caption{Sensitivity/Specificity comparison of variational EM algorithm with the MCMC algorithm on the synthetic DNA data set.}
\label{tbl:statistics_mcmc_var}
\end{table}

\subsubsection{Comparison of Approximated Posterior Distribution}

Figure~\ref{tbl:compare1} shows the approximate posterior distribution of the variational EM algorithm and samples of the MCMC algorithm.
One variant position, 85, is taken as an example to show the comparison of the approximated posteriors.
The variational EM and MCMC algorithms both identify all the variants when NRAF is 10.0\% and 100.0\%.
The variational EM algorithm calls 90 false positive positions without a $\chi^2$ test when NRAFs are 0.1\% and 0.3\% for low median read depth ($30\times$ and $400\times$).
This is to be expected because it is highly unlikely to correctly identify a variant base with a population frequency of $1$ in $1,000$ with less than a $1,000\times$ read depth.

A false positive, a non-mutated position that is called by the variational EM algorithm but not called by the MCMC algorithm, is shown in Figure~\ref{tbl:compare2}.
The variance of MCMC posterior estimate is higher than that of the variational posterior estimate.
We tested 10 random initial values variational inference algorithm and found the approximate posterior distributions from the variational EM algorithm are essentially equivalent for all random initializations.
It is notable that the shape of the proposed Beta variational distribution is well approximated by a Gaussian.

\begin{figure}[htbp]
\centering
\includegraphics[width=0.7\textwidth]{position_85_5584_mcmc_vs_var_mu_fig1.png}
\caption{Approximated posterior distributions by the variational EM and MCMC algorithms on a true variant position 85 when the median read depth is $5,584\times$.}
\label{tbl:compare1}
\end{figure}
\begin{figure}[htbp]
\centering
\includegraphics[width=0.7\textwidth]{position_160_410_mcmc_vs_var_mu_fig2.png}
\caption{Approximated posterior distribution by the variational EM and MCMC algorithms on a false variant position 160 when the median read depth is $410\times$.}
\label{tbl:compare2}
\end{figure}
\subsubsection{Comparison to the State-of-the-Art Methods}
We compared the performance of our variational EM algorithm with the state-of-the-art variant detection methods, SAMtools ~\citep{li2009sequence}, GATK ~\citep{mckenna2010genome}, VarScan2 ~\citep{koboldt2012varscan}, Strelka ~\citep{saunders2012strelka}, MuTect ~\citep{cibulskis2013sensitive}, and RVD2 ~\citep{he2015rvd2}, using synthetic DNA data set (Table~\ref{tbl:character_all}).
Among all of the methods compared, our variational EM algorithm has a higher sensitivity and specificity for a broad range of read depths and NRAFs.
Our variational EM algorithm shows higher specificity than all the other tested methods at a very low NRAF (0.1\%) level.
However, our algorithm has a slightly lower specificity than the MCMC algorithm when the median read depth is $4,156\times$ at 0.3\% NRAF, and a slightly lower sensitivity than the MCMC algorithm when the median read depth is $41,472\times$ at 0.3\% NRAF and a median read depth of $55,489\times$ at 1.0\% NRAF.
The performance of other methods is stated in detail in \citet{he2015rvd2}.
\begin{table*}[htbp]
\centering
\includegraphics[width=1.0\textwidth]{character_all.png}
\caption{Sensitivity/Specificity comparison of our variational RVD2 with other variant detection methods on synthetic DNA data.}
\label{tbl:character_all}
\end{table*}

\subsubsection{Comparison of Timing}
The computational time for approximating the variational posterior distribution is increased by expanding the length of region and the median read depth (Figure~\ref{tbl:timing_mcmc_var}).
Our variational EM algorithm is faster than the MCMC algorithm at the low median read depths of $27\times$ and $298\times$, and slower for the high median read depths of $3,089\times$ and $30,590\times$.
\begin{figure}[ht]
\centering
\includegraphics[width=0.6\textwidth]{timing_var_mcmc.png}
\caption{Timing for our variational EM algorithm and MCMC sampling algorithm.
Sixty processers are used to estimate the model on the synthetic data set.}
\label{tbl:timing_mcmc_var}
\end{figure}

Table~\ref{tbl:timing_profile_all} shows the timing profile for each part of our variational EM algorithm when median read depth is $3,089\times$.
Optimizing $\gamma$ in the E-step \eqref{eqn:partial_mu} and optimizing $M_j$ in the M-step \eqref{eqn:M} takes more than 95\% of the time of one variational iteration in a test of a single processor, since the integration \eqref{eqn:integration} is needed.
\begin{table*}[htbp]
\centering
\includegraphics[width=1.0\textwidth]{time_3089X_all_update.png}
\caption{Timing profile of 4 significant figures for one iteration of variational EM algorithm when median read depth is $3,089\times$.
Single and multiple processors are both tested to estimate timing. Time for optimizing $\gamma$ in the E-step and optimizing $M$ in the M-step is highlighted in percentage.}
\label{tbl:timing_profile_all}
\end{table*}
\subsection{Variant Detection on the Longitudinal Directed Evolution Data}
We applied our variational EM algorithm to the MTH1 gene at Chr04:1,014,401-1,015,702 (1,302bp), which is the most frequently observed mutated gene by \citet{kvitek2013whole}.
Our algorithm detected the same variants that were found by \citet{kvitek2013whole} (shown as highlighted in Table~\ref{tbl:mutations}).
Additionally, we detected 81 novel variants in 8 timepoints that the original publication did not detect.
In Table~\ref{tbl:mutations}, G7 is the baseline NRAF as the control sample when comparing with G70, G133, G266, G322, G385, and G448 in the respective hypotheses testing.
The corresponding NRAFs of called variants at different time points are given by the estimate of the latent variable, $\hat{\mu_j} = E_q[\mu_j|r]$.
\begin{table*}[htbp]
\centering
\includegraphics[width=1.0\textwidth]{mutations_MTH1.png}
\caption{Identified variants and corresponding NRAFs in gene MTH1 on Chromosome 4.
A blank cell indicates that the position of that time point is not called significantly different than G7.
The positions highlighted as blue were also identified by Kvitek, 2013.
The other 81 positions are novel identified variants in 8 timepoints.}
\label{tbl:mutations}
\end{table*}

All of these variants, except the variant at position Chr04:1,014,740, decrease in NRAF following a maximum.
The allele at position Chr04:1,014,740 is a beneficial variant that arises in NRAF to 99.603\% at generation 448 within a constant glucose-limited environment.
Moreover, we identified the first emergence of this beneficial variant as early as 0.522\% in generation 133.
Table~\ref{tbl:mutations} shows that we are able to detect many variants (NRAF $<$ 1.0\%) early in the evolutionary time course.
Furthermore, we detected a variant at position Chr04:1,015,666 at generation 70 as 0.091\% NRAF, which is less than a 0.1\% fraction.

We identified a pair of variants, Chr04:1,014,740 in gene MTH1 and Chr12:200,286 in gene ADE16, that increase in NRAF together in time (Figure~\ref{tbl:concomitant}).
We hypotheses that the variants are concomitant in the same strain.
In this pair of genes, gene MTH1 is a negative regulator of the glucose-sensing signal transduction pathway, and gene ADE16 is an enzyme of $\mathit{de\, novo}$ purine biosynthesis.
Glucose sensing induces gene expression changes to help yeast receive necessary nutrients, which could be a reason for this pair of genes to mutate together ~\citep{johnston1999feasting}.
Further experimental validation of this hypothesis would be required to definitively show that the mutations are concomitant.
\begin{figure}[htbp]
\centering
\includegraphics[width=0.6\textwidth]{concomitant.png}
\caption{The NRAF trend of concomitant variants in gene MTH1 and ADE16.
The 95\% Bayesian credible intervals are shown.}
\label{tbl:concomitant}
\end{figure}

The global precision parameter $\hat{M_0}$ could influence the estimate of $\mu_j$ due to its regularization effect.
We show the influence of different $\hat{M_0}$ on variant position Chr04:1,014,740, $q(\mu_{1,014,740}|r)$ in Figure~\ref{tbl:M0}.
We see that as we decrease the prior precision parameter $\hat{M_0}$, $\hat{\mu}_{1,014,740}$ increases as expected.
But the effect of changing $\hat{M_0}$ over several orders of magnitude does not change $\mu_j$ greatly.
Here $\hat{M_0} = 1.752$ in this dataset.
\begin{figure}[htbp]
\centering
\includegraphics[width=0.8\textwidth]{diff_M0.png}
\caption{Influence of $M_0$ on the estimate of $\mu_j$.
Posterior distributions of the variant at position Chr04:1,014,740, $\hat{\mu}_{1,014,740}$, with different $\hat{M_0}$ are shown.}
\label{tbl:M0}
\end{figure}

\section{Discussion}
In this article, we propose a variational EM algorithm to estimate the non-reference allele frequency in the RVD2 model to identify rare nucleotide variants in heterogeneous pools.
We derived a variational EM algorithm to avoid an intractable integration in our Bayesian model.
Our results show that the variational EM algorithm
(i) is able to identify rare variants at a 0.1\% NRAF level with comparable sensitivity and specificity to a MCMC sampling algorithm;
(ii) has a higher specificity in comparison with many state-of-the-art algorithms in a broad range of NRAFs;
and (iii) detects SNVs early in the evolutionary time course, as well as tracks NRAF in a real longitudinal yeast data set.

We have chosen parametric forms for the variational distributions.
This choice has left us with a complex integral in our variational optimization problem.
In future work, we plan to explore other approximations of the variational distributions that render the integral easier to compute.
One could use cubic splines to numerically approximate the function and then integrate that surrogate ~\citep{mckinley1998cubic}.
Another strategy is to consider a Laplace approximation for the variational distribution, as we and others have done previously ~\citep{saddiki2014glad, wang2013variational}.

Improving the speed of the estimating algorithm enables us to interrogate whole-genome sequencing data.
By doing this, we hope to reveal the dynamics of arising variants at the genome-wide scale to show the genetic basis of clonal interference.
Our method can also be extended to study drug resistance by characterizing tumor heterogeneity in targeted anti-cancer chemotherapy samples.
We will be able to find the causative variants that lead to drug resistance and understand the causes of resistance at the single nucleotide level.

\section{Acknowledgments}
F.Z. and P.F. were supported by PhRMA Foundation Informatics Grant 2013080079.
We would like to thank Dan Kvitek for kindly sharing the data set used for the longitudinal yeast evolution analysis.
We acknowledge Chuangqi Wang and Ross Lagoy for valuable comments on the manuscript.