Tutorials › Statistical Methods for Single-Cell RNA Sequencing › Marker Selection for Spot Deconvolution

Spatial Transcriptomics · Tutorial 649 of 700

Marker Selection for Spot Deconvolution

Learn to screen and combine marker genes for spot deconvolution, and diagnose when shared or unstable markers make estimated cell-type proportions unreliable.

Advanced 11 min read

What You'll Learn

  • Define marker specificity, expression adequacy and reference stability for deconvolution.
  • Compare candidate genes using reference profiles across cell types and samples.
  • Derive how marker contrast determines information about a two-type proportion.
  • Calculate how weakly differentiated markers amplify measurement noise.
  • Estimate a proportion from a small, selected marker panel.
  • Diagnose poor marker panels and distinguish selection from alternative remedies.

Why Marker Selection Matters

A spatial spot contains expression from a mixture of cells, but deconvolution can distinguish cell types only through differences in their expression profiles. A gene expressed at a similar level by several cell types may be abundant and reproducible, yet provide little evidence about their proportions. Conversely, a highly distinctive gene may be too weak or variable in the reference to be dependable. Marker selection is therefore a balance: retain genes that are sufficiently expressed, distinguish the cell types of interest, and behave consistently in the reference data.

The target is not simply a list of familiar marker genes. It is a set of genes whose reference profiles allow the mixture proportions to be estimated under a stated measurement model. The introductory material on constrained regression for cell-type proportions establishes the role of a mixture signature and proportion constraints; here the focus is how the choice of genes changes the information in that signature.

Definition: Let \(r_{gk}\) denote the reference expression level of gene \(g\) for cell type \(k\), and let \(y_g\) denote the corresponding normalized expression in one spatial spot. Under a linear mixture model, \(y_g = \sum_{k=1}^{K} p_k r_{gk} + \epsilon_g\), where \(p_k \geq 0\), \(\sum_{k=1}^{K}p_k=1\), and \(\epsilon_g\) is measurement or model error. A marker panel is the selected set of genes used to estimate the proportions \(p_k\). A useful marker is informative for distinguishing relevant cell types, measurable in the spot data, and adequately represented by the reference.

This expression-scale model is an approximation. It is appropriate when the reference and spot values have been put on compatible scales and mixing is reasonably represented by a weighted average. For raw counts, exposure or library size must also be accounted for; a count likelihood is a different observation model, not a reason to treat raw counts as directly comparable expression levels. In either setting, the reference profiles must correspond closely enough to the cells in the tissue. Differences between reference and tissue expression can bias deconvolution even when a gene appears distinctive in the reference.

Marker selection also depends on the question. A gene that separates one pair of cell types may not separate another pair, and a panel for estimating broad cell classes need not be suitable for distinguishing closely related subtypes. Candidate markers should therefore be assessed against the full set of cell types being estimated, not only against a chosen target type.

Three Criteria for Candidate Markers

Specificity describes how much more a gene is expressed in one cell type than in competing types. For two types, a simple contrast for a gene intended to identify type A is \(r_{gA}-r_{gB}\). A relative contrast can be useful when genes differ greatly in overall abundance. For more than two types, compare the target profile with the strongest competing profile, while also checking whether the gene distinguishes the other types that must be estimated.

Expression adequacy asks whether the gene is detected often and strongly enough to be useful in the spot data. A large reference contrast based on near-zero values can be fragile: sampling zeros, low counts, or normalization noise may overwhelm it. Expression adequacy is not the same as specificity. A common, highly expressed gene may be measurable but shared, while a specific gene may be too rare for reliable measurement.

Reference stability concerns whether the gene's cell-type profile is consistent across reference donors, batches, or other relevant strata. Stability should be assessed for the contrast between cell types, not only for each mean in isolation. A marker can have a stable average level in a target type but an unstable difference from its competitors. Reference stability does not guarantee that the gene is stable in the spatial tissue; it is evidence about the reliability of the reference signature.

A practical screen begins with reference pseudobulk profiles by cell type and, where possible, by donor. For each candidate, inspect the mean expression, the between-type contrast, detection frequency, and variability across reference samples. A contrast-to-total score can summarize specificity for an initial ranking, but it is a screening aid rather than a universal selection rule. For example, for two types one possible score is

$$ S_g = \frac{|r_{gA}-r_{gB}|}{r_{gA}+r_{gB}+\epsilon}, $$

where \(\epsilon>0\) is a small fixed offset in the same expression units, chosen to avoid an unstable ratio when both profiles are near zero. This score does not incorporate spot detection or uncertainty in the reference, so it should not be used alone.

Worked Example: Ranking Three Candidate Markers

Suppose a hypothetical reference contains two cell types, A and B. The values below are mean normalized expression levels across reference samples; the last column is the coefficient of variation across those samples for the target-versus-competitor contrast. Use \(\epsilon=0.1\) expression units and consider the genes as candidate markers for A.

Gene\(r_{gA}\)\(r_{gB}\)Contrast CV
G11220.15
G220180.10
G340.50.80

