TERRA

TERRA#

TERRA (Tissue Environment Relational Representation Architecture) is a self-supervised foundation model for spatial transcriptomics, developed by the Lotfollahi Lab. It serializes each cell together with its spatial neighbors into a sequence of gene tokens, then trains with a joint-embedding predictive (JEPA) objective: some tokens are masked, and the model predicts their representations in latent space — rather than reconstructing raw expression — to infer the molecular and spatial context of the neighboring cells. This yields embeddings at three scales — genes, cells, and neighborhoods — that transfer zero-shot to downstream tasks such as niche identification, batch-integrated atlasing, spatial gene-pair scoring, and in-silico perturbation.

Installation

Check out the installation guide to set up TERRA and PyTorch for your hardware.

Installation
Tutorials

Learn by following an end-to-end example application of TERRA.

Tutorials
User Guide

Understand the concepts, the inference pipeline, and the pretrained models.

User Guide
API

Detailed descriptions of TERRA’s public functions and classes.

API
Changelog

Follow the latest changes and version history.

Changelog
Contributing Guide

Learn how to contribute to the TERRA project.

Contributing Guide

If you find TERRA useful for your research, please consider citing the manuscript (see the User Guide).