Tutorials › Statistical Methods for Single-Cell RNA Sequencing › Quality Control as a Cell-Validity Decision

Quality Control, Doublets and Ambient RNA · Tutorial 16 of 700

Quality Control as a Cell-Validity Decision

Learn how false-retention and false-removal costs determine a cell-validity decision, and why that decision is distinct from selecting cells for a later biological analysis.

Intermediate 12 min read

What You'll Learn

  • Define cell-level technical validity as a decision target rather than a judgment about biological interest.
  • Derive the probability threshold that minimizes expected loss under two specified error costs.
  • Apply the threshold to hypothetical candidate cells and calculate both decision risks.
  • Explain how changing either error cost affects the threshold, including boundary cases.
  • Distinguish technical QC from removing biologically rare cells or choosing a downstream analysis set.
  • Recognize when uncertain validity probabilities, unsuitable costs, or a rigid cutoff can mislead.

Quality Control Is a Decision, Not a Verdict on Biological Interest

A count matrix can be structurally well formed and still contain barcodes whose counts do not provide adequate evidence of a technically valid cell. Conversely, a cell with an unusual expression profile may be technically valid. Quality control (QC) therefore asks a specific question: given the available technical evidence, should this candidate cell be retained as valid for the intended data set? It does not ask whether the cell is common, easy to interpret, or useful for every later analysis.

The decision has two possible errors. Retaining an invalid candidate is a false retention; removing a valid cell is a false removal. Those errors need not have equal consequences. A decision rule should make the target, evidence, and relative costs explicit rather than treating a single threshold as universally correct.

Definition: For a candidate cell, let \(V=1\) mean that it is technically valid for the stated assay and analysis purpose, and let \(V=0\) mean that it is technically invalid. Let \(E\) denote the available evidence, and let \(p=P(V=1\mid E)\) be the probability of validity conditional on that evidence. A false retention retains a candidate when \(V=0\); a false removal removes a candidate when \(V=1\). Let \(C_{\mathrm{FR}}\geq 0\) be the cost of false retention and \(C_{\mathrm{FM}}\geq 0\) the cost of false removal.

Here, “technically valid” is an operational target: the barcode is sufficiently supported as representing a cell-associated observation under the assay and the intended data-generation context. It is not a claim that every molecule is error-free, that the cell belongs to a particular biological class, or that the cell will be useful for every downstream question. The earlier material on count-matrix structure errors concerns whether the data are represented correctly; cell validity is a separate decision about which observations to retain.

The probability \(p\) is conditional on the evidence and on the model or judgment used to assess it. It is not automatically available just because a candidate has a count profile. If evidence is summarized by a score rather than a calibrated probability, the score must not be substituted for \(p\) without a justified mapping. The decision framework below specifies what to do if a defensible probability and error costs are available; it does not prescribe a particular cell-calling or metric-based method.

Deriving the Cost-Sensitive Decision Rule

Assume the decision is to retain or remove the candidate, the validity state is \(V=1\) or \(V=0\), and the two stated costs describe the losses from the corresponding errors. Correct decisions have loss zero. These assumptions define a simple two-action decision problem; they do not assert that every real analysis has only two relevant actions or that the costs are easy to quantify.

Conditional on the evidence, retaining has expected loss only when the candidate is invalid. Its probability of being invalid is \(1-p\). Removing has expected loss only when the candidate is valid, with probability \(p\). Thus the expected losses are:

$$ L(\mathrm{retain}\mid E)=C_{\mathrm{FR}}(1-p), \qquad L(\mathrm{remove}\mid E)=C_{\mathrm{FM}}p. $$

Choose the action with the smaller expected loss. For positive total cost, retaining is at least as good as removing when:

$$ \begin{aligned} C_{\mathrm{FR}}(1-p)&\leq C_{\mathrm{FM}}p\\ C_{\mathrm{FR}}&\leq (C_{\mathrm{FR}}+C_{\mathrm{FM}})p\\ p&\geq \frac{C_{\mathrm{FR}}}{C_{\mathrm{FR}}+C_{\mathrm{FM}}}. \end{aligned} $$
Decision rule: If \(C_{\mathrm{FR}}+C_{\mathrm{FM}}>0\), retain when \(p\geq C_{\mathrm{FR}}/(C_{\mathrm{FR}}+C_{\mathrm{FM}})\), and remove when \(p\) is below that threshold. At equality, both actions have equal expected loss, so either is optimal under this two-action loss model. If both costs are zero, both actions have zero loss for every \(p\); the formula is undefined and the costs provide no basis for choosing.

