Tutorials › Statistical Methods for Single-Cell RNA Sequencing › False Discovery Control in Barcode Calling

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

False Discovery Control in Barcode Calling

Learn to apply and interpret Benjamini–Hochberg adjustment for barcode calls, including how the ambient-test universe affects the results.

Intermediate 10 min read

What You'll Learn

  • Define the barcode hypotheses and the family of tests used for false-discovery control.
  • Apply the Benjamini–Hochberg step-up rule to ordered ambient-test p-values.
  • Distinguish a target false discovery rate from the probability that a particular barcode call is false.
  • Calculate how changing the tested barcode universe changes adjusted calls.
  • Recognize key assumptions, diagnostics, and alternatives to Benjamini–Hochberg.

From Ambient-Test Evidence to Barcode Calls

An ambient test produces evidence about whether a barcode’s RNA is compatible with an ambient-only explanation. A small p-value is evidence against that barcode’s ambient-only null hypothesis, but it does not by itself specify how many barcodes should be called. When many barcodes are tested, some small p-values can occur by chance. False-discovery-rate (FDR) adjustment addresses this multiplicity by setting a rule for making calls across a defined family of tests.

The result depends on two choices that should be made explicit: the FDR threshold and the ambient-test universe, meaning the complete set of eligible barcodes whose p-values are included in the adjustment. A barcode call is therefore not determined by its p-value alone. It also depends on how that p-value ranks among the tested barcodes and how many hypotheses were tested.

Definition: For each tested barcode \(i\), the null hypothesis \(H_{0i}\) represents the ambient-only explanation being tested; the alternative \(H_{ai}\) represents evidence inconsistent with that explanation. A false discovery is a rejected \(H_{0i}\) that is in fact true. If \(V\) is the number of false discoveries and \(R\) the total number of rejections, the false discovery proportion is \(V/\max(R,1)\). The false discovery rate is its expectation: \(\mathrm{FDR}=E[V/\max(R,1)]\).

FDR is an average error rate over repeated applications of a procedure under its assumptions. An FDR target of 0.05 does not mean that each called barcode has a 5% probability of being empty, or that exactly 5% of calls in this particular experiment will be false. The realized proportion can be higher or lower. The target concerns the expected proportion of false rejections among all rejections.

The ambient-test p-values must be valid for the hypotheses being adjusted. In particular, under a true null, a valid p-value is super-uniform: for every \(t\) between 0 and 1, \(P(p_i\le t)\le t\). If a test or an eligibility filter makes null p-values systematically too small, applying an adjustment cannot repair that lack of calibration. The introductory material on EmptyDrops tests for cell-associated RNA supplies the ambient-test context; here the focus is how a family of such p-values becomes a set of calls.

The Benjamini–Hochberg Step-Up Rule

Suppose \(m\) eligible barcodes have been tested, and write their p-values in increasing order as \(p_{(1)}\le p_{(2)}\le\cdots\le p_{(m)}\). Choose a target level \(q\), such as \(q=0.05\). The Benjamini–Hochberg (BH) procedure compares each ordered p-value with a rank-specific threshold.

Definition: The BH procedure finds the largest rank \(k\) for which \(p_{(k)}\le kq/m\). If such a rank exists, it rejects the hypotheses corresponding to \(p_{(1)},\ldots,p_{(k)}\). If no rank satisfies the inequality, it makes no rejections. The values \(kq/m\) are the BH step-up thresholds.

This is a step-up rule: find the last ordered p-value that clears its threshold, then call every barcode with a p-value at least as small. It is not a rule that independently compares each p-value with \(q\), nor does it require every earlier p-value to pass its own threshold. The step-up structure allows a group of moderately small p-values to support calls when the whole ordered set provides sufficient evidence.

Worked Example: Applying BH to Eight Barcodes

Suppose eight hypothetical eligible barcodes have ordered ambient-test p-values \(0.001, 0.004, 0.009, 0.018, 0.031, 0.044, 0.20,\) and \(0.80\). At target \(q=0.05\), the threshold for rank \(i\) is \(0.05i/8\).

Rank \(i\)p-value \(p_{(i)}\)Threshold \(0.05i/8\)Pass?
10.0010.00625Yes
20.0040.01250Yes
30.0090.01875Yes
40.0180.02500Yes
50.0310.03125Yes
60.0440.03750No
70.200.04375No
80.800.05000No

The largest passing rank is \(k=5\): \(0.031\le 5(0.05)/8=0.03125\). Rank 6 fails because \(0.044>6(0.05)/8=0.0375\). Thus BH calls the first five barcodes at target 0.05. The sixth barcode is not called just because its p-value is below 0.05; its relevant comparison is with the rank-6 threshold.

