[Paper Review] Single Cells Are Spatial Tokens: Transformers for Spatial Transcriptomic Data Imputation
SpaFormer treats single cells as spatial tokens and uses transformer encoders to impute missing gene expression in spatial transcriptomics, leveraging various spatial positional encodings.
Spatially resolved transcriptomics brings exciting breakthroughs to single-cell analysis by providing physical locations along with gene expression. However, as a cost of the extremely high spatial resolution, the cellular level spatial transcriptomic data suffer significantly from missing values. While a standard solution is to perform imputation on the missing values, most existing methods either overlook spatial information or only incorporate localized spatial context without the ability to capture long-range spatial information. Using multi-head self-attention mechanisms and positional encoding, transformer models can readily grasp the relationship between tokens and encode location information. In this paper, by treating single cells as spatial tokens, we study how to leverage transformers to facilitate spatial tanscriptomics imputation. In particular, investigate the following two key questions: (1) $ extit{how to encode spatial information of cells in transformers}$, and (2) $ extit{ how to train a transformer for transcriptomic imputation}$. By answering these two questions, we present a transformer-based imputation framework, SpaFormer, for cellular-level spatial transcriptomic data. Extensive experiments demonstrate that SpaFormer outperforms existing state-of-the-art imputation algorithms on three large-scale datasets while maintaining superior computational efficiency.
Motivation & Objective
- Motivation to improve imputation for high-resolution spatial transcriptomics where missing values are common due to low capture efficiency.
- Investigate how to encode spatial information of cells in transformers for effective imputation.
- Develop a transformer-based autoencoder framework that can utilize intercellular context for accurate imputation.
- Propose a bi-level masking strategy to tailor masked autoencoding to spatial transcriptomics.
- Compare and identify best practices for spatial positional encodings in this setting.
Proposed method
- Treat cells as tokens and apply a transformer encoder to learn latent representations from partially observed X and spatial coordinates C.
- Explore four families of spatial positional encodings: patch-based, coordinate-based, graph-based, and model-based (SignNet and Cond PE) to capture spatial relationships.
- Generalize autoencoder-based imputation models (vanilla, ZINB, VAE) within SpaFormer, using transformer encoders and various decoders.
- Introduce bi-level masking for masked autoencoders to selectively mask tokens and features, facilitating reconstruction from context.
- Leverage efficient Transformer variant (Performer) for linear-time attention with thousands of cell tokens per FOV.
Experimental results
Research questions
- RQ1How can spatial information of cells be encoded effectively in transformers for spatial transcriptomic imputation?
- RQ2How to train a transformer-based model to perform transcriptomic imputation in the presence of missing values?
- RQ3What are the best choices of spatial positional encodings for cellular-level spatial transcriptomics, and how do they compare?
- RQ4Can a generalized autoencoder framework (including VAE and ZINB variants) be effectively implemented within SpaFormer for imputation?
- RQ5Does a bi-level masking strategy improve imputation performance in spatial transcriptomics?
Key findings
- SpaFormer achieving outstanding imputation performance on three large-scale cellular-level spatial transcriptomic datasets (exact numbers not provided).
- Demonstrates the effectiveness of treating cells as tokens and using transformer encoders to model long-range intercellular relationships.
- Shows that multiple spatial positional encoding strategies can be incorporated, including patch-based, coordinate-based, graph-based, and model-based encodings, with trade-offs in properties like translation invariance and distance awareness.
- Generalizes autoencoder-based imputation models (vanilla, ZINB-based, and VAEs) within a unified SpaFormer framework.
- Introduces a bi-level masking strategy to better suit spatial transcriptomics imputation tasks by masking tokens and features selectively.
- Utilizes the Performer variant to achieve linear-time attention, enabling scalable processing of thousands of cells per field-of-view.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.