SpaIM: single-cell spatial transcriptomics imputation via style transfer

Bo Li, Ziyang Tang, Aishwarya Budhkar, Xiang Liu, Tao Zhang, Baijian Yang, Jing Su, Qianqian Song

Abstract

Spatial transcriptomics (ST) technologies have transformed our understanding of cellular organization but are limited by sparse signals and restricted gene coverage. To address these challenges, we introduce SpaIM, a style transfer learning model that leverages single-cell RNA sequencing (scRNA-seq) data to predict unmeasured gene expressions in ST profiles. By disentangling shared content and modality-specific styles, SpaIM effectively integrates scRNA-seq's rich gene expression with the spatial context of ST. Evaluated across 53 datasets spanning sequencing- and imaging-based spatial technologies in various tissue types, SpaIM consistently outperforms 12 state-of-the-art methods in improving gene coverage and expression accuracy. Furthermore, SpaIM enhances downstream analyses, including ligand-receptor interaction inference, spatial domain characterization, and differential gene expression analysis. Released as open-source software, SpaIM expands accessibility and utility in ST research. Overall, SpaIM represents a robust and generalizable framework for enriching ST data with single-cell information, enabling deeper insights into tissue architecture and cellular function.

Introduction

Spatial transcriptomics (ST) allows researchers to map gene expression within the physical context of tissue slices. However, current technologies face a significant trade-off: sequencing-based methods (e.g., 10x Genomics Visium) capture the whole transcriptome but suffer from sparsity and lower resolution, while imaging-based methods (e.g., NanoString CosMx) offer single-cell resolution but are limited to a few hundred pre-selected genes.

In contrast, single-cell RNA sequencing (scRNA-seq) provides comprehensive gene coverage but loses all spatial context during tissue dissociation. The challenge lies in merging these modalities to impute missing spatial information while overcoming the "modality gap"—the technical noise and systematic differences inherent to different measurement platforms.

Methodology

SpaIM (Spatial transcriptomics IMputation) addresses this gap by adopting a style transfer approach, a concept borrowed from computer vision. In this framework, biological gene expression is treated as "content," while the technical signatures of specific ST platforms are treated as "styles."

The SpaIM architecture disentangles biological content from platform-specific style using a joint loss function.

Key Components:

  • Recursive Style Transfer (ReST) Layers: These layers employ a multi-layer recursive approach to extract and fuse features, enabling the model to capture complex, non-linear biological relationships more effectively than standard linear networks.
  • ST Autoencoder: This component utilizes scRNA-seq as a reference to learn how to separate shared biological content from ST-specific technical styles.
  • ST Generator: Once the style is learned, the generator takes rich gene content from scRNA-seq and projects it into the spatial map, predicting unmeasured gene expressions.
  • Joint Loss Function: The model is optimized using a combination of content loss, style loss (via Gram matrices), and reconstruction loss to ensure biological accuracy and spatial consistency.

Experimental Setup

The model was benchmarked against 12 state-of-the-art methods (including Tangram, gimVI, and stDiff) using 53 diverse datasets. These covered various tissues (breast, lung, brain, kidney) and species (human, mouse, zebrafish) across multiple platforms:

  • 21 Visium datasets (sequencing-based).
  • 28 other sequencing-based datasets (Slide-seq, Seq-scope, HDST).
  • 25 imaging-based datasets (CosMx, MERSCOPE, seqFISH+, STARmap).

Results and Discussion

SpaIM consistently achieved superior accuracy across almost all 53 datasets, measured by Pearson Correlation (PCC) and Structural Similarity (SSIM). In breast cancer trials, it reached a PCC of 0.70, significantly outperforming Tangram (0.62).

SpaIM accurately recovers spatial gene expression patterns (ERBB2, KRT8, etc.) and enhances spatial domain detection compared to raw data.

Key Insights:

  • Effective Disentanglement: By explicitly modeling technical differences as "style," SpaIM filters out platform-specific noise to focus on underlying biology.
  • Enhanced Downstream Analysis: SpaIM improves the utility of ST data. For instance, in breast cancer data, it identified 33 strongly associated ligand-receptor pairs, compared to only 11 found in raw data.
  • Spatial Domain Detection: In lung cancer data, SpaIM achieved an Adjusted Rand Index (ARI) of 0.50 for identifying cell-type regions, nearly matching the ground truth (0.56) and doubling the performance of competitors like gimVI (0.25).
  • Recovering Unmeasured Genes: In imaging datasets, SpaIM successfully recovered the spatial patterns of critical tumor-related genes (e.g., MYCN) that were not included in the original hardware's probe set.

Conclusion

SpaIM represents a robust and generalizable framework for enriching ST data. While currently based on Multi-Layer Perceptron (MLP) layers, future iterations may incorporate advanced architectures like Graph Transformers or the Mamba framework to further enhance performance. By treating technical artifacts as styles to be transferred, SpaIM provides a powerful tool for deeper insights into tissue architecture and cellular function.

Summary updated

BibTeX
@inproceedings{li2025spaim,
  author = {Bo Li and Ziyang Tang and Aishwarya Budhkar and Xiang Liu and Tao Zhang and Baijian Yang and Jing Su and Qianqian Song},
  title = {{SpaIM: single-cell spatial transcriptomics imputation via style transfer}},
  booktitle = {Nature Communications},
  year = {2025},
  doi = {10.1038/s41467-025-63185-9},
}
Figure