Why the Rule Controls an Expected Error Rate

Under independent, valid p-values, BH controls the FDR at no more than \(q\), and more specifically at no more than \(q m_0/m\), where \(m_0\) is the number of true null hypotheses in the tested family. The same control holds under certain positive dependence conditions, including positive regression dependence on the subset of true nulls (PRDS). These are assumptions about the joint behavior of the p-values, not consequences of sorting them.

A short justification shows why the rank thresholds matter. Consider a true-null barcode \(i\), whose p-value is uniform under the null and independent of the other p-values. Temporarily set its p-value to zero and let \(R_i\) be the number of BH rejections in that modified list. If the original procedure rejects barcode \(i\), setting its p-value to zero does not change the number of rejections: \(R_i=R\). Conditional on the other p-values, \(R_i\) is fixed, and rejection of \(i\) occurs when its p-value is at most \(qR_i/m\). Its conditional expected contribution to \(V/\max(R,1)\) is therefore

$$ \frac{1}{R_i}P\left(p_i\le \frac{qR_i}{m}\,\middle|\,\text{other p-values}\right) =\frac{1}{R_i}\frac{qR_i}{m} =\frac{q}{m}. $$

Summing this contribution over the \(m_0\) true nulls gives an upper bound \(m_0q/m\le q\). With super-uniform rather than exactly uniform null p-values, the corresponding probability is no larger, so the bound still holds. This argument relies on independence; under dependence, the appropriate guarantee needs a condition such as PRDS or a procedure designed for more general dependence.

An adjusted p-value is another way to report the same BH decisions. For the barcode at ordered rank \(i\), its BH-adjusted value is

$$ \widetilde p_{(i)} =\min\left(1,\ \min_{j\ge i}\frac{m}{j}p_{(j)}\right). $$

The minimum over ranks \(j\ge i\) makes the adjusted values nondecreasing with rank. A barcode is called at target \(q\) exactly when its adjusted value is at most \(q\). In the eight-barcode example, the fifth ordered adjusted value is \(0.0496\), so the first five adjusted values are at most 0.05; the sixth is approximately \(0.0587\), so it is not called. An adjusted p-value is a threshold summary for the multiple-testing procedure, not the posterior probability that a particular barcode is a false call.

The Ambient-Test Universe Changes the Calls

The number \(m\) in every BH threshold is the number of p-values in the family. It must count all barcodes in the declared ambient-test universe, not just the barcodes that look promising after their p-values have been inspected. Eligibility rules may be needed to define which barcodes can be tested, but those rules should be specified and applied consistently. If selection uses the same evidence being tested, the validity of the resulting p-values must be justified for that selection; otherwise null p-values may no longer be calibrated.

Adding hypotheses can change calls even when the p-values for previously tested barcodes remain exactly the same. The following calculation isolates that effect.

Worked Example: Enlarging the Tested Barcode Universe

Use the eight p-values from the first example. Suppose four additional eligible barcodes are included, with hypothetical p-values \(0.40, 0.50, 0.70,\) and \(0.90\). The sorted list begins with the same eight values, but now \(m=12\). At \(q=0.05\), the rank-5 threshold is \(5(0.05)/12=0.02083\), which is smaller than \(p_{(5)}=0.031\). The rank-4 threshold is \(4(0.05)/12=0.01667\), below \(p_{(4)}=0.018\). At rank 3, \(0.009\le 3(0.05)/12=0.0125\). Ranks 4 and above do not pass, so the largest passing rank is 3 and BH calls only the first three barcodes.

The added barcodes have large p-values, but including them increases the denominator \(m\), tightening the thresholds at the earlier ranks. Thus “adding only non-significant tests cannot matter” is incorrect for BH. Conversely, the effect of changing a universe is not always a simple reduction in calls: if added p-values are small, they alter both the ranks and the thresholds. The family should therefore represent the barcodes to which the scientific calling procedure was applied, rather than being chosen afterward to obtain preferred calls.

Choosing a Threshold and Comparing Alternatives

The value \(q\) is a policy choice about the desired expected false-discovery proportion, not a quantity estimated from the observed p-values. A smaller target is more stringent. Increasing \(q\) weakens the BH thresholds proportionally and cannot reduce the set of BH rejections for a fixed p-value family. The target should be reported along with the procedure and the universe so that the calls can be interpreted and reproduced.

Worked Example: Changing the FDR Target

