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.
Check out the installation guide to set up TERRA and PyTorch for your hardware.
Learn by following an end-to-end example application of TERRA.
Understand the concepts, the inference pipeline, and the pretrained models.
Detailed descriptions of TERRA’s public functions and classes.
Follow the latest changes and version history.
Learn how to contribute to the TERRA project.
If you find TERRA useful for your research, please consider citing the manuscript (see the User Guide).