In the paper Small-sample estimation of negative binomial dispersion, with applications to SAGE data, section 4.1 Conditional maximum likelihood:
For RNA sequencing data, assume the counts for a single tag across $n$ libraries is a negative binomial random variable. Consider $Y_1, \cdots , Y_n$ as independent and $NB(\mu_i = m_i \lambda, \phi)$, where $m_i$ is the library size (i.e. total number of tags sequenced for library $i$) and $\lambda$ represents the proportion of the library that is a particular tag. The probability mass function is:
$$f(y_i;\mu,\phi)=P(Y=y_i)=\frac{\Gamma(\phi^{-1}+y_i)}{\Gamma(\phi^{-1})\Gamma(y_i+1)}\left(\frac{1}{\phi^{-1}\mu^{-1}+1}\right)^{y_i}\left(\frac{1}{\phi\mu+1}\right)^{\phi^{-1}} \tag 1$$
$$\text{E}(Y)=\mu$$ and $$\text{Var}(Y)=\mu+\phi\mu^2$$
If all libraries are the same size (i.e. $m_i ≡ m$), the sum $$Z = Y_1 + \cdots + Y_n \sim NB(nm\lambda, \phi n^{−1})$$
How to derive conditional maximum likelihood for $\phi$ that is independent of $\lambda$?
$$l_{Y|Z=z}(\phi)=\left[\sum_{i=1}^{n}\log\Gamma(y_i+\phi^{-1})\right]+\log\Gamma(n\phi^{-1})-\log\Gamma(z+n\phi^{-1})-n\log\Gamma(\phi^{-1})$$