From Cells to Paired Donor Comparisons
A paired pseudobulk analysis asks whether expression in a specified cell type differs between two conditions while accounting for the fact that both conditions were measured in the same donors. The essential unit of replication is the donor, not the individual cell. Aggregating counts within each donor-condition combination preserves that replication structure and avoids treating cells from one donor as independent biological replicates.
The workflow has four linked decisions: define the cell type and paired samples, sum raw counts within each sample, encode donor and condition in the model, and test a clearly defined gene-level contrast. The worked numbers below are hypothetical. They illustrate the calculations; they do not represent a real study.
Aggregation is performed separately for each gene and donor-condition sample. If a sample contains \(m_{dc}\) cells, then \(Y_{gdc}=\sum_{j=1}^{m_{dc}} y_{gdcj}\), where \(y_{gdcj}\) is the raw count for gene \(g\) in cell \(j\). The same cell assignments must be used consistently across genes. Counts are summed, not averaged; the resulting library size or a normalized size factor is accounted for in the count model.
Worked Example: Creating a Donor-Condition Pseudobulk
Suppose a hypothetical cell type is observed in donor D1 under control and treatment. Three control cells have raw counts 4, 6, and 3 for gene G. Two treatment cells have counts 5 and 8. The control pseudobulk count is \(4+6+3=13\), and the treatment pseudobulk count is \(5+8=13\). The cell counts differ, but the two aggregates remain one paired observation from D1.
Suppose the corresponding total library sizes, summed across all genes, are 10,000 for control and 11,000 for treatment. These are separate from gene G’s counts: the gene-specific counts are 13 and 13, while the library sizes describe the total sequencing counts used to account for sample depth. The number of cells is not a substitute for either quantity.
If a particular donor-condition sample has no cells assigned to the target cell type, it does not supply an observed zero-expression pseudobulk for that cell type. It is a missing sample for this analysis. Treating it as an all-zero count profile would conflate absence of sampled cells with zero expression among sampled cells.
Model and Paired Design Matrix
For each gene, a standard pseudobulk count model is a negative binomial generalized linear model. Write \(Y_{gdc}\) for the observed count and \(\mu_{gdc}\) for its expected count. One common parameterization has variance \(\mu_{gdc}+\phi_g\mu_{gdc}^2\), where \(\phi_g\) is the gene-specific dispersion. A log link relates the expected count to a sample-specific size factor and the design:
Here \(s_{dc}\) is a size factor, \(\alpha_{gd}\) is the gene-specific donor effect, \(T_c=0\) for control and \(T_c=1\) for treatment, and \(\beta_g\) is the common treatment-versus-control log mean contrast for gene \(g\), conditional on the size factors and donor effects. A positive \(\beta_g\) indicates a higher expected normalized count under treatment. The corresponding fold change is \(\exp(\beta_g)\), and the log base 2 fold change is \(\beta_g/\log(2)\).
This model assumes that the negative binomial mean-variance relationship is adequate, the size factors reasonably account for library-depth differences, and the modeled donor and condition effects describe the design. The paired fixed-effect version assumes a common condition effect across donors; it does not estimate a separate treatment effect for every donor. It also requires the condition contrast to be identifiable: paired samples must exist across donors, and condition must not be inseparable from another design feature such as batch.
For four complete pairs, one equivalent design-matrix parameterization uses an intercept, indicators for donors D2 through D4, and a treatment indicator. D1 is the reference donor. Rows are ordered by donor, with control then treatment within each donor:
With this coding, the coefficient of \(T\) is the treatment-versus-control contrast. In matrix notation, if the fitted coefficient vector is \(\hat{\boldsymbol\beta}_g\), the contrast is \(c^\mathsf{T}\hat{\boldsymbol\beta}_g\), where \(c=(0,0,0,0,1)^\mathsf{T}\). The null hypothesis for no condition difference is \(H_0:\beta_g=0\); a two-sided alternative is \(H_a:\beta_g\ne 0\).
Worked Example: Why the Donor Terms Make This Paired
In the displayed design, D3 has rows \((1,0,1,0,0)\) for control and \((1,0,1,0,1)\) for treatment. The only design entry that changes within that donor’s pair is the treatment indicator. The donor indicator accounts for D3’s baseline level relative to D1, while the treatment coefficient represents the shared condition contrast.
A short justification follows from the model. For a fixed donor \(d\), subtract the log expected count per size factor under control from that under treatment:
Thus, on the modeled log-mean scale, the donor baseline cancels in a within-donor contrast. This explains why donor blocking can remove variation in baseline expression among donors from the condition comparison. It does not mean that a raw difference of counts, or a raw log ratio, is exactly the fitted contrast: the model also accounts for offsets, dispersion, and the full set of observations.
Gene-Wise Contrasts and Multiplicity
A fitted model gives an estimate and uncertainty for the condition coefficient for each gene. For a Wald test, the statistic is the estimated coefficient divided by its standard error. The two-sided p-value is calculated under the null reference distribution used by the analysis. A Wald statistic using a standard normal reference is an asymptotic approximation; with few donors, its calibration and uncertainty deserve particular scrutiny. The choice of test and any small-sample calibration should be specified rather than assumed to be interchangeable.
Worked Example: From Fitted Coefficients to Adjusted Results
Suppose a hypothetical paired analysis reports the following four gene-level estimates. Estimates and standard errors are both in log base 2 fold-change units. For transparent arithmetic, assume the reported two-sided p-values use standard-normal Wald statistics. The fitted values below are supplied outputs; they cannot be recovered from the design matrix alone.
| Gene | Estimated log2 fold change | SE | Wald statistic | Two-sided p-value |
|---|---|---|---|---|
| A | 1.00 | 0.25 | 4.00 | 0.0000633 |
| B | -0.50 | 0.25 | -2.00 | 0.0455 |
| C | 0.20 | 0.20 | 1.00 | 0.3173 |
| D | 1.20 | 0.50 | 2.40 | 0.0164 |
For gene A, \(z=1.00/0.25=4.00\), giving a two-sided standard-normal p-value of approximately \(2P(Z\ge 4.00)=0.0000633\), where \(Z\sim N(0,1)\). Its estimated treatment-to-control fold change is \(2^{1.00}=2.00\). This is an estimated twofold higher normalized mean under treatment, not a claim that every donor has exactly twice the expression.
To adjust the four p-values by the Benjamini–Hochberg procedure, first sort them: A (0.0000633), D (0.0164), B (0.0455), and C (0.3173). For \(m=4\) tests, the rank-\(i\) quantity is \(p_{(i)}m/i\), with adjusted values constrained to be nondecreasing across sorted p-values. The calculations are approximately \(0.0000633(4/1)=0.000253\), \(0.0164(4/2)=0.0328\), \(0.0455(4/3)=0.0607\), and \(0.3173(4/4)=0.3173\). These values are already nondecreasing, so they are the adjusted p-values in sorted order.
At an adjusted-p-value threshold of 0.05, genes A and D meet the stated threshold; B and C do not. This procedure targets the expected proportion of false discoveries among rejected hypotheses under its applicable dependence conditions. It does not give the probability that a particular gene is null, and a non-significant result does not establish that the gene has no condition effect.
Checks, Alternatives, and Limits
Before interpreting results, verify that each aggregate corresponds to the intended donor, condition, and cell type; that each donor’s pair is matched correctly; and that raw counts, not transformed expression values, were summed. Inspect the design matrix for duplicated or missing samples, aliased columns, and condition-batch confounding. Check whether size factors and the gene-wise mean-variance fit are plausible, and review residual, influence, and outlier diagnostics. These checks matter because a correctly calculated contrast from a poorly specified or poorly fitting model is still unreliable.
A paired model is appropriate when the same biological donors contribute both conditions and the scientific target is a condition contrast adjusted for donor baseline. An independent-group model instead treats the two condition groups as separate sets of donors; it does not use within-donor pairing and is not a replacement for a paired design when matching is present. Cell-level mixed models offer another way to represent donor clustering, but they have different assumptions and computational demands. Neither approach justifies counting cells as independent biological replicates.
The fixed donor-effect model estimates a shared condition effect. If treatment responses vary substantially among donors, that common-effect summary may not describe the variation of individual responses; the paired analysis here does not resolve that question. Incomplete pairs, very few donors, confounding, and influential samples can also limit interpretation. Statistical significance should be considered alongside effect size, uncertainty, model diagnostics, and the biological context.
Check Your Understanding
Answer each question, then compare with the brief solutions.
- For one gene, a donor has three control-cell counts of 2, 4, and 5. What is the control pseudobulk count?
- In the paired model, what does \(\beta_g\) represent, and what is the null hypothesis for no condition difference?
- A fitted log2 fold change is \(-1\). What is the estimated treatment-to-control fold change?
- Why is a donor with no sampled cells of the target type in one condition not automatically assigned a zero pseudobulk for that condition?
- Four p-values in sorted order are 0.01, 0.02, 0.20, and 0.50. What are their Benjamini–Hochberg adjusted p-values?
Solutions. (1) \(2+4+5=11\) counts. (2) It is the common treatment-versus-control log mean contrast after accounting for the size factor and donor effects; \(H_0:\beta_g=0\). (3) \(2^{-1}=0.5\), so the estimated normalized mean under treatment is half that under control. (4) No sampled cells means the cell-type sample is missing, not that measured cells had zero gene counts. (5) With \(m=4\), the rank-scaled values are 0.04, 0.04, 0.2667, and 0.50; these are nondecreasing, so the adjusted values are approximately 0.04, 0.04, 0.267, and 0.50.