Suppose six hypothetical barcodes have ordered p-values \(0.003, 0.011, 0.019, 0.027, 0.060,\) and \(0.40\). At \(q=0.05\), the rank-4 threshold is \(4(0.05)/6=0.03333\), and \(0.027\le0.03333\). Rank 5 fails because \(0.060>5(0.05)/6=0.04167\). The largest passing rank is 4, so the first four barcodes are called.

At \(q=0.10\), the rank-5 threshold is \(5(0.10)/6=0.08333\), so \(0.060\) passes; rank 6 still fails because \(0.40>0.10\). The largest passing rank is now 5, and the first five barcodes are called. The additional call reflects a less stringent target expected FDR, not evidence that the fifth barcode has a 10% chance of being empty.

BH is not the only multiplicity procedure. Bonferroni compares each p-value with \(q/m\) and controls the family-wise error rate, the probability of making at least one false rejection. This can be more conservative when many barcodes are tested, because it targets any false call rather than the expected fraction of false calls. Benjamini–Yekutieli adjusts BH to control FDR under arbitrary dependence using a more stringent threshold involving the harmonic sum \(1+1/2+\cdots+1/m\); it can be substantially more conservative. These alternatives address different error goals or dependence conditions, so the method should match the intended guarantee.

In barcode applications, dependence can arise because barcodes share an estimated ambient profile, library-level conditions, or other components of the testing procedure. BH is standard when its independence or positive-dependence conditions are defensible, but those conditions should not be presumed solely because every barcode has a p-value. Where dependence is concerning, investigators can examine the test construction and consider a dependence-robust procedure, while recognizing its loss of power. Neither BH nor a more conservative adjustment fixes a misspecified ambient null or p-values that are anti-conservative.

Diagnostics, Limitations, and Common Mistakes

Before interpreting calls, check that the analysis retained the exact p-value family and its size, the target \(q\), and the adjustment method. Re-sort the p-values and verify the largest passing rank; a rank-order or denominator error can change the call set. It is also useful to inspect the distribution of p-values and the resulting calls across relevant barcode ranges, but such displays are diagnostics, not a replacement for valid p-values or a defined testing universe.

  • Uncalibrated null p-values: If the ambient model or the test’s selection conditions produce too many small p-values under true nulls, BH’s guarantee may not apply. Investigate calibration under the test’s null assumptions rather than assuming adjustment cures the problem.
  • Unclear universe: Different eligibility filters produce different \(m\) and potentially different calls. Record which barcodes were tested and why excluded barcodes were ineligible.
  • Overinterpretation of \(q\): The target is an expectation across repeated applications under assumptions; it is not a per-barcode error probability or a promise about the realized fraction in one experiment.
  • Boundary and implementation errors: Use the largest passing rank and call all p-values up to that rank. Comparing every p-value only to \(q\), or using \(m\) after dropping inconvenient results, is not the BH procedure.

A common mistake is to say, “This barcode has \(p=0.03\), so it is called because \(0.03<0.05\).” That reasoning ignores multiplicity. In the eight-barcode example, the rank-6 p-value \(0.044\) is below 0.05 but does not pass its BH threshold of 0.0375; it is not called. The correction is to identify the complete test family, order its p-values, apply the rank-specific thresholds, and interpret the resulting set of calls at the chosen target.

Key takeaway: A barcode call from FDR adjustment is a decision within a defined family of ambient tests. State the tested universe, verify that the p-values are valid for that testing procedure, report the BH target, and interpret FDR as a property of the rejection set rather than an individual barcode.

Check Your Understanding

Answer each question, then compare your reasoning with the solutions.

  1. Four hypothetical ordered p-values are \(0.004, 0.020, 0.031,\) and \(0.40\). Using BH with \(m=4\) and \(q=0.05\), how many hypotheses are rejected?
  2. In your own words, what does an FDR target of 0.05 say, and what does it not say about an individual barcode?
  3. Why can adding barcodes with large p-values change BH calls for the original barcodes?
  4. Name one assumption under which BH controls FDR and one condition that can support its use under dependence.

Solutions. (1) The thresholds are \(0.0125, 0.025, 0.0375,\) and \(0.05\). The first three p-values pass their thresholds, while \(0.40>0.05\), so the largest passing rank is 3 and three hypotheses are rejected. (2) Under the procedure’s assumptions, 0.05 is an upper bound on the expected proportion of false rejections among rejections. It is not the probability that a particular barcode is false, nor a guarantee that exactly 5% of this experiment’s calls are false. (3) BH uses the total number tested, \(m\), in its rank thresholds; increasing \(m\) makes those thresholds smaller when ranks and p-values are otherwise unchanged. (4) Independence of valid p-values is one sufficient condition. Certain positive dependence conditions, including PRDS among true-null p-values, also support BH control.

Clinical Biostats