SpatialData: an open and universal data framework for spatial omics

Luca Marconato, Giovanni Palla, Kevin A. Yamauchi, Isaac Virshup, Elyas Heidari, Tim Treis, Wouter-Michiel Vierdag, Marcella Toth, Sonja Stockhaus, Rahul B. Shrestha, Benjamin Rombaut, Lotte Pollaris, Laurens Lehner, Harald Vöhringer, Ilia Kats, Yvan Saeys, Sinem K. Saka, Wolfgang Huber, Moritz Gerstung, Josh Moore, Fabian J. Theis, Oliver StegleNature Methods 2024

Abstract

Spatially resolved omics technologies are transforming our understanding of biological tissues. However, the handling of uni- and multimodal spatial omics datasets remains a challenge owing to large data volumes, heterogeneity of data types and the lack of flexible, spatially aware data structures. Here we introduce SpatialData, a framework that establishes a unified and extensible multiplatform file-format, lazy representation of larger-than-memory data, transformations and alignment to common coordinate systems. SpatialData facilitates spatial annotations and cross-modal aggregation and analysis, the utility of which is illustrated in the context of multiple vignettes, including integrative analysis on a multimodal Xenium and Visium breast cancer study.

Introduction

The field of spatial omics is currently experiencing a rapid expansion, often referred to as a "Wild West" phase. Technologies such as 10x Visium, Xenium, and MERFISH generate vast, heterogeneous datasets comprising gigabyte-scale histology images, millions of individual molecular coordinates, and complex segmentation masks. The primary bottleneck in the field is not just the sheer volume of data, but the lack of a standardized infrastructure. Different modalities frequently utilize proprietary formats and disparate coordinate systems, making integration—such as querying RNA transcripts within specific tissue regions identified via H&E staining—computationally expensive and reliant on ad-hoc "glue code."

SpatialData addresses these challenges by providing an open-source, universal framework designed to unify the fragmented spatial omics landscape. It offers a standardized file format and a Python library that enables researchers to align, query, and analyze massive, multi-modal datasets without the need to load them entirely into memory.

The SpatialData Framework

Comprehensive overview of the SpatialData framework, illustrating the storage format (a), library capabilities (b), data readers (c), interactive tools (d), deep learning interfaces (e), and ecosystem integration (f).

Core Primitives and Storage

The framework organizes all spatial information into five fundamental primitives:

  • Images: Raster data representing histology or fluorescence.
  • Labels: Segmentation masks for cells or organelles.
  • Points: Individual molecular coordinates (e.g., transcripts).
  • Shapes: Polygons or circles defining regions of interest (ROIs).
  • Tables: Gene expression counts and associated metadata.

To handle large-scale data, SpatialData leverages the Zarr file format and OME-NGFF specifications. This architecture supports "lazy loading," allowing the software to read only the specific data chunks required for a given calculation. This capability is essential for analyzing datasets that exceed a workstation's RAM capacity.

Coordinate Transformations and Spatial Queries

A defining feature of SpatialData is its robust handling of coordinate systems. The library allows researchers to define and chain transformations—such as translation, scaling, and rotation—to align multiple data layers into a Common Coordinate System (CCS). Crucially, these transformations are applied lazily, preserving the integrity of the raw data while enabling real-time spatial alignment.

The SpatialData library enables alignment of heterogeneous datasets through coordinate transformations and facilitates spatial queries and observation aggregation.

This spatially aware infrastructure simplifies cross-modal aggregation. For instance, a "Shape" defined in a Visium experiment can be used to "crop" or aggregate "Points" from a Xenium run, facilitating modality-agnostic analysis.

Applications and Benchmarking

The authors demonstrated the framework's utility through several high-impact use cases:

  • Multimodal Breast Cancer Integration: By aligning H&E images, 10x Visium, and Xenium data from consecutive tissue sections, the team identified consistent spatial domains across technologies.
  • Large-Scale Prostate Cancer Mapping: 15 Visium fields-of-view were integrated into a single global coordinate system, demonstrating the framework's scalability.
  • Community Resources: To lower the barrier to entry, the authors provided over 40 pre-formatted SpatialData objects from eight different technologies, including CosMx and CyCIF.

Key Results and Insights

  • High Concordance: Analysis of Xenium replicates showed a median Pearson’s $R$ of 0.88 in cell-type abundance estimates, validating the framework's reliability.
  • Cross-Platform Validation: Aggregating Xenium transcripts into Visium-sized regions revealed a strong correlation ($R = 0.62$) in gene expression quantification between the two platforms.
  • Interactive and AI-Ready: Integration with the napari viewer allows for manual ROI annotation that is immediately available for quantitative analysis. Furthermore, a built-in PyTorch Dataset class enables direct training of deep learning models, such as DenseNet, for cell-type prediction.

Limitations and Future Directions

While SpatialData represents a significant advancement, several areas for development remain. Current work focuses on enhancing interoperability with the R/Bioconductor ecosystem and expanding support for volumetric (3D) and time-series (5D) data. Additionally, future updates aim to incorporate multiscale polygonal meshes for complex tissue architectures and improve cloud-based data access to accommodate the next generation of massive spatial datasets.

Summary updated

BibTeX
@inproceedings{marconato2024spatialdata,
  author = {Luca Marconato and Giovanni Palla and Kevin A. Yamauchi and Isaac Virshup and Elyas Heidari and Tim Treis and Wouter-Michiel Vierdag and Marcella Toth and Sonja Stockhaus and Rahul B. Shrestha and Benjamin Rombaut and Lotte Pollaris and Laurens Lehner and Harald Vöhringer and Ilia Kats and Yvan Saeys and Sinem K. Saka and Wolfgang Huber and Moritz Gerstung and Josh Moore and Fabian J. Theis and Oliver Stegle},
  title = {{SpatialData: an open and universal data framework for spatial omics}},
  booktitle = {Nature Methods},
  year = {2024},
  doi = {10.1038/s41592-024-02212-x},
}
Figure