Why Test Composition?
A barcode with a large total count is more likely to represent a cell than one with a small total, but total count alone does not describe where its RNA came from. Empty droplets can contain ambient RNA released from damaged cells, and that RNA may produce nonzero counts across many genes. Conversely, a barcode with a modest total may have a gene composition that is difficult to explain as ambient RNA alone.
EmptyDrops formalizes this distinction. It estimates the expression profile of ambient RNA from low-count barcodes, then tests whether a barcode’s gene counts are consistent with that profile. The test conditions on the barcode’s total count: the question is whether its composition, rather than merely its size, is surprising under the ambient model. This complements the barcode-rank curve and its count-based knee, which describe total counts but do not by themselves test a barcode’s composition.
The Ambient Null Model
To estimate the profile, pool counts across a chosen set of low-count barcodes believed to be predominantly empty droplets. If \(a_g\) is the pooled count for gene \(g\), a basic estimate is \(\hat{\rho}_g=a_g/\sum_{h=1}^{G}a_h\). Pooling helps estimate a shared ambient composition from more molecules than any single empty barcode would provide. The choice of barcodes matters: if genuine cells are included in the pool, their RNA can distort the estimated ambient profile.
Under the null hypothesis \(H_0\), the counts in a tested barcode are draws from the ambient profile. Conditional on its observed total \(N\), the model is
This says that each of the \(N\) counted molecules is assigned to a gene according to the same probabilities \(\rho_g\). It gives expected counts \(N\rho_g\) for gene \(g\), but actual counts vary randomly around those expectations. Conditioning on \(N\) removes total count from the test: a barcode does not become more convincing merely because every gene count is scaled up while the composition stays similar.
The alternative is that the barcode has a composition not described by the ambient profile. The unrestricted alternative allows gene probabilities \(q_g\) to vary, with \(\sum_g q_g=1\). It is a test for departure from the ambient composition, not a complete biological model of how cell-associated and ambient RNA combine.
Worked Example: Estimating the Ambient Profile
Suppose three genes have pooled counts \(80,15,\) and \(5\) across the selected low-count barcodes. The pooled total is \(80+15+5=100\), so the estimated ambient profile is \(\hat{\boldsymbol{\rho}}=(80/100,15/100,5/100)=(0.80,0.15,0.05)\).
For a tested barcode with total \(N=20\), the null expected counts are \(20(0.80)=16\), \(20(0.15)=3\), and \(20(0.05)=1\). The expectation is therefore \((16,3,1)\), not a prediction that the barcode must have exactly those counts. The multinomial model allows random departures from these expected values.
Likelihood-Ratio Evidence
A common statistic compares how well the observed counts fit the ambient profile with how well they fit a profile estimated freely from the barcode itself. Under the unrestricted alternative, the maximum-likelihood estimate is \(\hat q_g=x_g/N\). The multinomial coefficient is the same under both models and cancels in their likelihood ratio. Taking twice the log of the ratio gives the statistic
Terms for \(x_g=0\) contribute zero, using the convention \(0\log(0)=0\). A larger \(T\) indicates a greater discrepancy between observed counts and ambient expectations. The statistic is nonnegative: the unrestricted alternative includes the ambient profile as one possible choice, so its maximized likelihood cannot be smaller than the null likelihood.
For sufficiently large expected counts, a likelihood-ratio statistic may sometimes be compared with a chi-square reference distribution. In barcode data, however, many genes have small or zero expected counts, and the number of observed molecules can be modest. Those conditions can make a large-sample approximation unreliable. EmptyDrops therefore uses simulation under the multinomial null to assess how often a statistic at least as large as the observed one would arise from ambient RNA.
Worked Tests and Comparisons
Worked Example: Calculating the Composition Statistic
Use the ambient profile \((0.80,0.15,0.05)\) and a barcode with counts \((10,6,4)\), for a total \(N=20\). Its ambient expected counts are \((16,3,1)\). The likelihood-ratio statistic is
The observed barcode has a smaller fraction of gene 1 and larger fractions of genes 2 and 3 than the ambient profile. The value \(10.01\) quantifies that discrepancy relative to the ambient model; by itself it is not a p-value. Its significance must be judged against the null distribution, for example by multinomial simulation.
Worked Example: Estimating a Monte Carlo P-Value
Continue with the statistic \(T=10.01\). Suppose a hypothetical Monte Carlo calculation generates \(B=9{,}999\) barcodes of total \(20\) from the ambient profile, and \(38\) simulated statistics are at least \(10.01\). A finite-simulation estimate that avoids reporting a p-value of zero is
In this hypothetical calculation, the simulated tail area is \(0.0039\). Under the specified ambient model, statistics at least this large were uncommon in the simulations. The estimate has Monte Carlo uncertainty because it is based on a finite number of draws; increasing \(B\) can improve resolution and reduce simulation variability. The p-value is not the probability that \(H_0\) is true.
Worked Example: Same Total, Different Composition
Compare two barcodes, each with total \(20\), under the same ambient profile. Barcode A has counts \((16,3,1)\), exactly the ambient expected proportions. Its statistic is
Barcode B has counts \((10,6,4)\), giving \(T_B\approx10.01\) as calculated above. Both have the same total, but Barcode B departs more strongly from the ambient composition. This comparison shows what a total-count threshold cannot show: barcodes of equal size can provide different evidence about whether their RNA is ambient-only.
Justification of the Test Statistic
For observed counts with total \(N\), the multinomial likelihood at probabilities \(\boldsymbol{q}\) is proportional to \(\prod_g q_g^{x_g}\). Under the null, set \(q_g=\rho_g\). Under the unrestricted alternative, maximize this product subject to \(\sum_g q_g=1\). The log likelihood, apart from a constant, is \(\ell(\boldsymbol{q})=\sum_g x_g\log(q_g)\). A Lagrange multiplier for the sum constraint gives \(x_g/q_g=\lambda\) for each gene with positive count. Summing over those genes yields \(\lambda=N\), so the maximizing value is \(\hat q_g=x_g/N\). Substitution into twice the log-likelihood difference gives
Thus the statistic measures improvement in fit when the composition is allowed to differ freely from ambient. It is an omnibus statistic: it indicates evidence of departure but does not, on its own, identify which genes make the largest meaningful biological contribution.
Assumptions, Diagnostics, and Limitations
The test relies on several assumptions that should be considered before interpreting its result:
- Representative ambient profile. The low-count barcodes used for estimation should reflect ambient RNA in the tested barcodes. Strong sample, lane, or processing differences can make a pooled profile inappropriate.
- Reliable profile estimation. The estimated proportions are treated as the null probabilities. If the pool is small or contaminated by genuine cells, uncertainty and bias in the profile may be substantial.
- Multinomial sampling conditional on total. Given \(N\), molecules are treated as independent draws with common gene probabilities. Strong extra variation or dependence can make the simulated null too narrow.
- Appropriate handling of zero probabilities. If an estimated \(\rho_g\) is zero while a tested barcode has \(x_g>0\), the likelihood ratio is not finite under the unsmoothed model. Implementations must handle this case explicitly, for example through documented filtering or regularization; analysts should not silently treat such a result as an ordinary finite statistic.
Useful diagnostics include checking whether the selected low-count barcodes have a coherent pooled profile, whether that profile changes substantially across reasonable choices of the estimation set, and whether tested barcodes with extreme statistics are driven by a few genes with tiny estimated ambient probabilities. Compare the total-count pattern with composition-based results, but do not assume that disagreement means one method must be wrong: the methods answer different questions. A high-count barcode can resemble ambient composition, while a lower-count barcode can depart from it.
A simple count threshold is transparent and useful for ranking barcodes, but it cannot distinguish compositions at the same total. The likelihood-ratio test addresses that limitation by using gene-level counts conditional on total, at the cost of relying on an estimated ambient profile and a sampling model. Its raw p-value also does not account for testing many barcodes. When many barcodes are tested, the resulting collection of p-values requires multiplicity-aware interpretation; an individual small p-value should not be treated as a final cell call in isolation.
Finally, evidence against ambient-only RNA is not equivalent to proof of a viable, intact cell. An unusual ambient mixture, technical artifacts, or an inadequately estimated profile can also produce departures. EmptyDrops supplies statistical evidence about composition under a stated null model; that evidence should be interpreted alongside the experiment’s design and other quality information.
Check Your Understanding
Answer each question, then compare your reasoning with the solutions.
- If the ambient profile is \((0.7,0.2,0.1)\) and a barcode has total \(50\), what are its null expected counts?
- Why does EmptyDrops condition on a barcode’s total count?
- A simulated test has \(B=4{,}999\) draws, of which \(24\) statistics equal or exceed the observed statistic. Calculate the plus-one Monte Carlo p-value.
- What does a small p-value establish, and what does it not establish?
- Name one reason the ambient profile might fail to represent the null probabilities for a tested barcode.
Solutions. (1) The expected counts are \(50(0.7)=35\), \(50(0.2)=10\), and \(50(0.1)=5\). (2) Conditioning removes total size from the comparison, so the test assesses composition rather than treating a larger total alone as evidence against ambient RNA. (3) The estimate is \((1+24)/(4{,}999+1)=25/5{,}000=0.005\). (4) It indicates that a statistic at least as extreme would be uncommon under the specified ambient model; it does not give the probability that the null is true or prove that the barcode is a cell. (5) For example, low-count barcodes used to estimate the profile may contain genuine cells, or the tested barcode may come from a sample or processing group with a different ambient composition.