The threshold is nonincreasing as \(C_{\mathrm{FM}}\) increases, and it is strictly decreasing when \(C_{\mathrm{FR}}>0\). It is nondecreasing as \(C_{\mathrm{FR}}\) increases, and it is strictly increasing when \(C_{\mathrm{FM}}>0\). These qualifications matter at the boundaries: if \(C_{\mathrm{FR}}=0\) and \(C_{\mathrm{FM}}>0\), the threshold remains zero as \(C_{\mathrm{FM}}\) varies; if \(C_{\mathrm{FM}}=0\) and \(C_{\mathrm{FR}}>0\), the threshold is one. A higher cost of false removal therefore never raises the threshold, but the decrease is not always strict.

A probability threshold of one-half follows only when the two error costs are equal and positive. It is not a universal rule for retaining cells. Moreover, costs should represent the consequences relevant to the analysis, not be chosen merely to make a preferred outcome occur.

Worked Example: Applying Unequal Error Costs

Suppose a hypothetical candidate has an assessed validity probability \(p=0.90\). For this decision, assign a false-retention cost of \(C_{\mathrm{FR}}=8\) loss units and a false-removal cost of \(C_{\mathrm{FM}}=2\) loss units. Assume these values are the intended costs and that the probability is appropriate for the candidate.

The retention threshold is:

$$ \frac{C_{\mathrm{FR}}}{C_{\mathrm{FR}}+C_{\mathrm{FM}}} =\frac{8}{8+2}=0.80. $$

Since \(0.90\geq 0.80\), the rule retains the candidate. The expected loss from retaining is \(8(1-0.90)=8(0.10)=0.80\) loss units. The expected loss from removing is \(2(0.90)=1.80\) loss units. Retention has the smaller expected loss by \(1.80-0.80=1.00\) loss unit. This is a decision under the stipulated costs, not proof that the candidate is valid.

Worked Example: A Lower Validity Probability Can Still Favor Retention

For a second hypothetical candidate, suppose \(p=0.48\), \(C_{\mathrm{FR}}=2\), and \(C_{\mathrm{FM}}=3\). These probabilities and costs are assumed to be suitable for the stated decision.

The threshold is:

$$ \frac{2}{2+3}=0.40. $$

Because \(0.48\geq 0.40\), the decision rule favors retention even though the assessed probability of validity is below one-half. The expected loss from retaining is \(2(1-0.48)=2(0.52)=1.04\) loss units. The expected loss from removing is \(3(0.48)=1.44\) loss units. Retention has \(1.44-1.04=0.40\) fewer expected loss units. The result follows from the higher cost assigned to removing a valid cell, not from interpreting \(0.48\) as strong evidence of validity.

Worked Example: How a Change in Costs Changes the Threshold

Suppose a hypothetical candidate has \(p=0.65\), and the false-retention cost is \(C_{\mathrm{FR}}=6\). First let the false-removal cost be \(C_{\mathrm{FM}}=4\). The threshold is \(6/(6+4)=0.60\), so the rule favors retention. Its expected loss is \(6(0.35)=2.10\) loss units; removal has expected loss \(4(0.65)=2.60\) loss units.

Now increase the false-removal cost to \(C_{\mathrm{FM}}=12\), holding \(C_{\mathrm{FR}}\) and \(p\) fixed. The threshold becomes \(6/(6+12)=1/3\), which is approximately \(0.3333\). It is lower than \(0.60\), so the rule still favors retention. The expected losses are now \(6(0.35)=2.10\) loss units for retention and \(12(0.65)=7.80\) loss units for removal. The threshold decreased as the false-removal cost increased; because \(C_{\mathrm{FR}}>0\), this decrease is strict.

Technical Validity, Biological Rarity, and Analysis Goals

A cell can be unusual and still be technically valid. Rarity describes how often a biological state occurs in the observed population; validity concerns whether the observation meets a technical criterion for inclusion as a cell-associated measurement. Neither a small cluster size nor a surprising expression pattern, by itself, establishes technical invalidity. Conversely, a familiar or common profile does not guarantee validity.