For G1, \(S_{G1}=|12-2|/(12+2+0.1)=10/14.1=0.7092\). For G2, \(S_{G2}=|20-18|/(20+18+0.1)=2/38.1=0.05249\). For G3, \(S_{G3}=|4-0.5|/(4+0.5+0.1)=3.5/4.6=0.7609\).

G2 is abundant and relatively stable, but its small contrast makes it a weak discriminator of A versus B. G1 has a substantial contrast and moderate stability. G3 has the strongest relative contrast, but its contrast CV of 0.80 flags substantial reference variability; its lower expression also calls for checking detection in the spot data. A defensible screening decision would retain G1, investigate G3 with donor-level profiles and spot detection, and not rely on G2 to separate these types. The score ranks specificity; it does not by itself decide the final panel.

Why Shared Markers Can Destabilize Proportions

The key issue is not whether a gene is called a marker in a biological description, but whether its reference expression differs in a way that identifies the mixture. Consider two cell types, A and B, and let \(p\) be the proportion of A, so the proportion of B is \(1-p\). For each selected gene,

$$ y_g = p r_{gA} + (1-p)r_{gB} + \epsilon_g = r_{gB} + p d_g + \epsilon_g, \qquad d_g=r_{gA}-r_{gB}. $$

If the errors are independent with mean zero and common variance \(\sigma^2\), and the reference profiles are treated as fixed and correct, least squares estimates \(p\) by minimizing the sum of squared residuals. Differentiating that sum with respect to \(p\) gives the following unconstrained estimate:

$$ \hat p = \frac{\sum_g d_g(y_g-r_{gB})}{\sum_g d_g^2}. $$

Because \(p\) is a proportion, the fitted value may additionally be constrained to the interval from 0 to 1. The formula shows what carries information about \(p\): the squared contrasts \(d_g^2\). A shared gene with \(d_g=0\) contributes no information about the A-versus-B proportion. If all selected genes are shared, the denominator is zero and the proportion is not identifiable from this panel.

The variance follows directly from the same expression. Substituting \(y_g-r_{gB}=p d_g+\epsilon_g\) into the estimate yields \(\hat p-p=\sum_g d_g\epsilon_g/\sum_g d_g^2\). Independence and common error variance then give

$$ \operatorname{Var}(\hat p) = \frac{\sum_g d_g^2\sigma^2}{(\sum_g d_g^2)^2} = \frac{\sigma^2}{\sum_g d_g^2}. $$

Thus, when the panel's useful contrasts are small, noise is amplified. In a multi-type model the corresponding issue is poor separation among the columns of the selected reference matrix: if several cell types have nearly identical profiles over the selected genes, distinct proportion combinations can produce nearly the same fitted expression. Reference error or systematic expression shifts can make this worse by moving the estimated mixture in directions that the panel can barely distinguish.

Worked Example: Weak Contrasts Amplify Noise

Consider three hypothetical shared genes with reference contrasts \(d_g=0.2\) expression units each and independent measurement errors with standard deviation \(\sigma=0.5\) expression units. The model-based variance is

\(\operatorname{Var}(\hat p)=0.5^2/(0.2^2+0.2^2+0.2^2)=0.25/0.12=2.083\), so the standard deviation is \(\sqrt{2.083}=1.443\) proportion units. This is extremely imprecise for a quantity constrained between 0 and 1. The large value signals that the linear unconstrained estimate can vary far beyond the feasible range; imposing the constraint clips estimates but does not create information.

For comparison, suppose two specific genes have contrasts of 8 and 6 expression units under the same error standard deviation. Then \(\operatorname{Var}(\hat p)=0.25/(8^2+6^2)=0.25/100=0.0025\), with standard deviation \(0.05\) proportion units. The comparison isolates the role of contrast under the stated equal-variance model. It does not imply that large contrasts always win: a gene with unstable reference expression or severe spot measurement error may violate the assumptions and contribute misleading information.

With exact shared profiles, adding such genes to an otherwise adequate panel does not increase information about the proportion under this idealized model. The practical danger is relying on shared genes as if they were discriminative, or allowing a panel to contain too little reliable contrast. If cell-type profiles are nearly shared across the entire panel, the estimates become sensitive to noise and modest reference mismatch.

Assembling and Checking a Panel

Selection is best treated as an iterative design decision, not as a single thresholding rule. Begin with candidates that have plausible cell-type contrasts, then check that their expression and detection are adequate in the spatial assay and that their reference contrasts persist across donors or batches. Examine the selected reference matrix as a whole: a collection of individually plausible genes can still fail if their profiles do not distinguish all cell types jointly. Repeatedly selecting genes from the same correlated biological program can also make apparent evidence less diverse than the gene count suggests.

