Spatial transcriptomics foundation model giving gene-, cell- and neighborhood-scale embeddings zero-shot, plus in-silico gene knockout in tissue.
No providers recorded yet. Browse all providers
Imaging-based spatial transcriptomics now profiles millions of cells in situ, but the analysis stack has stayed bespoke: each study builds its own clustering, integration, and niche-annotation pipeline, and the resulting representations rarely transfer to the next dataset. Existing spatial models mostly emit a single aggregated vector per cell or per spot, enough to delineate domains but stripped of the gene-level detail needed to ask what would happen if a gene were switched off.
TERRA is a self-supervised foundation model for spatial transcriptomics developed by the Lotfollahi lab at the Wellcome Sanger Institute with collaborators at the University of Cambridge, Helmholtz Munich, and the Technical University of Munich. From one pretrained backbone it produces embeddings at three scales — individual gene tokens, whole cells, and the multicellular neighborhoods cells sit in — and supports spatial in-silico perturbation, all applied zero-shot to tissues the model has never seen.
Its closest relatives in the catalog are Nicheformer, scGPT-spatial, and CellPLM, each of which learns spatially aware cell representations. TERRA differs in keeping per-gene tokens all the way through the encoder rather than pooling them away, which is what makes both gene-resolved programs and gene knockouts expressible in the same model.
TERRA pairs a Graph Transformer backbone with a Joint-Embedding Predictive Architecture (JEPA) objective. For each index cell, a k-nearest-neighbor graph on 2D centroids selects up to 10 spatial neighbors; neighbors are ranked by distance and genes by log-normalized expression, producing 256 index-cell tokens plus 2,560 neighborhood tokens. Every token carries a gene symbol from a 23,407-gene vocabulary, an expression-value token, a within-cell rank, and a cell-rank segment index, embedded at width 384. During pretraining a fraction of non-zero gene tokens per cell is masked; a context encoder and predictor are trained with an L1 loss to match a target encoder that sees the full sequence and is updated as an exponential moving average of the context encoder. Both released checkpoints use the paper's GT Small configuration — a 12-layer, width-384 encoder with six heads and a 12-layer, width-192 predictor, roughly 30M parameters.
Pretraining used HST-Corpus-112M: 112,578,039 single-cell-resolved profiles from 636 tissue sections across five imaging assays (Xenium, MERFISH, CosMx, STARmap, ISS CARTANA), spanning 20 human tissues, healthy and developmental tissue, and 26 disease conditions; two thirds of the cells were generated in-house. On four zero-shot niche-identification benchmarks spanning held-out samples, donors, datasets, and assays, TERRA achieved the highest NMI on every dataset against CellPLM, Nicheformer, scGPT-spatial, and Novae. Low-rank adaptation extends the model to sequencing-based 10x Visium data, where each spot covers multiple cells.
The paper works through three scales. In a newly generated Xenium atlas of the developing human pancreas — a tissue held out from TERRA-96M — cell embeddings resolved an islet-associated capillary state proposed as a precursor of mature islet microvasculature. In treatment-naive kidney sections, in-silico knockout of the immune-checkpoint targets CTLA4 and PDCD1 predicted a gene program of checkpoint-blockade-associated nephrotoxicity that was recovered in tissue from treated patients and in circulating immune cells. At neighborhood scale, clustering 1,522,556 macrophages across nine adult organs grouped niches into recurrent archetypes, six of them cross-organ, including a tumor-boundary archetype associated with poor prognosis in kidney cancer.
TERRA reframes spatial transcriptomics analysis as inference from a single reusable backbone rather than a per-dataset pipeline, and it is predictive as well as descriptive: the perturbation interface offers a computational analogue to a spatial CRISPR screen in a setting where perturbation data barely exist. The code ships as the terra-st PyPI package under a BSD 3-Clause license and requires an NVIDIA GPU, while the pretrained weights on Hugging Face carry a CC-BY-NC 4.0 license that excludes commercial use. Pretraining data is documented per source dataset rather than redistributed as one corpus, so reproducing HST-Corpus-112M requires reassembly. The work is a preprint and has not yet been peer reviewed.
Much of this page is generated or calculated automatically. Flag anything that looks off and we will re-run it.