Tutorials › Statistical Methods for Single-Cell RNA Sequencing › Data-Driven Marker Filtering And False Discovery Rates

Marker Genes and the Double-Dipping Problem · Tutorial 313 of 700

Data-Driven Marker Filtering And False Discovery Rates

Learn how to distinguish safe prespecified or null-independent filters from adaptive expression filters that can undermine false discovery rate control.

Advanced 10 min read

What You'll Learn

  • Define the false discovery rate for the marker hypotheses that remain after filtering.
  • State conditions under which filtering preserves valid null p-values.
  • Apply the Benjamini–Hochberg procedure to a filtered gene family.
  • Show why filtering on the observed test statistic makes retained null p-values too small.
  • Distinguish external, prespecified, and null-independent filters from filters selected using marker evidence.
  • Diagnose filtering failures and report the resulting testing family clearly.

Why Filtering Changes the Testing Problem

Marker analyses can involve thousands of genes, including genes with very low expression that provide little information for a comparison. Removing such genes before testing can reduce computational burden and may improve power by limiting the number of hypotheses adjusted together. But filtering is not automatically harmless. If the same expression data determine both which genes are tested and how strongly they appear to differ between clusters, the retained genes may have unusually small p-values even when their null hypotheses are true.

The key question is not simply whether a filter was chosen before the analyst ran a testing command. It is whether, under each true null hypothesis, selection by the filter preserves the p-value's calibration. A filter fixed in advance using external information is often safe. A filter computed from the marker contrast itself is generally not. A filter based on the same expression data can be defensible under a model that establishes the required independence, but that property must be justified rather than assumed.

Definition: For a specified family of \(m\) tested gene hypotheses, let \(R\) be the number rejected and \(V\) the number of rejected true null hypotheses. The false discovery proportion is \(V/\max(R,1)\), and the false discovery rate (FDR) is its expectation: $$ \mathrm{FDR}=E\left[\frac{V}{\max(R,1)}\right]. $$ A filtering rule changes the tested family. FDR for the retained genes is not automatically a guarantee about all genes that could have been considered.

Suppose each gene has a null hypothesis about its marker contrast and a p-value for that hypothesis. A p-value is valid under a null if, for every \(u\) between 0 and 1, \(P(p\le u)\le u\). The inequality allows conservative p-values; a continuous exact test often has equality. After filtering, the relevant requirement is conditional: among true-null genes, the p-values must remain superuniform given the information that determined which genes were retained. Otherwise small p-values can be overrepresented in the tested set.

Conditions for Filtering and FDR Control

A simple safe case is a gene list specified independently of the expression data used for testing, such as a prespecified pathway list. Another is filtering based on a statistic that is independent of the test p-value under the null, with the independence holding after conditioning on the filter information. For instance, a filter computed on one independent data split and a test conducted on another can provide this separation, provided the test itself is valid for the held-out data.

A common data-based filter is the overall abundance or detection rate of a gene. It may seem unrelated to a cluster contrast, but that is not enough: count distributions, group sizes, dispersion, normalization, and the precise test statistic determine whether the filter and null p-value are independent. For a particular model, one may be able to establish the needed conditional independence. Without such a justification, an abundance filter based on the testing data should be treated as potentially dependent, not automatically safe.

Even valid p-values do not by themselves guarantee that every multiple-testing procedure controls FDR under every dependence structure. The Benjamini–Hochberg (BH) procedure controls FDR at level \(\alpha\) when the null p-values are valid and are independent, or satisfy a suitable positive-dependence condition such as positive regression dependence on a subset. The following conditional argument explains why independent filtering can be combined with BH under corresponding assumptions.

Conditional filtering result: Let \(S\) be the set of genes retained by a filter, and let \(m(S)\) be its size. Suppose that, conditional on the filter information and the resulting \(S\), every true-null p-value in \(S\) is superuniform and the p-values satisfy the dependence conditions for BH. Applying BH to the \(m(S)\) retained p-values at level \(\alpha\) then controls conditional FDR at no more than \(\alpha\). Averaging over the filter information also gives unconditional FDR no greater than \(\alpha\).