The intended data set also matters. A QC decision defines which observations are considered sufficiently valid for a specified purpose. A later analysis may deliberately focus on a subset—for example, a lineage or condition—without changing the technical validity of cells outside that subset. Such downstream selection should be described as selection for that analysis, not silently recast as QC. Keeping the decisions separate helps prevent an analysis goal from becoming an unsupported claim about assay quality.

In practice, costs may not have natural numerical units. They can be specified as relative losses: for example, one error may be judged three times as consequential as the other. If the costs are only qualitative, the resulting threshold is a structured way to discuss the trade-off, not a precisely estimated optimum. It is also possible to add an “uncertain; review” action. That requires specifying the review cost and how review changes the chance of a correct decision; it cannot be justified by the two-action formula alone.

Assumptions, Diagnostics, and Alternatives

The rule is useful only to the extent that its inputs and decision target are meaningful. Before applying it, check that the validity label has a clear operational definition, that the evidence pertains to that definition, and that \(p\) is reasonably calibrated for the relevant assay and context. Calibration means, roughly, that among candidates assigned probabilities near \(q\), about a fraction \(q\) are valid under the target definition. A probability that is systematically too high or too low can yield an apparently exact but poorly justified decision.

Costs should be stated before interpreting a threshold. If false retention and false removal are treated as equally costly without discussion, the implied one-half threshold may conceal an important scientific trade-off. If costs vary by sample or analysis purpose, one common threshold may not represent the same decision in each setting. Uncertainty in the probabilities or costs should also be acknowledged; a borderline decision is less robust than one that remains unchanged over plausible values.

Several alternatives answer different questions. A fixed cutoff on a technical score is simple, but it does not by itself encode a probability of validity or the relative costs of the two errors. A one-half probability cutoff is the special case of equal positive costs. A manual review or abstention policy adds an action and requires its own loss assumptions. Finally, a downstream analyst may filter cells to define a target population; that is not equivalent to determining technical validity.

Useful warning signs include probabilities that do not correspond to the stated validity definition, a threshold chosen solely because it produces a desired cell count, or large changes in retained cells after small plausible changes to costs. These signs do not automatically make the decision wrong, but they call for a sensitivity check and transparent reporting of the assumptions. This tutorial does not prescribe the evidence-generating method; later QC material addresses particular diagnostics and cell-calling approaches.

Common pitfall: “The probability is below 0.5, so the candidate must be removed.” This is only justified as a minimum-expected-loss rule when false retention and false removal have equal positive costs. With unequal costs, compare \(C_{\mathrm{FR}}(1-p)\) and \(C_{\mathrm{FM}}p\), or use the corresponding threshold. Do not treat biological rarity as a substitute for evidence of technical invalidity.

Check Your Understanding

For each problem, use the stated validity probability and costs as given. Solutions follow the questions.

  1. A candidate has \(p=0.70\), \(C_{\mathrm{FR}}=3\), and \(C_{\mathrm{FM}}=7\). Find the threshold, both expected losses, and the preferred action.
  2. With \(C_{\mathrm{FR}}=5\), what happens to the threshold as \(C_{\mathrm{FM}}\) rises from 5 to 15? State whether the change is strict and why.
  3. If \(C_{\mathrm{FR}}=0\) and \(C_{\mathrm{FM}}>0\), what is the threshold? Does increasing \(C_{\mathrm{FM}}\) lower it?
  4. A rare cell type is observed only twice. Does rarity alone establish that either cell is technically invalid? Explain the distinction.
  5. Why is a one-half probability cutoff not generally justified when the two error costs differ?

Solutions. (1) The threshold is \(3/(3+7)=0.30\). Retention has expected loss \(3(1-0.70)=0.90\) units, while removal has expected loss \(7(0.70)=4.90\) units, so retain. (2) The threshold changes from \(5/(5+5)=0.50\) to \(5/(5+15)=0.25\). The decrease is strict because \(C_{\mathrm{FR}}>0\). (3) The threshold is \(0/(0+C_{\mathrm{FM}})=0\). It does not decrease as \(C_{\mathrm{FM}}\) rises; it remains zero. (4) No. Rarity concerns prevalence, not whether the observations satisfy a technical validity definition. (5) One-half is the threshold only when the costs are equal and positive. With unequal costs, the expected losses must be compared using the stated cost ratio.

Clinical Biostats