Screenshot 2026-10-24 at 14.31.18.png

Spatial transcriptomics of a colorectal cancer section. H&E of the whole section (left) and the capture area of a Visium HD assay (right), where each 8 µm bin is colored by its cluster, a group of bins with similar gene expression. Data: 10x Genomics, Visium HD Human Colorectal Cancer (FFPE), CC BY 4.0; adapted.

In 2.10, we saw that an H&E slide shows where tumor cells, immune cells, and vessels are located. Sequencing technologies, in turn, measure the activity of every gene, but only after the tissue has been dissociated, so the positions are lost. Spatial transcriptomics keeps both: it measures RNA and records where in the section each measurement came from, adding gene expression as a layer of information on top of the tissue architecture. Spatial omics extends the idea to proteins and other molecules.

The resulting data is a table of molecule counts, a list of coordinates, usually a tissue image, and cell outlines computed from it, all linked together. This page explains how such data are acquired, what limits their resolution and sensitivity, and what that means for modeling and processing them. Much of 2.8 to 2.10 holds here: diffraction limits how close two RNA molecules can be and still be told apart.

Why does location matter?

Every cell carries the same genome but uses only part of it. A gene in use is transcribed into messenger RNA (mRNA), which is then translated into protein. Counting the mRNA copies of each gene, the cell's transcripts, therefore, shows which genes the cell is using and how strongly. RNA is not protein: transcripts are degraded and translated at different rates, and a protein can outlast its RNA. Still, the expression of a few thousand genes defines a cell's type and functional state far more finely than its shape does.

What do bulk and single-cell sequencing measure?

Bulk RNA sequencing extracts the RNA from a piece of tissue and reads it on a sequencer. It returns one number per gene: an average over millions of cells, much like the mean color of a whole slide. Single-cell RNA sequencing (scRNA-seq) first dissociates the tissue into a suspension of cells and tags each cell's RNA separately, so expression is measured cell by cell. It reveals which cell types and states are present, but dissociation discards where each cell was.

Spatial position matters because cells interact with their neighbors. An immune cell inside a tumor and the same cell type in the surrounding stroma can be in different states. A gene active only at the invasive front is diluted in bulk data and unlocated in single-cell data. Spatial data let us ask where a cell type sits, which genes change across a boundary, and which populations tend to occur together.

Screenshot 2026-10-24 at 14.55.23.png

Three ways to measure gene expression in tissue. Bulk RNA-seq averages over all cells; single-cell RNA-seq separates them but loses their positions; spatial transcriptomics keeps the link between expression and location. Cell types illustrative. H&E: 10x Genomics, Visium HD Human Colorectal Cancer (FFPE), CC BY 4.0; adapted.

What does a spatial measurement contain?

Despite the technology used, the core outputs of spatial omics assays are a table of counts and a table of positions. With $G$ genes measured at $N$ locations:

$$ X \in \mathbb{N}_0^{N \times G}, \qquad S \in \mathbb{R}^{N \times 2} \qquad (2.11.1) $$

Entry $X_{ig}$ is a count: the number of RNA molecules of gene $g$ detected at location $i$. If 12 copies of the mRNA of EPCAM gene, a marker of epithelial cells, are detected at location $i$, then $X_{i,\text{EPCAM}} = 12$. Counts are whole numbers because each detected molecule is counted once. In sequencing-based methods, a short random tag attached to every molecule before it is copied, the unique molecular identifier (UMI), ensures that a molecule copied many times is still counted once. In imaging-based methods, each fluorescent spot is one molecule.

Row $i$ of $X$ is the expression profile of location $i$: its counts for all $G$ genes. Column $g$ shows how one gene is distributed across the tissue. Figure 2.11.3 shows a small corner of such a matrix. Location 1 looks epithelial (EPCAM), location 2 contains immune cells (PTPRC), and location 3 is stromal (COL1A1, collagen). ACTB, a gene used by almost every cell, is present everywhere.

Screenshot 2026-10-24 at 15.35.15.png

The two tables of a spatial dataset. The count matrix $X$ has one row per location and one column per gene; the position matrix $S$ has one row per location, in the same order, giving its coordinates in the section.

The second matrix, $S$, holds the positions. Row $i$, $\mathbf{s}_i = (x_i, y_i)$, gives where location $i$ lies in the section, ideally in micrometers rather than pixels, so that distances mean the same thing in every dataset. The two matrices are linked only by the order of their rows: row $i$ of $X$ and row $i$ of $S$ describe the same location.

Real datasets are far larger than the corner shown. $G$ runs from a few hundred genes, in methods that target a chosen panel, to the whole transcriptome: the roughly 20,000 protein-coding genes of the human genome. $N$ runs from a few thousand spots to millions of bins or cells. Most entries are zero, because a location expresses only some of the genes, and of those only a fraction of the molecules are detected, therefore, resulting in a sparse matrix. It is stored by listing only its nonzero entries, which is why a matrix with a million rows and 18,000 columns still fits in memory.