Why Check the Counts After Correction?
Ambient RNA correction estimates which observed molecules may have come from extracellular RNA rather than from the cell represented by a barcode. A correction can reduce signal consistent with the ambient profile, but a low post-correction count is not by itself evidence of success: genuine cell-type signal may also have been removed. Conversely, a marker that remains after correction may reflect incomplete removal, genuine expression, or both. Diagnostics therefore compare several kinds of evidence for the same barcodes, not just one before-and-after total.
This tutorial treats corrected values as outputs of an estimation procedure, not as newly observed molecules. Depending on the method, corrected counts may be fractional. The useful question is whether their pattern is compatible with the stated correction assumptions and with known biology. No single diagnostic proves that the correction is right.
Choose Markers and Comparisons Carefully
An ambient-marker set contains genes expected to be prominent in the ambient profile and absent or weak in the relevant cell type. These are useful sentinels, but “ambient marker” does not mean “impossible for a cell to express.” A gene can be abundant in the surrounding RNA and also genuinely expressed by some cells. A cell-type marker set contains genes expected to be expressed by a specified cell type; it helps reveal whether plausible biological signal has been depleted.
For a set of genes \(S\), compare both its count and its fraction of a barcode's total. For example, define the pre-correction fraction \(q_{iS}= \sum_{g\in S}Y_{ig}/Y_i\), and the post-correction fraction \(q^{(C)}_{iS}=\sum_{g\in S}C_{ig}/C_i\), when the denominators are positive. Use the same barcodes and gene sets on both sides. Counts address how much estimated signal remains; fractions address how prominent that set is relative to the library. Neither is a substitute for the other.
Assumptions Behind the Diagnostics
These checks are informative only to the extent that their reference information is credible. They rely on several practical assumptions:
- The pre- and post-correction values refer to the same barcodes, genes, and count units. Barcodes must not silently differ because of filtering between comparisons.
- The ambient profile used by the correction is a reasonable description of extracellular RNA for the relevant sample or group. A profile that varies across samples or cell populations can mislead the assessment.
- Ambient sentinels are selected with cell identity in mind. If a sentinel is genuinely expressed in the cells being checked, its persistence is not unambiguous evidence of undercorrection.
- Cell-type markers are appropriate for the population under review. A marker absent from a genuine cell state cannot diagnose signal loss reliably.
- The correction output and contamination estimates are interpreted according to the method that produced them. A contamination estimate is not necessarily an exact fraction of every gene's counts.
The contamination estimate \(\rho_i\) is useful as a relative diagnostic: among comparable barcodes, larger estimates may be associated with stronger ambient-marker signal before correction and greater estimated removal. The relationship need not be exact. It depends on the ambient gene profile, the cell's own expression, and how the method defines and estimates contamination.
Three Complementary Diagnostic Views
| Diagnostic | Pattern to inspect | What it can suggest |
|---|---|---|
| Ambient-marker counts and fractions | Do counts or relative abundance fall after correction, especially in cells with high estimated contamination? | Persistent signal can flag possible undercorrection; the marker's biological expression must also be considered. |
| Cell-type markers | Are expected markers retained in the cell types that should express them? | Large, selective losses can flag possible overcorrection or an unsuitable ambient profile. |
| Total counts and removed amounts | How much of each barcode's library is removed, and does removal vary sensibly with \(\rho_i\)? | Unexpectedly large losses or little change despite high estimated contamination merit investigation. |
| Contamination estimates | Do estimated \(\rho_i\) values broadly agree with pre/post marker patterns? | Disagreement may expose weak marker assumptions, a poor profile, or a correction that is not behaving as expected. |
Look at distributions and paired changes across barcodes, and stratify by cell type or other relevant groups. A pooled average can hide a subgroup with residual ambient signal or a subgroup whose markers were depleted. Scatterplots of pre-correction marker burden against \(\rho_i\), and paired plots of pre- and post-correction values, make those patterns easier to see. These are diagnostic comparisons, not automatic pass/fail tests.
A Short Derivation: Why Fractions Can Mislead
Suppose a marker set has \(m\) counts in a barcode with total \(N\), and correction removes \(d_m\) counts from that set and \(d\) counts overall. Its fraction changes from \(m/N\) to \((m-d_m)/(N-d)\), assuming \(N-d>0\). The post-correction fraction is larger exactly when
for positive denominators and \(m>0\). Thus, the marker fraction rises when the fraction of marker counts removed is smaller than the fraction of all counts removed. Its fraction can rise even though its absolute count has fallen. The reverse pattern can also occur if the marker set is depleted more heavily than the library overall.
Worked Example: Interpreting a Rising Marker Fraction
Suppose one hypothetical barcode has 1,000 observed counts, including 100 counts from an ambient-marker set. Correction retains 900 total counts and 90 marker counts. Calculate the before-and-after fractions and interpret them.
Before correction, the marker fraction is \(100/1{,}000=0.10\), or 10%. After correction, it is \(90/900=0.10\), also 10%. The marker count fell by 10 counts, and the total fell by 100 counts. Both the marker set and the total were reduced by 10%, so the fraction stayed unchanged.
Now suppose instead that correction retained 95 marker counts while still retaining 900 total counts. The post-correction fraction would be \(95/900=0.1056\), or 10.56%. The marker count fell from 100 to 95, but its fraction rose from 10% to 10.56% because the overall total fell proportionally more. The fraction alone would not show that marker counts had been removed.
Worked Diagnostics
Worked Example: A Pattern Consistent With Undercorrection
Consider a hypothetical barcode with 1,200 observed counts, of which 96 belong to a carefully selected ambient-sentinel set. The method estimates \(\rho_i=0.12\). After correction, the total is 1,140 and the sentinel count is 36. Assume for this example that the sentinel genes are expected to have negligible genuine expression in this cell type, and that the ambient profile is appropriate.
The sentinel fraction before correction is \(96/1{,}200=0.0800\), or 8.00%. After correction it is \(36/1{,}140=0.03158\), or 3.16%. The estimated removal is \(96-36=60\) sentinel counts and \(1{,}200-1{,}140=60\) counts overall. Thus, the sentinel signal has decreased substantially, but 36 sentinel counts remain.
Given the stated assumption that these genes should have negligible endogenous expression, the remaining sentinel signal is a reason to investigate possible undercorrection. It is not proof: the ambient profile, marker choice, or cell-type assignment could be wrong. Compare these results with other high-\(\rho_i\) barcodes and inspect whether the same sentinels persist systematically.
Worked Example: A Pattern Consistent With Overcorrection
In a hypothetical cell type, a trusted cell-type marker has 40 counts in a barcode before correction and 12 after correction. The total changes from 1,000 to 940 counts. In comparable low-contamination barcodes of the same cell type, the marker typically changes from 38 to 36 counts. Assume the marker is expected to be expressed in this cell type.
For the barcode of interest, the marker count falls by \(40-12=28\), a reduction of \(28/40=0.70\), or 70%. Its fraction changes from \(40/1{,}000=4.00\%\) to \(12/940=1.277\%\). In the comparison barcodes, the marker falls by \(2/38=0.05263\), or 5.26%.
The much larger loss for the barcode of interest, especially if its removed counts overlap the marker genes, raises concern about overcorrection or a mismatched ambient profile. The comparison is meaningful only if the barcodes have comparable cell identity and the marker is biologically appropriate. A low marker count could also reflect a real cell state with weak expression; inspect several markers and the distribution across the cell type before drawing a conclusion.
Worked Example: A Balanced Before-and-After Pattern
A hypothetical barcode has 5,000 observed counts, including 150 ambient-sentinel counts and 300 cell-type-marker counts. After correction it has 4,700 counts, 15 sentinel counts, and 285 cell-type-marker counts. The estimated contamination is higher than for most barcodes in the same sample.
The sentinel fraction falls from \(150/5{,}000=3.00\%\) to \(15/4{,}700=0.003191\), or 0.3191%. Its count falls by 90%. The cell-type-marker fraction changes from \(300/5{,}000=6.00\%\) to \(285/4{,}700=0.06064\), or 6.064%. Its count falls by \(15/300=5.00\%\), while its fraction is nearly preserved.
This pattern is compatible with selective reduction of ambient-sentinel signal while retaining cell-type-marker signal. It is reassuring, not definitive: the sentinel set could include genuine expression, and other barcodes or genes may behave differently. Check whether this pattern holds across relevant groups rather than judging the method from one barcode.
How to Diagnose Failure and Choose Comparisons
A practical assessment combines paired plots or tables with biological context. Begin with the same filtered barcode set before and after correction. Summarize observed and corrected totals, the amount removed, ambient-marker counts and fractions, cell-type-marker counts and fractions, and \(\rho_i\). Then inspect these measures by cell type and across the range of contamination estimates. A consistent association between higher \(\rho_i\), stronger pre-correction ambient signal, and greater removal is plausible, but it is not a required exact linear relationship.
Several patterns deserve follow-up:
- Possible undercorrection: ambient sentinels remain conspicuous after correction, especially in barcodes with high estimated contamination, under assumptions that those genes are not genuinely expressed.
- Possible overcorrection: expected cell-type markers are depleted, or their signal drops sharply in a subset of cells despite little corresponding evidence that those markers belong to the ambient profile.
- Unexpected total-count changes: removal is negligible in barcodes with strong evidence of contamination, or exceptionally large in barcodes with little such evidence. Check whether filtering, gene sets, or the method's output definition explains the discrepancy.
- Group-specific disagreement: diagnostics look acceptable overall but fail in one cell type or sample. This may indicate differing ambient profiles or incorrect marker assumptions rather than one global correction behavior.
A simple threshold on residual marker fraction is easy to communicate, but a threshold discards information about the total, cell identity, and marker reliability. Paired visual diagnostics preserve those patterns but require judgment. A broader marker panel can reduce dependence on one gene, though correlated or misclassified markers do not provide independent confirmation. Comparison with an alternative correction method can reveal sensitivity to modeling choices, but agreement between methods does not establish truth if both share the same incorrect assumptions.
Diagnostics cannot recover information that the data and assumptions do not identify. Genuine expression and ambient contribution can overlap at the same genes. A low corrected count may mean successful removal or loss of biology; a high one may mean true expression or residual contamination. In particular, a barcode-level estimate \(\rho_i\) summarizes contamination under a model and should not be read as a guarantee that each gene's corrected count is accurate.
Common Mistake
Wrong reasoning: “The ambient-marker percentage increased after correction, so correction added ambient RNA or failed.”
Correction: A percentage depends on its denominator. As the derivation shows, the fraction can rise when marker counts fall, if the total falls proportionally more. Compare the marker's absolute count, the total count, and the marker fraction together; then check whether the marker is a plausible ambient sentinel for that cell type.
Check Your Understanding
Answer each question, then compare your reasoning with the solutions.
- A barcode changes from 800 total counts and 80 ambient-marker counts to 720 total counts and 40 ambient-marker counts. Calculate the marker fractions before and after, and state what the counts show.
- Why is a cell-type marker's persistence after correction not, by itself, evidence of overcorrection?
- What does it mean if high-\(\rho_i\) barcodes retain conspicuous ambient-sentinel counts, and what assumption is needed to interpret that pattern?
- A marker count decreases from 50 to 40 while the total decreases from 1,000 to 700. Does the marker fraction rise or fall? Calculate both fractions.
Solutions. (1) Before: \(80/800=10.00\%\). After: \(40/720=5.556\%\). The sentinel count is halved, and its fraction also falls; under suitable marker assumptions, this is consistent with reduced ambient signal. (2) The marker may be genuinely expressed in that cell type. Overcorrection is more plausible when expected markers are depleted beyond what ambient contribution would explain, assessed across relevant barcodes and markers. (3) It raises concern about undercorrection, provided the sentinels are expected to have negligible genuine expression in those cells and the ambient profile and barcode assignments are credible. (4) Before: \(50/1{,}000=5.00\%\). After: \(40/700=5.714\%\). The count falls by 20%, but the fraction rises because the total falls by 30%.