The conditioning is essential. A statement such as “we filtered before testing” does not establish that null p-values remain valid after selection. In particular, choosing a threshold by looking for the most favorable set of p-values, or retaining genes because their observed contrasts are large, makes the selection event informative about the test statistics.

Applying BH After a Defensible Filter

For \(m\) retained genes, sort the p-values as \(p_{(1)}\le\cdots\le p_{(m)}\). BH finds the largest index \(k\) for which \(p_{(k)}\le k\alpha/m\), then rejects the hypotheses corresponding to \(p_{(1)},\ldots,p_{(k)}\). The denominator is the number of hypotheses actually tested after the filter, not the number of genes in the original matrix. That choice is appropriate only if the filter preserves the conditions needed for valid testing and the inferential target is clearly the retained family.

Worked Example: Prespecified Eligibility Filter and BH

Suppose a hypothetical analysis specifies, before examining the marker contrasts, that only genes with at least 10 detected counts in an external pilot dataset are eligible. Four genes pass this rule. Their p-values from the current marker tests are \(0.001,\ 0.012,\ 0.040,\) and \(0.200\). Assume the pilot filter is independent of the current test data, the tests are valid, and the retained p-values satisfy the independence condition for BH. Use \(\alpha=0.05\).

The ordered p-values are already listed. The BH critical values are \(i\alpha/m\), with \(m=4\):

$$ \frac{1(0.05)}{4}=0.0125,\quad \frac{2(0.05)}{4}=0.0250,\quad \frac{3(0.05)}{4}=0.0375,\quad \frac{4(0.05)}{4}=0.0500. $$

Compare each p-value with its critical value: \(0.001\le0.0125\), \(0.012\le0.0250\), \(0.040>0.0375\), and \(0.200>0.0500\). The largest passing index is \(k=2\), so BH rejects the first two hypotheses. Under the stated assumptions, the procedure controls FDR for this eligible, tested family at no more than 0.05. It does not establish that every excluded gene lacks a marker effect.

Why Filtering on the Test Statistic Can Fail

A filter that directly favors large observed differences, large absolute test statistics, or small p-values truncates the null distribution toward apparently strong evidence. The retained null p-values are then not superuniform conditional on retention. This invalidates the input that BH requires; applying the BH formula afterward cannot repair the distortion.

Worked Example: Selecting Null Genes by Absolute Test Statistic

Consider a single true-null gene with a valid two-sided z-test, so \(Z\sim N(0,1)\) and its p-value is \(p=2\Phi(-|Z|)\). Suppose the analyst retains the gene only if \(|Z|>1\). Under the null, the probability of passing the filter is approximately \(P(|Z|>1)=0.3173\).

For a nominal p-value cutoff of \(0.05\), the test rejects when \(|Z|\ge1.96\). Every such result passes the filter. Thus:

$$ P(p\le0.05\mid |Z|>1) =\frac{P(|Z|\ge1.96)}{P(|Z|>1)} =\frac{0.05}{0.3173} \approx0.1576. $$

Among retained true-null genes, a p-value at most 0.05 occurs about 15.76% of the time, not at most 5%. The selection makes the p-value anti-conservative. This calculation does not mean that every abundance filter has this defect; it shows why a filter tied to the test statistic needs a separate validity argument.

The same problem can arise less obviously when an analyst tries several abundance cutoffs and reports the one giving the most discoveries, or selects genes using observed fold changes and then tests those same contrasts. The threshold itself has become part of an adaptive selection procedure. Merely recomputing BH on the resulting list does not account for that extra selection.

A Practical Decision Sequence

1
Specify the tested family.
State which genes are eligible and which marker hypotheses are being tested. Clarify whether the target is the retained genes or all genes considered initially.
2
Identify the filter information.
Record whether the filter is external, fixed in advance, computed from the testing data, or selected after inspecting marker results.
3
Justify null calibration after selection.
For a data-based filter, establish under the testing model that null p-values remain superuniform conditional on the filter and retained set. If that cannot be justified, do not describe the filter as FDR-safe.
4
Adjust within the retained family.
Apply BH using the number of retained hypotheses, subject to its dependence conditions. If filter choice also used p-values or test statistics, use an inferential strategy that accounts for that selection rather than ordinary BH alone.

