Why Filter Genes Before Pseudobulk Testing?
In a pseudobulk analysis, counts are aggregated within a cell type for each biological sample, often a donor-condition combination. The resulting observations, not the individual cells, provide the replication for donor-level inference. Many genes have zero or nearly zero counts in almost every pseudobulk observation. A test for such a gene has little information to estimate an expression difference, yet including it may enlarge the family of hypotheses considered in downstream multiple testing.
Filtering is therefore a preparatory decision about which genes are sufficiently observed to be testable. It is not a test of differential expression, and it does not establish that a gene is biologically irrelevant. A gene expressed in only a few donors may be interesting, but the available data may not support the intended population-level comparison for that gene.
The observations used in this definition must be defined consistently with the analysis. If there is one pseudobulk observation per donor in the cell type and comparison, prevalence is counted across donors. If there are repeated pseudobulk observations from the same donor, counting each as a separate replicate can exaggerate how broadly a gene is observed. The filter should respect the biological sampling structure; repeated records from one donor do not become independent donors by being counted more than once.
Specify the Filter Before Applying It
A useful filter has two parts: an expression threshold and a prevalence requirement. For example, one might retain a gene if it has at least 1 count per million in at least four donor-level pseudobulk observations. Counts per million (CPM) scale a count by the library size, making the threshold less sensitive to the fact that some pseudobulk libraries contain more total counts than others. A raw-count threshold is simpler, but the same raw count can represent different relative abundance in libraries of very different sizes.
Neither a CPM threshold nor a prevalence requirement has a universal best value. The appropriate choice depends on the assay, library sizes, number of biological replicates, cell type, and intended comparison. Set and report the rule before examining gene-wise test results. A threshold should be stringent enough to exclude genes with negligible information, but not so stringent that it discards genes expressed in a biologically meaningful subset of donors.
A pooled rule asks whether a gene meets the expression threshold in enough observations overall. A group-aware rule may instead require the threshold in a minimum number of observations in at least one comparison group. The latter can preserve a gene that is expressed in one condition and absent in the other, an important pattern that a rule requiring expression in both groups could eliminate. However, any group-aware rule must be defined in advance and applied consistently. A group-specific filter can be influenced by the same expression pattern being tested, so its inferential consequences require care; being labelled “pre-specified” does not by itself prove that selection is independent of a test statistic under the null.
Worked Example: Applying a CPM Prevalence Filter
Suppose six hypothetical donors each contribute one pseudobulk library for a cell type. Each library has \(L_i=2{,}000{,}000\) counts. The prespecified rule is to retain genes with CPM of at least 1 in at least four of the six donors. For these libraries, 1 CPM corresponds to \(2\) counts, since \(10^6(2)/2{,}000{,}000=1\).
Gene A has counts \((0,0,2,3,0,4)\). Its CPM values are \((0,0,1,1.5,0,2)\). It meets the threshold in three donors, so \(3<4\) and Gene A is filtered out.
Gene B has counts \((0,2,2,3,4,0)\). Its CPM values are \((0,1,1,1.5,2,0)\). It meets the threshold in four donors, so \(4\geq4\) and Gene B is retained.
The decision is about prevalence across pseudobulk observations, not the number of cells in which a gene was detected. The rule also does not say that Gene A is absent from the biological population; it says only that Gene A fails this chosen support criterion in these six observations.
Choosing Prevalence With the Comparison in Mind
A filter should leave enough observed biological replicates to support the comparison, rather than treating every detected count as equally informative. A gene with nonzero counts in one donor only may be driven by a donor-specific feature and provide weak evidence about a condition-level pattern. Conversely, requiring expression in every donor can remove a genuine condition-specific gene. The minimum prevalence should reflect how many donors can reasonably support the intended pattern, while allowing for biological heterogeneity and sampling variation.
Consider a hypothetical comparison with four control donors and four treated donors. A rule requiring at least three threshold-passing observations in either group can retain genes that are prevalent in one group, including genes with a plausible condition-specific pattern. A pooled rule requiring at least five threshold-passing observations overall would retain a gene observed in three treated donors and two control donors, but would discard one observed in only three treated donors. These rules answer different operational questions; neither should be selected after looking at which genes become significant.
When library sizes vary, a CPM rule can make the expression criterion more comparable across observations, but it does not make the libraries identical or correct every source of bias. In particular, scaling by total library size is a simple measure for filtering, not a substitute for the count model and offsets used in differential expression analysis. Very small libraries may also have unstable CPM values: a handful of counts can cross a relative threshold even though the observation contains little information overall. It can be reasonable to inspect both library sizes and the distribution of counts when setting a rule.
Worked Example: Preserving a Group-Restricted Pattern
Suppose four hypothetical control donors and four treated donors have equal library sizes of \(1{,}000{,}000\) counts. A prespecified group-aware rule retains a gene if it reaches at least 2 CPM in at least three donors in either group. At this library size, 2 CPM corresponds to 2 counts.
Gene C has control counts \((0,0,0,0)\) and treated counts \((3,4,0,5)\). It reaches the threshold in three treated donors and none of the controls. Thus it passes the “at least three in either group” rule. A rule demanding threshold-level expression in both groups would remove it.
The group-aware rule preserves the possibility of testing a gene with a condition-restricted pattern; it does not establish that the pattern is real. The later model must account for the comparison and the donor-level design. If the rule were changed after observing this gene’s counts because its pattern looked compelling, the filter would be data-adaptive in a way that needs explicit justification.
How Filtering Changes the Testing Burden
If \(m\) genes are tested, multiple-testing procedures evaluate evidence across a family of \(m\) hypotheses. Filtering reduces the family to genes that meet the expression criterion. This can improve power when the removed genes are uninformative, but it does not guarantee more discoveries: the retained genes, their test statistics, and their ranking also matter. A smaller family is not permission to report a more favourable result without accounting for how the family was selected.
For example, the Benjamini–Hochberg procedure compares ordered p-values \(p_{(i)}\) with thresholds \(iq/m\), where \(q\) is the target false discovery rate and \(i\) is the rank. At a fixed rank, reducing \(m\) increases that threshold. The calculation below illustrates that arithmetic, not a guarantee that a given gene will be declared significant after filtering.
Thus, at rank 10, the illustrative threshold is larger for a family of 6,000 genes than for 10,000 genes. In an actual analysis, removing genes can change the p-value ranks as well as \(m\); the final decisions must be calculated over the actual retained family. False-discovery-rate interpretation also relies on valid testing and appropriate handling of the selection step. A filter that uses the test results themselves to retain genes can invalidate that interpretation.
A filter based on expression information can be useful when it removes genes with essentially no support, but “condition-blind” is not a complete mathematical guarantee of independence from every test statistic. Under a null hypothesis, a filter should not systematically favour genes with unusually small p-values; the procedure used must justify this condition, or its error control should be assessed by a suitable method. If in doubt, report the filter rule and the number of genes removed, and avoid interpreting the reduction in the testing family as a stand-alone improvement in evidence.
Worked Example: Reporting the Consequence for the Testable Set
In a hypothetical analysis, 12,000 genes are initially quantified for one cell type. A prespecified prevalence rule retains 7,200 genes. Therefore, 4,800 genes are excluded, because \(12{,}000-7{,}200=4{,}800\). The fraction retained is \(7{,}200/12{,}000=0.60\), or 60%.
A transparent report would say that 12,000 genes were quantified, 7,200 met the specified expression-prevalence criterion, and the differential-expression testing family contained those 7,200 genes. It would state the expression threshold, the minimum number of donor-level observations required, and how observations were defined. It would not say that the remaining 4,800 genes were “not differentially expressed”: they were not tested under this analysis because they failed the filter.
Diagnostics, Alternatives, and Common Errors
Before relying on a filter, inspect how it behaves across donors and groups. Useful checks include the number of genes retained at several plausible thresholds, each library’s size, and whether the rule removes nearly all genes from a cell type or disproportionately removes genes with support in one group. A sharp change in the retained set after a small threshold adjustment signals that results may depend strongly on the chosen cutoff. Report such sensitivity rather than presenting one cutoff as inevitable.
Raw-count thresholds, CPM prevalence thresholds, and group-aware prevalence rules are alternatives with different strengths. Raw counts are easy to explain but depend on library size. CPM makes the criterion relative to library size but can be unstable in small libraries. A pooled prevalence rule is simple and avoids explicitly requiring expression in both groups, while a group-aware rule can make the minimum support in a comparison explicit. None replaces inspecting the data or stating the assumptions behind the analysis.
- Mistake: filtering on the number of cells rather than donor-level support. A gene detected in many cells from one donor is not necessarily prevalent across donors. Use the pseudobulk observations that correspond to the intended inferential units.
- Mistake: requiring expression in both groups by default. This can discard condition-restricted patterns. Use a rule suited to the intended comparison and make its selection consequences explicit.
- Mistake: treating filtered genes as proven null. Failure to meet a support threshold means the gene was excluded from testing under the stated rule, not that its effect is zero.
- Mistake: choosing a threshold to maximise discoveries. This makes the filter depend on the desired results. Predefine it, or use an approach whose selection and error control are justified.
- Mistake: counting repeated observations from one donor as independent replicates. Prevalence can describe records, but the rule must not misrepresent the number of biological donors supporting a pattern.
Filtering is most defensible when its purpose is clear, its threshold is reported, and its operation is checked against the actual replication structure. The set of testable genes is part of the analysis definition. Readers need enough information to distinguish genes excluded for low expression from genes tested and found not to meet a differential-expression criterion.
Check Your Understanding
Answer each question, then compare your reasoning with the solutions.
- Five donor-level libraries each contain 1,000,000 counts. A gene has counts \((0,2,0,3,1)\). Under a rule of at least 2 CPM in at least two donors, is it retained?
- Why can a rule requiring expression in both groups remove a gene with a genuine group-restricted pattern?
- A filter reduces the tested family from 8,000 genes to 4,000. Does this alone prove that the resulting false discovery rate is valid?
- One donor contributes three repeated pseudobulk observations and another contributes one. Why might counting all four as four independent donors misrepresent prevalence support?
Solutions. (1) At this library size, 2 CPM equals 2 counts. The gene meets the threshold in two donors, so it is retained. (2) A gene expressed above threshold in one group and below threshold in the other fails a requirement to meet the threshold in each group; the filter would remove the pattern before testing it. (3) No. A smaller family changes the multiple-testing calculation, but valid error control also depends on valid tests and on how selection relates to null test statistics. (4) The three records come from the same biological donor and do not provide three independent donors. Treating them as such overstates the number of donors supporting the gene’s prevalence.