saffron-benchmark / README.md
dhanavhanda's picture
Upload folder using huggingface_hub
0d7d35f verified
|
Raw History Blame Contribute Delete
4 kB
metadata
license: other
license_name: original-dataset-licenses
license_link: https://doi.org/10.64898/2026.08.01.742217
pretty_name: SAFFRON benchmark
tags:
  - spatial-transcriptomics
  - foundation-models
  - benchmark
  - biology
size_categories:
  - 100K<n<1M

SAFFRON benchmark

The benchmark tasks from SAFFRON (paper, code): 8 spatial transcriptomics datasets with known, quantifiable spatial variation τ, for evaluating whether the embeddings of a spatial (or single-cell) foundation model capture spatial variation at different scales.

  • Global tasks (Fig. 2a): 1-D spatial gradients of gene expression (global/).
  • Local tasks (Fig. 4a): microenvironments around amyloid-β plaques in Alzheimer's disease brains (local/).

These are processed subsets of public datasets. If you use them, please also cite the original data publications, listed in the paper.

Each file also contains the paper's two non-foundation-model baselines, PCA and an SAE on gene expression directly, so a new model can be compared against them with the same metric.

Tasks

File Tissue Technology τ
global/colorectal.h5ad Human colorectal tumor 10x Visium 1-D tumor-stroma axis
global/kidney.h5ad Mouse kidney 10x Visium HD (16 µm) 1-D radial axis
global/cortex_v1.h5ad Human cerebral cortex (V1) MERFISH 1-D cortical depth axis
global/cortex_v2.h5ad Human cerebral cortex (V2) MERFISH 1-D cortical depth axis
global/gi_ileum.h5ad Mouse ileum (one section) MERFISH 1-D crypt-villus axis (mucosa only)
global/colon.h5ad Human colon (non-diseased) 10x Xenium 1-D crypt-surface axis
local/starmap_ad.h5ad Mouse brain, Alzheimer's model STARmap PLUS DAM score, microglial density, distance to plaque
local/merfish_ad.h5ad Mouse brain, Alzheimer's model MERFISH DAM score, microglial density, distance to plaque

File contents

Field Content
X gene expression (raw counts where the source provides them)
obsm["spatial"] cell / spot coordinates
obsm["X_pca"] PCA baseline (50 components), exactly as in the paper
obsm["gene_sae_features"] baseline: SAE on gene expression directly (Matryoshka BatchTopK SAE), exactly as in the paper
obs["domain"], obs["tau"] global tasks: spatial domain and 1-D spatial axis (NaN = not scored)
obs["tau_dam_score"], obs["tau_micro_density"], obs["tau_distance_to_plaque"] local tasks: the three plaque-associated metrics
obs["eval_dam"], obs["eval_density"], obs["eval_distance"] local tasks: cells scored for each metric
obs["sample"], obs["distance_unit"] local tasks: units over which per-unit scores are reported

Usage

benchmark.score computes the paper's metric: the maximum |Spearman ρ| between any feature and τ (per spatial domain for the global tasks, as in Fig. 2a; per sample for the local tasks, as in Fig. 4a).

from saffron import SAFFRON, benchmark

adata = benchmark.load("colorectal")                    # downloads global/colorectal.h5ad
Z = my_model.embed(adata)                               # (cells x D) embeddings of your model
H = SAFFRON().fit(Z).sae_result_.Z                      # SAFFRON SAE features, as in the paper
benchmark.score(adata, H)                               # global: one number; local: per-sample |rho| per metric
benchmark.score(adata, adata.obsm["X_pca"])             # PCA baseline
benchmark.score(adata, adata.obsm["gene_sae_features"]) # baseline: SAE on gene expression directly

Citation

Handa D, Martin-Linares C, Stein-O'Brien G, Ling J, Chitra U. Evaluating the ability of spatial transcriptomics foundation models to learn multi-scale spatial variation. bioRxiv (2026). https://doi.org/10.64898/2026.08.01.742217