When the filter and the test cannot be separated, several alternatives may be considered: use an externally defined gene set; use independent data for filtering and testing; or avoid filtering and adjust across the full prespecified family. Each choice has costs. Testing every gene can reduce power and include uninformative hypotheses, while splitting data can reduce the information available to each stage. A selective or pipeline-aware method may be appropriate when the selection itself is scientifically necessary, but its assumptions and target must be stated explicitly.

Diagnostics, Reporting, and Common Mistakes

Diagnostics cannot prove conditional independence, but they can reveal suspicious behavior. Check whether retained genes are concentrated among the largest observed contrasts or smallest p-values; document how often thresholds were changed; compare the filter statistic with the test statistic among genes expected to be null; and inspect null p-value calibration in settings where null labels or valid negative controls are available. A sharp excess of small p-values after filtering is a warning, though it can also reflect genuine signals. Lack of an obvious pattern is not proof of validity.

Report the filtering variable, its threshold, when and how the threshold was chosen, the number of genes before and after filtering, the multiple-testing procedure, and the assumptions supporting it. State whether the filter was external, prespecified from independent information, or computed from the testing data. This makes the hypothesis family and the scope of the FDR claim interpretable.

  • Mistake: “The filter was chosen before I ran BH, so it cannot affect the p-values.” Correction: Timing relative to BH is irrelevant; what matters is whether selection depends on null test evidence.
  • Mistake: “The average-expression filter is always independent of a marker test.” Correction: Independence is model- and test-specific. Establish it under the null or use a safer source of filter information.
  • Mistake: “BH at 0.05 controls errors among every gene in the original dataset.” Correction: The procedure is applied to the retained family. Excluded genes are not covered by that family-level claim.
  • Mistake: “Changing the filter until more genes pass BH is harmless because the final p-values are adjusted.” Correction: Threshold tuning based on the results adds selection that ordinary BH does not account for.
Key takeaway: Filtering preserves FDR control only when the retained true-null p-values remain calibrated under the selection rule and the multiple-testing procedure's dependence conditions hold. A filter's apparent biological relevance or its timing alone does not establish those conditions.

Check Your Understanding

Answer each question, then compare with the brief solutions below.

  1. A gene list is selected from an independent pilot dataset and tested in a new dataset. What condition makes this filtering strategy defensible for the new tests?
  2. Why is filtering genes by the absolute observed marker z-statistic generally unsafe for ordinary BH adjustment?
  3. Eight genes pass a valid filter. Their ordered p-values are \(0.002,\ 0.009,\ 0.021,\ 0.033,\ 0.090,\ 0.20,\ 0.40,\ 0.80\). At \(\alpha=0.05\), how many are rejected by BH?
  4. Does a filter based on mean expression from the same cells automatically preserve FDR control? Explain.
  5. If the filter removes 900 of 1,000 genes, does BH on the remaining 100 make claims about the excluded 900?

Solutions: (1) The pilot-based selection must be independent of the new test data, and the new tests must yield valid null p-values with the dependence assumptions required for BH. (2) It preferentially retains large null statistics, so retained null p-values can be anti-conservative; ordinary BH assumes calibrated inputs. (3) The BH critical values are \(0.00625,\ 0.0125,\ 0.01875,\ 0.0250,\ 0.03125,\ 0.0375,\ 0.04375,\) and \(0.0500\). The first two p-values pass, while \(0.021>0.01875\), so the largest passing index is \(k=2\) and two hypotheses are rejected. (4) No. Its safety depends on whether it is independent of the null test p-values under the model, conditional on selection. (5) No. The adjustment concerns the retained testing family; excluded genes are not tested or covered by that claim.

Clinical Biostats