The assumptions behind the calculations should be checked before interpreting the fitted proportions. At a minimum, the reference and spot measurements should be on compatible scales; the selected genes should have sufficiently reliable reference profiles; the mixture should be reasonably approximated by the chosen linear or count model; and the residual errors should not be dominated by unmodeled gene-specific shifts. For the displayed variance formula, errors must additionally be independent, mean zero and equally variable, with fixed reference profiles. If errors differ in variance, weighted fitting is more appropriate; if errors are correlated, the covariance structure matters.

Useful diagnostics include plots of reference expression by cell type and donor, spot detection rates for selected genes, residuals by gene, and sensitivity of estimated proportions to removing or replacing individual markers. Large changes after dropping one gene indicate that the panel may be relying excessively on that gene. Residual patterns concentrated in one cell type or region can signal reference mismatch or a model failure rather than a need to add more markers. The earlier material on reference mismatch in spatial deconvolution is relevant when those patterns suggest that the reference profile itself does not represent the tissue.

1
Screen candidate profiles.
Compare expression and between-type contrasts across the cell types to be estimated. Remove genes with negligible detection or inadequate reference support.
2
Assess stability.
Recalculate contrasts across donors or batches. Flag genes whose ranking or direction changes substantially, and investigate possible reference heterogeneity.
3
Check panel-level separation.
Inspect whether the selected profiles distinguish each relevant cell type jointly, rather than merely providing many genes with similar shared patterns.
4
Fit and challenge the result.
Estimate proportions using a model appropriate to the measurement scale, then compare fits and estimates across reasonable marker-panel variants.

This strategy differs from selecting genes solely by differential expression. A differential-expression test asks whether a group contrast is supported under its model; marker selection asks whether a gene helps identify mixture proportions in the target assay. A small p-value does not ensure adequate spot detection, stable reference contrasts, or good separation from every other cell type. Conversely, a marker panel should not be selected merely to maximize a training-set fit, which can favor reference-specific noise.

Alternative approaches include using a larger, carefully screened gene set, weighting genes by measurement reliability, or using a model that accounts for count variability and reference uncertainty. These approaches can be preferable when their assumptions match the data, but none can recover proportions that are unidentifiable because the cell types have indistinguishable profiles. Marker selection is also limited by biology: cell states can vary within a nominal type, and genes can change with tissue context. A panel that performs well in one reference or tissue may not transfer unchanged to another.

Common pitfall: “This gene is highly expressed and significant between cell types, so it must be an excellent deconvolution marker.” Abundance and statistical significance do not establish useful, stable separation in the spot assay. Check the size and direction of the reference contrast, its variation across reference samples, and the gene's detection in spots. A large set of shared genes is not equivalent to a well-identified panel.

Worked Example: Estimating a Two-Type Mixture From Selected Genes

Suppose two selected genes have hypothetical reference profiles \(r_{1A}=8,\ r_{1B}=2\) and \(r_{2A}=1,\ r_{2B}=7\), in compatible normalized expression units. In one spot, their measured values are \(y_1=5.2\) and \(y_2=3.7\). Assume the linear mixture model, equal-scale measurements, and independent errors with the same variance for these genes. The cell-type proportion \(p\) is constrained to the interval from 0 to 1.

The first gene implies \(5.2=8p+2(1-p)=2+6p\), so its individual estimate is \(p_1=(5.2-2)/6=3.2/6=0.5333\). The second implies \(3.7=1p+7(1-p)=7-6p\), so \(p_2=(7-3.7)/6=3.3/6=0.5500\).

Both genes have contrasts of magnitude 6, and under the equal-variance assumption the least-squares estimate is their mean: \(\hat p=(0.5333+0.5500)/2=0.5417\). The estimated proportion of type B is \(1-0.5417=0.4583\). These are fitted proportions for this hypothetical spot, not proof that the reference profiles are correct. The close agreement between the two gene-specific estimates is reassuring for this small calculation, but a real analysis should also check residual fit and sensitivity to the chosen panel.

Check Your Understanding

Answer the questions, then compare your reasoning with the solutions.

  1. Two cell types have reference expression 15 and 14 for a candidate gene. Why might this gene be a poor discriminator even if it is detected frequently?
  2. For a two-type mixture with three selected genes, the reference contrasts are 0, 2 and 4. If independent errors have common variance \(\sigma^2=1\), what is the model-based variance of the unconstrained proportion estimate?
  3. In a reference, a gene has a large mean contrast, but the contrast changes sign across donors. What criterion does this raise concern about, and what should be checked?
  4. Why does a constraint that proportions lie between 0 and 1 not solve a marker panel's lack of information?

Solutions. (1) The contrast is only \(15-14=1\) expression unit, so the gene provides little separation between the types despite good detection. (2) The variance is \(1/(0^2+2^2+4^2)=1/20=0.05\) proportion-squared units. (3) This raises concern about reference stability; inspect donor-level profiles and determine whether a subset, batch, or changing cell state explains the sign reversal. (4) The constraint can keep the numerical estimate feasible, but it cannot distinguish mixtures that produce nearly identical fitted expression; the estimate may remain highly sensitive to noise or reference mismatch.

Clinical Biostats