Why the Comparison Group Defines the Marker Claim
Calling a gene a “marker” is incomplete unless the comparison is specified. A gene may be highly expressed in one cluster relative to every other cluster, yet show little difference from a particular neighboring cluster. Conversely, a large difference from a low-expressing cluster can make a one-versus-rest contrast look substantial even when the target cluster resembles another large group. The choice of contrast is therefore part of the scientific question, not just a computational detail.
Here, the partition into clusters is treated as fixed for defining and calculating contrasts. This lets us state exactly what is being compared. It does not by itself make inferential tests valid when the same expression data helped create the partition; that data reuse is the double-dipping problem discussed in the earlier material on marker discovery.
A positive contrast means higher average expression in the direction encoded by its positive coefficients, relative to the negative-coefficient groups. Its units are the units of \(Y_{ig}\), such as normalized log-expression units. The coefficients must be read as weights: they determine which clusters contribute to each side and how strongly.
Two Common Contrast Choices
For a target cluster \(r\), a one-versus-rest contrast compares its mean with a weighted average of the means in all other clusters. If the weights \(w_j\) for \(j\ne r\) are nonnegative and sum to one, the contrast is
Two choices are common. Setting \(w_j=n_j/\sum_{\ell\ne r}n_\ell\) makes the reference mean the average across all cells outside the target cluster. Setting \(w_j=1/(K-1)\) gives each other cluster equal weight, regardless of its size. These estimate different quantities when cluster sizes differ; neither is universally preferable.
A pairwise contrast compares two specified clusters:
This asks whether gene \(g\) differs between clusters \(a\) and \(b\), not whether cluster \(a\) is distinctive relative to all other cells or clusters. Reversing the order reverses the sign. If expression is on a log base 2 scale, a difference of \(d\) units corresponds to a ratio of \(2^d\) in geometric means on the original scale, when the logged values represent those measurements.
Worked Example: One Target, Two Reference Weightings
Suppose a hypothetical fixed partition has three clusters. For a gene measured in normalized log-expression units, the cluster means are 4.0, 2.0, and 1.0, and the cluster sizes are 20, 30, and 50 cells. Take cluster 1 as the target.
Cell-weighted rest. The other 80 cells have a pooled mean of
The one-versus-rest estimate is \(4.0-1.375=2.625\) normalized log-expression units. Its claim is that the mean in cluster 1 is 2.625 units above the mean across all non-target cells, with each cell contributing equally to that reference.
Equal-cluster-weighted rest. The reference is \((2.0+1.0)/2=1.5\), so the contrast is \(4.0-1.5=2.5\) units. This asks how cluster 1 compares with the average of the two other cluster means, giving those clusters equal influence. The difference between 2.625 and 2.5 is not a calculation error: the two contrasts define different reference groups.
For the cell-weighted contrast, the coefficients in cluster order are \(1,-30/80,-50/80\), or \(1,-0.375,-0.625\). They sum to zero, as required. For the equal-cluster contrast they are \(1,-0.5,-0.5\).
Estimating Uncertainty Under a Fixed-Partition Model
A standard-error calculation requires assumptions about how the cell measurements vary. For the result below, assume cells are independent across clusters and, within each cluster, are independent and identically distributed with finite variance \(\sigma_{jg}^{2}\). Cluster sizes are treated as fixed. These assumptions allow different means and variances in different clusters. They are not automatic in single-cell data: cells from the same donor, for example, may be correlated.
Write \(s_{jg}^{2}\) for the usual sample variance of gene \(g\) in cluster \(j\). Under the stated assumptions, the variance of the estimated contrast is the sum of the cluster-mean variances weighted by squared contrast coefficients. Replacing each unknown within-cluster variance by its sample variance gives an unbiased estimator:
This formula is not justified by independence and finite variances alone. The within-cluster sample variance estimates the population variance without bias under the identically distributed assumption; independence gives \(\mathrm{Var}(\bar{Y}_{jg})=\sigma_{jg}^{2}/n_j\). If observations within a cluster have different distributions, or cells are correlated, \(s_{jg}^{2}/n_j\) need not estimate the variance of the cluster mean appropriately.
For a conventional test of \(H_0:\theta_g=0\), one might divide the estimated contrast by its standard error. A normal or \(t\)-based reference distribution additionally requires suitable distributional conditions, such as approximately normal cluster means or adequate sample sizes for a large-sample approximation. Even when these fixed-partition assumptions are reasonable, a test that ignores how the partition was selected does not account for selection based on the same expression data.
Worked Example: Standard Error for a One-Versus-Rest Contrast
Continue the hypothetical example, using the cell-weighted contrast with coefficients \(1,-0.375,-0.625\). Suppose the within-cluster sample variances are \(s_{1g}^{2}=0.64\), \(s_{2g}^{2}=1.00\), and \(s_{3g}^{2}=0.81\), in squared normalized log-expression units. Assume independent, identically distributed observations within each cluster, independent clusters, and fixed cluster sizes. These assumptions are stipulated for the calculation; they should not be presumed for real cells.
The estimated contrast variance is
Thus \(SE(\hat{\theta}_g)=\sqrt{0.043015625}=0.2074\) normalized log-expression units, to four significant figures. The estimate remains 2.625 units. The standard error quantifies sampling variability under the stated model; it does not measure uncertainty from choosing the clusters or the contrast after inspecting these data. In particular, this calculation alone does not warrant a post-clustering p-value.
How the Contrast Changes the Biological Interpretation
A contrast specifies a relative claim. “Higher in cluster 1 than in the other cells, on average” is different from “higher in cluster 1 than in cluster 2.” Neither statement implies that the gene is unique to the target cluster, that every target cell expresses it, or that the gene causes the cluster identity. Means can conceal overlap and heterogeneity among cells.
Worked Example: Pairwise Difference and Expression Scale
Suppose, hypothetically, that a gene has mean normalized log base 2 expression 3.2 in cluster A and 2.5 in cluster B. The pairwise contrast A minus B is
On the original scale, the corresponding ratio of geometric means is \(2^{0.7}\approx1.625\). Thus the geometric mean expression is about 1.625 times as high in A as in B, under the interpretation of the log transformation used. This does not say that the arithmetic mean expression is 1.625 times as high, nor that every cell in A exceeds every cell in B. The pairwise claim is specifically about these two clusters.
Worked Example: A Pooled Rest Can Hide a Strong Pairwise Contrast
Consider hypothetical cluster means of 5.0 in A, 4.0 in B, and 0.0 in C. Suppose B contains 90 cells and C contains 10 cells. For target A, the cell-weighted rest mean is
The pairwise contrast A minus B is only \(5.0-4.0=1.0\), while A minus C is \(5.0-0.0=5.0\). The large A-versus-C difference contributes to the one-versus-rest contrast, but the many B cells pull the pooled reference toward B. The resulting 1.4-unit estimate is a comparison with the cell-weighted mixture of B and C; it is not a summary of how strongly A differs from each cluster separately.
Diagnostics, Alternatives, and Limitations
Before interpreting a reported contrast, check the following points:
- State the scale and target. Specify the expression transformation, target cluster, and exact reference group. “Marker” without these details is ambiguous.
- Inspect cluster sizes and weights. A cell-weighted rest can be dominated by a large cluster. An equal-cluster-weighted rest answers a different question, not a universally corrected one.
- Look beyond the mean. Expression distributions may be skewed, zero-heavy, or heterogeneous. A mean contrast alone does not describe the fraction of expressing cells or distributional overlap.
- Check the sampling unit. If multiple cells come from each donor, treating all cells as independent can make uncertainty appear too small. The independent sampling unit and study design must support the variance calculation.
- Separate description from inference. If clustering and marker assessment use the same gene-expression data, a fixed-partition standard error does not correct for data-adaptive selection. Descriptive differences can still be reported, but ordinary fixed-label tests do not automatically have their usual error rates.
One-versus-rest is useful when the scientific question concerns a target population relative to a clearly defined background. Pairwise contrasts are preferable when the question names a particular competing population. Reporting both may help describe a pattern, but it creates multiple claims and should not be treated as though only one comparison had been considered. A different summary, such as comparing proportions of cells expressing a gene, addresses a different estimand and is not interchangeable with a mean-expression contrast.
Check Your Understanding
Answer each question, then compare with the solutions below.
- For three clusters, write the coefficients for cluster 2 versus the cell-weighted rest when \(n_1=20\) and \(n_3=30\). What claim does this contrast represent?
- Cluster means are 6, 4, and 1, with equal cluster sizes. What is cluster 1 minus the cell-weighted rest? What is cluster 1 minus the equally weighted average of the other cluster means?
- For a pairwise log base 2 expression contrast of 1.0 unit, what ratio of geometric means does this represent? What does it not establish?
- Why is independence plus finite variance insufficient, by itself, to justify estimating a cluster-mean variance with \(s^2/n\)?
Solutions. (1) The coefficients in cluster order are \((-20/50,1,-30/50)=(-0.4,1,-0.6)\). They compare cluster 2 with the mean of the 50 non-target cells, weighted by their cluster sizes. (2) With equal sizes, both rest definitions give \((4+1)/2=2.5\); each contrast is \(6-2.5=3.5\) expression units. (3) The ratio is \(2^1=2\), so the geometric mean on the original scale is twice as high in the first group under the specified transformation; this does not imply all cells in that group have higher expression or establish a causal effect. (4) The sample variance need not estimate the variance of a sample mean as \(s^2/n\) without assumptions supporting that variance calculation. Under independent, identically distributed observations within a cluster with finite variance, the usual sample variance is unbiased for the common variance, which yields the stated estimator for the mean variance.