Lecture 16 — Spatial Transcriptomics: Gene Expression in Tissue Context

Bill Cresko

Lecture 16: Spatial Transcriptomics

Where this lecture fits

Goals of this lecture

  • Understand what spatial transcriptomics measures that scRNA-seq cannot
  • Compare the major technologies — Visium, Visium HD, Xenium, MERFISH, CosMx — by resolution / throughput / coverage
  • Read a Visium experiment as a spot-level dataset (≠ single-cell)
  • Apply the standard analysis pipeline: QC → SCTransform → cluster → spatially variable features → integration
  • Know when to use deconvolution (RCTD, CARD, cell2location) vs spatial clustering (BANKSY, STAGATE)
  • Recognize the limits — bin size vs cell size, edge artifacts, depth heterogeneity

Part 1 — What does “spatial” buy us?

The dissociation lie

scRNA-seq starts with dissociation: tissue → cell suspension. That gives you each cell’s transcriptome but loses everywhere it ever was in the tissue. For developmental biology, immunology, and disease microenvironments, position is the answer to half your questions.

  • Where in the tumor are the exhausted T cells? Adjacent to which tumor sub-clones?
  • In the developing kidney, which transcriptional state precedes which?
  • Are immune cells in the ductal periphery or the lobular core? Granular / scattered or concentrated in foci?
  • Which genes are expressed only at tissue boundaries, where dissociation would shred the spatial signal?

Spatial transcriptomics at a glance

Spatial preview — what gets measured, where, and how

  • Counts plus coordinates — every observation has a (x, y) location in the tissue
  • Different platforms make different trade-offs between resolution, gene panel size, and field-of-view
  • The downstream toolchain reuses scRNA-seq machinery but adds spatial-aware steps (Moran’s I, deconvolution, region detection)

What spatial measures

The left panel shows Hpca (a hippocampal marker) measured on a Visium tissue section — the gene’s expression traces the hippocampus. The right panel shows the same cells re-shuffled (as scRNA-seq would after dissociation) — same expression, no anatomy.

Part 2 — The technologies

The landscape

Technology Resolution Throughput Genome coverage Best for
10x Visium (v1, v2) 55 µm spots ~5,000 spots / section Whole transcriptome First spatial study; tissue overview
10x Visium HD 2 µm bins (sub-cellular) ~6 M bins / section Whole transcriptome High-res Visium replacement (2023+)
10x Xenium Single-cell, sub-cellular 100k–500k cells 200–5000 gene panel Single-cell-resolution spatial; targeted panels
MERFISH (Vizgen) Sub-cellular 100k–1M cells ~500–1,000 gene panels (larger custom panels available) High plex, single-cell resolution
NanoString / Bruker CosMx Sub-cellular similar to MERFISH ~1,000-plex panels up to a ~19,000-gene whole-transcriptome panel Clinical samples, FFPE
Slide-seq / Slide-tags 10 µm ~50k beads Whole-tx (Slide-seq); Xenium-like (Slide-tags) Higher resolution than Visium, less spatial-uniform
GeoMx DSP (Nanostring) Region-of-interest 100s of ROIs Whole-tx or panel Pathology-driven ROI analysis

Note

Two axes to watch. Resolution (spot vs cell vs sub-cellular) and coverage (whole-transcriptome vs targeted panel). Visium is high-coverage / low-resolution; Xenium is targeted / high-resolution. The right choice depends on whether your hypothesis is “where in the tissue is gene X expressed?” (panel suffices) or “what are the cell-type-specific expression programs?” (whole-transcriptome better).

Visium 101 — the workhorse

The key constraint: a Visium spot is not a single cell. Your “marker gene” expression at one spot is a mixture of whatever cells are within it. This shapes everything downstream — clustering recovers tissue regions (not cell types), DE recovers region-vs-region differences, and “deconvolution” is its own analytical step.

Visium HD — sub-cellular bins

In 2023 10x released Visium HD with 2 µm × 2 µm capture squares (much smaller than a cell). Output bins at 8 µm (~1 cell) or 16 µm (multi-cell) provide the choice between resolution and depth. Same chemistry as classic Visium but ~1000× more bins per section.

For atlas-scale work in 2026, Visium HD has largely replaced classic Visium. The analysis pipeline is the same; the file sizes are bigger.

Part 3 — The Visium analysis pipeline

Spot-level QC — three metrics, plus a fourth

Per-spot QC metrics generalize from scRNA-seq (nCount_Spatial, nFeature_Spatial, percent.mt) but you should always plot them on the tissuespatial QC is the fourth metric:

  • A localized region of low UMI counts? White matter, edge artifacts, bubbles. Don’t filter blindly.
  • A localized region of high percent.mt? Could be necrotic tissue (real biology) or storage damage (technical).
  • Correlated drops in both? The spot is on tissue but in poor condition.

Tutorial dataset — stxBrain (matched mouse brain sections)

Note

Module 16 uses the stxBrain dataset from SeuratData: two matched Visium sections of an adult mouse brain — anterior (~2,700 spots) and posterior (~3,300 spots). It installs with one R command (SeuratData::InstallData("stxBrain")) — no manual download. Each spot is ~55 µm capturing ~1–10 cells. Anatomical landmarks to recognize: cortex, hippocampus (Hpca), white matter (Plp1), cerebellum (Pcp4).

