Why Cell Barcodes Can Contain Ambient RNA
A cell barcode is intended to summarize RNA captured from a cell, but some of its molecules may have come from outside that cell. During tissue dissociation and sample handling, cells can rupture or lyse. Their RNA enters the surrounding fluid, where it may persist as extracellular transcripts. When droplets or other partitions are formed, a cell-containing partition can capture some of this free RNA along with RNA from its intact cell. The resulting barcode can therefore contain a mixture of cellular and ambient transcripts.
This matters because the observed count for a gene is not automatically evidence that the enclosed cell expressed that gene. Ambient RNA can add counts to genes the cell expressed weakly or not at all, and it can make a transcript appear across cell types. This tutorial describes a basic model for that mixture. It treats the ambient profile as shared across cell-containing barcodes within a sample, while allowing each cell barcode to have its own endogenous profile and contamination fraction.
Lysis provides a biological route from intracellular RNA to ambient RNA: a damaged cell releases transcripts into the surrounding solution. The resulting mixture need not reflect the average expression of all intact cells. Cells may lyse at different rates, and their RNA can differ in abundance and stability across genes. Consequently, the extracellular pool can be enriched for transcripts released by particular cell populations or for transcripts that remain detectable after release.
A cell-containing barcode is not the only place ambient RNA may be captured. A barcode without an intact cell can still collect extracellular transcripts. Such empty droplets can provide useful evidence about background RNA, but they need not be identical to cell-containing droplets in capture conditions or observed counts. Their existence illustrates that extracellular RNA is a sample-level physical background, not a property produced only by cells with a particular identity.
A Count-Mixture Model
Let \(Y_{ig}\) be the observed count for gene \(g\) in cell barcode \(i\), and let \(N_i=\sum_g Y_{ig}\) be the total number of captured RNA molecules represented by that barcode. Write \(q_{ig}\) for the endogenous expression profile of the cell assigned to barcode \(i\), and \(a_g\) for the shared ambient profile. Each profile is a vector of nonnegative proportions across genes that sums to one. Let \(\rho_i\) be the ambient fraction for barcode \(i\), with \(0\leq \rho_i\leq 1\). The model is
Here \(G\) is the number of genes under consideration. The model says that each captured molecule is endogenous with probability \(1-\rho_i\), in which case its gene is drawn according to \(q_i\); or ambient with probability \(\rho_i\), in which case its gene is drawn according to \(a\). Thus the probability of observing gene \(g\) for a molecule in barcode \(i\) is a weighted average of the two profiles.
The model’s assumptions are important. It treats the captured molecules as conditionally independent draws given the profiles and \(\rho_i\), and it assumes one shared ambient profile \(a\) for the barcodes being modeled. It allows contamination fractions and endogenous profiles to vary by barcode, but it does not represent variation in the ambient profile between barcodes. The multinomial formulation also conditions on the observed total \(N_i\); it models composition, not the process that determined how many molecules were captured.
The mixture fraction has a specific interpretation: \(\rho_i\) is the modeled fraction of captured molecules from the ambient source. It is not the fraction of the barcode’s genes that are contaminated, the fraction of cells that lysed, or a direct measure of how much RNA is present in the surrounding fluid. A small fraction can still add many molecules when \(N_i\) is large.
Why the Mixture Formula Holds
The formula follows by considering the source and gene of one captured molecule. Let \(Z=1\) mean that the molecule is ambient and \(Z=0\) mean that it is endogenous. By the model, \(P(Z=1)=\rho_i\) and \(P(Z=0)=1-\rho_i\). Conditional on its source, the molecule’s gene follows the corresponding profile. The law of total probability gives
If the \(N_i\) molecules are independent draws from this same distribution, their gene counts follow a multinomial distribution with the probabilities just derived. Multiplying the probability for gene \(g\) by \(N_i\) gives its expected count. The components are latent: a count table reports \(Y_{ig}\), not which individual molecules were ambient.
Worked Example: Calculating a Mixed Gene Profile
Consider a hypothetical barcode with 1,000 captured molecules and three genes. Suppose its endogenous profile is \(q_i=(0.50,0.30,0.20)\), the shared ambient profile is \(a=(0.05,0.15,0.80)\), and its modeled ambient fraction is \(\rho_i=0.10\). The model assumes the profiles sum to one and that the same ambient profile applies to this barcode.
For each gene, the mixture probability is \((1-\rho_i)q_{ig}+\rho_i a_g\). The three probabilities are
They sum to \(0.455+0.285+0.260=1.000\), as required. The expected counts are \(1{,}000(0.455)=455\), \(1{,}000(0.285)=285\), and \(1{,}000(0.260)=260\) molecules. Gene 3’s endogenous expected count without contamination would be \(1{,}000(0.20)=200\); the model attributes an additional expected \(1{,}000(0.10)(0.80)=80\) counts to ambient RNA. These are expected counts, not a claim that a particular observed barcode must contain exactly those numbers.
How Ambient Counts Can Resemble Expression
The effect of ambient RNA depends on both the ambient fraction and the gene’s abundance in the ambient profile. A gene can receive a substantial ambient contribution even when \(\rho_i\) is modest if \(a_g\) is large. Conversely, a high contamination fraction need not add many counts to a gene that is rare in the ambient profile. The following example separates the expected ambient and endogenous contributions.
Worked Example: A Gene Weakly Expressed by a Cell
Suppose a hypothetical barcode has \(N_i=2{,}000\) captured molecules, \(\rho_i=0.05\), and endogenous proportion \(q_{ig}=0.002\) for gene \(g\). Assume the shared ambient profile assigns \(a_g=0.12\) to that gene. The mixture probability is
The expected total count is \(2{,}000(0.0079)=15.8\) molecules. Of this, the expected endogenous contribution is \(2{,}000(0.95)(0.002)=3.8\), and the expected ambient contribution is \(2{,}000(0.05)(0.12)=12.0\). Thus most of the expected count comes from ambient RNA under these assumptions, even though the barcode’s ambient fraction is only five percent. This calculation explains why observing the gene in the barcode alone does not establish that the cell expressed it at the observed level.
Ambient signal can also make a gene appear in a cell type whose endogenous profile has little or none of that gene. The same ambient profile is mixed into different endogenous profiles, so the resulting counts can look like weak cross-cell-type expression. That resemblance is a reason to examine the model and the broader evidence, not a basis for automatically declaring every such count contamination.
Worked Example: Shared Ambient Signal Across Two Cell Types
Suppose two hypothetical cell types have endogenous profiles \(q_A=(0.80,0.20,0)\) and \(q_B=(0,0.20,0.80)\) for three genes. Let the shared ambient profile be \(a=(0.02,0.96,0.02)\), and let both barcodes have \(\rho_i=0.10\). These profiles each sum to one, and the example assumes the same ambient profile and fraction for both barcodes.
For type A, the mixed profile is \(0.90q_A+0.10a=(0.722,0.276,0.002)\). For type B, it is \(0.90q_B+0.10a=(0.002,0.276,0.722)\). With 1,000 molecules in either barcode, the expected count for gene 3 in type A is \(1{,}000(0.002)=2\), and the expected count for gene 1 in type B is also 2. Both genes have zero endogenous proportion in the stated profiles; the expected counts arise from the shared ambient component. In contrast, gene 2 has an expected count of \(1{,}000(0.276)=276\) in each barcode, mainly because it is abundant in the ambient profile. The arithmetic shows how one ambient source can add a similar pattern across distinct cell types without making their endogenous profiles identical.
Distinguishing Ambient RNA From Other Explanations
Ambient RNA is one possible explanation for a count, not a label attached to each observed molecule. A gene detected in a barcode could reflect genuine endogenous expression, ambient contribution, or both. A doublet is a different mixture: it contains endogenous RNA from two cells assigned to one barcode, rather than extracellular RNA added to a single cell’s RNA. A cell can also have biological expression that differs from a simplified expected profile. These mechanisms may coexist, so a mixture model should not be treated as proof of a molecule’s origin.
| Explanation | Source of the added or observed signal | Key distinction |
|---|---|---|
| Endogenous expression | RNA produced by the cell assigned to the barcode | Part of that cell’s profile \(q_i\) |
| Ambient RNA | Extracellular transcripts, often released by lysed cells | Modeled using a shared profile \(a\) and barcode-specific fraction \(\rho_i\) |
| Doublet | Endogenous RNA from two cells in one barcode | Combines cellular sources, not a cell’s RNA with the extracellular pool |
A simple no-contamination model sets \(\rho_i=0\) and attributes all counts to the endogenous profile. It is easier to interpret when ambient RNA is negligible, but it can misrepresent barcodes when extracellular transcripts contribute appreciably. The shared-profile mixture is more explicit about that source, but it adds assumptions and cannot by itself establish which genes a particular cell truly expressed. A doublet model addresses a different source of mixed counts and is not a substitute for an ambient model.
Assumptions, Diagnostics, and Limitations
The shared-profile assumption is most plausible when the barcodes belong to the same sample and experience a sufficiently common extracellular RNA pool. It can be poor when samples or processing conditions differ, or when local sources of lysed cells create distinct ambient compositions. The model also treats captured molecules as independent draws and does not represent all biological and technical variation. Its expected-count calculations describe the model’s mean composition, not every feature of the observed count distribution.
Useful diagnostics ask whether the model’s assumptions are plausible, rather than trying to label every suspicious count. For example, examine whether patterns thought to be ambient recur across otherwise distinct cell types, and whether the presumed background is consistent within the sample. Compare conclusions across samples instead of assuming a single ambient composition for a heterogeneous collection. Empty-droplet counts can help characterize extracellular signal, but do not guarantee that the composition captured in cell-containing droplets is identical. A pattern that fails these checks may indicate model misspecification, genuine shared expression, a doublet, or another source of variation.
- Do not equate detection with endogenous expression. A nonzero count can contain an ambient contribution.
- Do not assume every shared gene is contamination. Different cell types can genuinely express the same gene.
- Do not treat a single ambient profile as universally valid. Its adequacy depends on the sample and processing context.
- Do not interpret \(\rho_i\) as a cell-lysis rate. It is a modeled fraction of captured molecules, not a measurement of how many cells lysed.
The model is a conceptual and statistical account of how extracellular transcripts can enter cell barcodes. It does not, on its own, estimate the ambient profile or the contamination fraction, determine the source of each molecule, or correct the observed counts. Those tasks require additional assumptions and evidence. The central benefit here is a precise distinction between a cell’s endogenous expression profile and the RNA mixture that was actually captured.
Check Your Understanding
Answer each question, then compare with the solutions below.
- If a barcode has \(N_i=500\), \(\rho_i=0.04\), and \(a_g=0.10\), what is its expected ambient contribution for gene \(g\)?
- In the mixture model, what does \(\rho_i\) measure, and what does it not measure?
- Why can ambient RNA released by lysed cells make a gene appear in multiple cell types?
- How does the source of RNA in a doublet differ from the source of ambient RNA?
Solutions. 1. The expected ambient contribution is \(N_i\rho_i a_g=500(0.04)(0.10)=2\) molecules. 2. It is the modeled fraction of captured molecules attributed to ambient RNA; it is not the fraction of cells that lysed or a direct measurement of extracellular RNA concentration. 3. The same ambient profile is mixed into the endogenous profiles of different barcodes, adding counts of the gene wherever it is present in that shared profile. 4. A doublet combines endogenous RNA from two cells, whereas ambient RNA is extracellular RNA added to the RNA captured from a cell-containing barcode.