bio.rodeo
ModelsOrganizationsProvidersLeaderboardAboutSign in
bio.rodeo

The authoritative source for evaluating biological foundation models. No hype, just honest analysis.

Categories
  • DNA & Gene
  • RNA
  • Protein
  • Small molecule
  • Single-cell
  • Spatial omics
  • Pathology
  • Imaging
  • Metabolomics
  • Biosignals
  • Language model
bio.rodeoModelsOrganizationsProvidersLeaderboardAboutFAQSubmit a modelTermsPrivacyContact
© 2026 Pulsatance. All rights reserved. ~
Built by Pulsatance
models / spatial-omics / spatialformer
Spatial omicsSingle-cell
University of CopenhagenThe University of Hong KongTechnical University of DenmarkReleased January 2025

SpatialFormer

Spatial transcriptomics foundation model learning subcellular transcript positions and cell-niche context from 17 million Xenium single cells.

The short version

  • —Embeds a cell from where its transcripts sit inside it, not just how many there are
  • —One pretrained encoder serves batch correction, cell typing, and co-localization
  • —Trained on cell pairs, so niche context is learned rather than bolted on afterwards
  • —Surfaces gene pairs driving immune cell-cell communication in pulmonary fibrosis
  • —Pairs a convolutional subcellular encoder with a transformer over gene tokens
68Openness

Where to run it

No providers recorded yet. Browse all providers

Imaging-based spatial transcriptomics platforms such as 10x Xenium do not report a cell as a vector of gene counts. They report individual transcript molecules, each with coordinates, which are then assigned to segmented cells. Almost every analysis pipeline immediately throws that coordinate information away by summing transcripts into a count matrix, at which point the data is treated like dissociated single-cell RNA-seq with an (x, y) label attached. Two distinct signals are lost: where a transcript sits inside its own cell, and what the cell's immediate neighbours look like.

SpatialFormer, from University of Copenhagen with collaborators at the University of Hong Kong and the Technical University of Denmark, is built to keep both. It is a hybrid architecture: convolutional layers encode the subcellular spatial distribution of each gene's transcripts, while a transformer operates over gene tokens to model the cell as a whole and its niche. Pretraining is done pairwise — the model sees two cells at a time and learns to relate them — across 700 million cell pairs drawn from 17 million spatially resolved single cells on 71 Xenium slides.

Compared with existing single-cell foundation models such as scGPT and Geneformer, which take expression vectors as input, and with spatially aware models such as Nicheformer, SpatialFormer's distinguishing input is subcellular geometry. That choice reflects what imaging-based platforms actually measure, and it means the representation carries information a count matrix cannot express.

#Key Features

  • Subcellular transcript geometry as input: Each gene's molecules are encoded by their spatial arrangement within the cell, capturing localization patterns that summing to a count discards.
  • Pairwise pretraining: The multi-task objective operates on positive and negative cell pairs, so niche relationships are learned during pretraining rather than modeled downstream.
  • Multi-scale representation: One forward pass yields both cell-level embeddings, from a CLS token or the mean over gene tokens, and gene-level representations usable for interaction analysis.
  • Perturbation analysis for interaction discovery: In-silico perturbation of the pretrained model nominates gene pairs mediating cell-cell communication, applied by the authors to pulmonary fibrosis and to breast cancer.
  • Single-cell or paired inference: The same checkpoint accepts either an individual cell or a cell pair, so it serves both representation extraction and interaction scoring.

#Technical Details

The pretraining corpus spans 71 Xenium slides across 13 tissue types, totalling roughly 4.5 billion transcripts, over a vocabulary of 6,036 genes. The architecture combines convolutional encoding of subcellular distributions, a GraphSAGE graph neural network, and a transformer encoder accelerated with FlashAttention 2. Fine-tuning is supported through LoRA adapters, which keeps adaptation cheap relative to full-model updates. The published evaluation covers single-cell batch correction across slides, cell-type annotation, and co-localization detection; perturbation analysis identified gene pairs essential to immune cell-cell communication in pulmonary fibrosis, epithelial-myoepithelial co-localization, and tumour transition signals in breast cancer. Code is MIT-licensed and installable from PyPI as spatialformer, with checkpoints distributed through Zenodo and Figshare and tutorial notebooks provided in Colab.

#Applications

The model suits groups running Xenium or comparable imaging-based panels who need to integrate multiple slides, transfer cell-type labels without hand-annotating each section, or ask which ligand-receptor-like gene pairs mediate contact between specific cell types in a tissue. Because embeddings are extracted from a frozen checkpoint, it fits into standard single-cell workflows as a representation step ahead of clustering, annotation, or differential analysis, with LoRA fine-tuning available where a task needs adaptation.

#Impact

Published in Nature Computational Science, SpatialFormer stakes out subcellular molecular geometry as a pretraining signal that spatial omics models had largely left unused. Its main scope limit is the platform it was trained on: a 6,036-gene vocabulary derived from targeted Xenium panels does not cover the transcriptome, so applying it to sequencing-based spatial assays or to panels with different gene sets requires care. The released package, pretrained weights, and tutorial notebooks lower the barrier to reusing the representation, though the practical value of subcellular geometry depends on segmentation quality, which remains the weakest link in imaging-based spatial transcriptomics.

At a glance

Released
January 2025
Category
Spatial omics
Organizations
University of Copenhagen / The University of Hong Kong / Technical University of Denmark

Links

GitHub RepositoryResearch PaperGoogle ColabDatasetLink

Tags

batch_correctioncell_type_annotationcnnfoundation_modelrepresentation_learningself_supervisedspatial_transcriptomicstransformer

Something wrong?

Much of this page is generated or calculated automatically. Flag anything that looks off and we will re-run it.