Native, Memory-Bounded Conversion of Mass Spectrometry Imaging Data into the SpatialData Ecosystem
Theodoros Visvikis, Wouter-Michiel Vierdag, Luca Marconato, Angeliki Birmpili, Ron M.A. Heeren, Eva CuypersAbstract
Mass spectrometry imaging (MSI) is now a routine modality for spatial molecular profiling and is increasingly combined with histology, multiplexed imaging, and spatial transcriptomics to build richer descriptions of tissue than any single technique can provide. The conceptual case for this multimodal paradigm was settled a decade ago, but the data infrastructure needed to operationalize it at scale has not kept up. Vendor binaries and the imzML exchange format keep MSI outside the OME-NGFF, Zarr, and SpatialData stacks on which the rest of spatial omics has converged, leaving each new experiment to rebuild ad hoc converters from scratch. Here, we present Thyra, an open-source Python library that converts raw vendor and imzML MSI data directly into the SpatialData format. A two-pass streaming sparse matrix engine writes the spectral matrix straight into the output Zarr store, keeping peak memory bounded near 200 MB regardless of data set size and supporting 100+ GB acquisitions. On a representative mouse brain MALDI data set, this yields three- to 4-fold storage reductions and an order-of-magnitude improvement in m/z range query latency, the bottleneck for ion image generation. Once converted, MSI data are directly composable with the scverse analysis ecosystem; we quantify this with an scverse readiness benchmark in which spatial autocorrelation, pixel clustering, and neighborhood enrichment, all standard operations in spatial transcriptomics, run as a one-liner on the converted object. A brief exploratory analysis of a skin biopsy from a psoriasis patient illustrates the analytical surface that the unified container exposes.