Why SCTransform on Visium

Visium spots have a wider dynamic range than single cells (each spot is 1–10 cells). LogNormalize works but SCTransform is preferred — its regularized negative binomial models the depth-vs-variance relationship more cleanly at the spot level.

library(Seurat)
brain <- LoadData("stxBrain", type = "anterior1")
brain <- SCTransform(brain, assay = "Spatial", verbose = FALSE)

Clustering — but the clusters are regions, not cell types

Tip

A spatial cluster that occupies one contiguous anatomical region is biologically meaningful (cortex, hippocampus, etc.). A cluster scattered as random spots across the section is typically a technical signature (depth, ambient RNA) — not real biology.

Spatially variable features — Moran’s I

Some genes vary spot-to-spot with spatial structure (clear pattern on the tissue); some vary spot-to-spot but spatially randomly. The first kind is what you want.

Moran’s I is the standard test:

\[I = \frac{N}{W} \cdot \frac{\sum_i \sum_j w_{ij} (x_i - \bar x)(x_j - \bar x)}{\sum_i (x_i - \bar x)^2}\]

where \(w_{ij}\) is the spatial weight (large for spatially close spots, zero for far). High Moran’s I means high spatial autocorrelation — adjacent spots have similar expression.

Part 4 — Cell-type deconvolution

The mixture problem

Each Visium spot ≈ 1–10 cells. If a spot’s cluster is “putative neuron-rich region”, which kinds of neurons? In what proportions?

Deconvolution decomposes each spot’s mixture using a single-cell reference of the same tissue:

Tools

Tool Method Notes
RCTD / spacexr Maximum likelihood with cell-type-specific platform effects Workshop default for Visium
CARD Conditional autoregressive prior on neighborhood smoothness Smoother results, harder to use
cell2location Bayesian, Python Atlas-scale; pairs natively with HCA
SPOTlight Non-negative matrix factorization Good when you don’t have a great reference
CIBERSORTx Support-vector regression Originally bulk; works on spatial

Tip

Use a tissue-matched reference. Deconvolving a brain Visium with a PBMC reference returns garbage (PBMCs don’t include neurons). Match the reference to the tissue you sampled.

Part 5 — Spatial-aware clustering

Beyond standard SNN+Leiden

Standard clustering treats spots as iid points in expression space — but adjacent spots are spatially correlated. A spatial-aware clustering uses the tissue layout as an additional signal:

  • BANKSY — augments each spot’s expression with its neighbors’ average expression before clustering
  • STAGATE — graph attention auto-encoder on the spatial graph; learns smoother spatial domains
  • SpaGCN — graph convolutional network combining expression + histology image
  • GraphST — contrastive self-supervised graph learning

These typically yield smoother, more biologically interpretable spatial domains than standard Seurat clustering. Worth using for any “what are the regions?” question.

Part 6 — Practical pitfalls

Six things that bite

  1. A spot is not a cell. Any “marker gene” plot you draw is a mixture readout. For cell-type questions, deconvolve.
  2. Edge effects. The outermost spots only partially cover tissue and have lower UMI counts. Most pipelines treat them like the rest. Either filter (SpatialFeaturePlot(... pt.size.factor = 1.0, alpha = c(0.0, 1))) or annotate them.
  3. Cross-section integration. Two sections from the same tissue still need integration — chip-to-chip variation is real. Same Harmony / SCT-anchor methods as scRNA-seq.
  4. Reference mismatch in deconvolution. A reference that’s missing your tissue’s main cell type will distribute that cell’s transcripts across the cell types it does have. Always use a same-tissue reference.
  5. Over-interpreting the histology image. The H&E underneath is a real image but is registered, not a ground truth — slight misalignment between spots and image is expected.
  6. Visium HD data volume. A single Visium HD section is ~10 GB; loading naively into Seurat will OOM. Use the bin-aggregated outputs (8 µm, 16 µm) unless you really need 2 µm.

Recap & what’s next

Reading spatial outputs — what to look for

  • SpatialFeaturePlot: color on the H&E image should trace anatomy — Hpca in hippocampus, Plp1 in white matter; a uniform smear signals ambient RNA or failed normalization
  • SpatialDimPlot: clusters that form contiguous anatomical regions are real; clusters that scatter randomly across the tissue are probably technical artifacts
  • Moran’s I top genes: expect distinct patches or stripes matching known structures; a gene with high variance but low Moran’s I is spotty, not spatial
  • Integration UMAP (slice coloring): spots from both sections should interleave after integration — remaining separation by slice means the technical batch was not corrected

What to remember from Lecture 16

  • Spatial transcriptomics measures gene expression while keeping the position — answers “where” questions scRNA-seq throws away
  • Visium is the workhorse (whole-tx, low resolution, easy); Xenium / MERFISH / CosMx trade coverage for resolution
  • Visium spots are mixtures (1–10 cells) — clusters recover tissue regions, deconvolution recovers cell-type fractions
  • SCTransform is the standard normalization; Moran’s I finds spatially variable genes
  • Spatial-aware clustering (BANKSY, STAGATE) gives cleaner regions than vanilla SNN+Leiden
  • Always plot QC metrics on the tissue — spatial QC is itself a sanity check

Coming up next

Further reading