scGraphformer: unveiling cellular heterogeneity and interactions in scRNA-seq data using a scalable graph transformer network

Xingyu Fan, Jiacheng Liu, Yaodong Yang, Chunbin Gu, Yuqiang Han, Bian Wu, Yirong Jiang, Guangyong Chen, Pheng‐Ann HengCommunications 2024

Abstract

The precise classification of cell types from single-cell RNA sequencing (scRNA-seq) data is pivotal for dissecting cellular heterogeneity in biological research. Traditional graph neural network (GNN) models are constrained by reliance on predefined graphs, limiting the exploration of complex cell-to-cell relationships. We introduce scGraphformer, a transformer-based GNN that transcends these limitations by learning an all-encompassing cell-cell relational network directly from scRNA-seq data. Through an iterative refinement process, scGraphformer constructs a dense graph structure that captures the full spectrum of cellular interactions. This comprehensive approach enables the identification of subtle and previously obscured cellular patterns and relationships. Evaluated on multiple datasets, scGraphformer demonstrates superior performance in cell type identification compared to existing methods and showcases its scalability with large-scale datasets. Our method not only provides enhanced cell type classification ability but also reveals the underlying cell interactions, offering deeper insights into functional cellular relationships. The scGraphformer thus holds the potential to significantly advance the field of single-cell analysis and contribute to a more nuanced understanding of cellular behavior.

Introduction

Single-cell RNA sequencing (scRNA-seq) has revolutionized biological research by providing high-resolution maps of gene expression at the individual cell level. However, analyzing this data presents significant challenges, including high dimensionality, technical noise, and batch effects—variations introduced by different laboratory protocols or sequencing platforms.

Graph Neural Networks (GNNs) have emerged as a powerful tool for cell type classification by treating cells as nodes in a network. However, most existing GNNs rely on predefined k-Nearest Neighbor (kNN) graphs based on raw similarity. These static graphs are often noisy and may fail to capture subtle, complex biological interactions. Furthermore, as single-cell datasets scale to millions of cells, the quadratic computational complexity of traditional transformer models becomes a bottleneck. scGraphformer addresses these challenges by learning dynamic cell-cell relationships with linear scalability.

Methodology and Architecture

scGraphformer integrates the relational strengths of GNNs with the attention-based power of Transformers to identify cell types without relying on a fixed "map."

Overview of the scGraphformer framework, including data preprocessing, model architecture, and cell type annotation.

The framework consists of several key technical innovations:

  1. Learned Connectivity: Rather than adhering to a fixed kNN graph, scGraphformer treats cells as nodes and iteratively learns an "all-pair" relational network. This allows the model to discover genuine biological relationships based on gene expression patterns rather than simple proximity.
  2. Bio-Centric Transformer Module: The standard Transformer "Query, Key, and Value" (QKV) components are re-engineered for biological data. The Query module utilizes global gene information to characterize cell phenotypes, while the Key and Value modules capture dependencies across multiple cells to construct the dynamic cell graph.
  3. Optional GCN Integration: While the model is capable of "graph-blind" operation, it includes a Graph Convolutional Network (GCN) module that can incorporate high-quality predefined graphs when available to further refine the learning process.

Scalable Attention Mechanism

To handle the massive datasets common in modern genomics, scGraphformer replaces standard softmax attention, which has $O(N^2)$ complexity, with a simplified linear attention mechanism.

The linear attention mechanism in scGraphformer, utilizing Taylor expansion to achieve O(N) complexity.

By utilizing a Taylor expansion-based approximation, the computational complexity is reduced to $O(N)$. This efficiency allows the model to process datasets containing millions of cells on standard hardware without the exponential increase in runtime or memory usage seen in traditional transformer architectures.

Experimental Results and Benchmarking

The researchers evaluated scGraphformer across a diverse range of scenarios:

  • Intra-dataset Benchmarking: Tested on 20 diverse datasets (e.g., Baron, Zheng 68K) covering various species and organs, scGraphformer consistently outperformed seven major competitors, including scVI, CellTypist, and scBert.
  • Cross-Platform Robustness: In inter-dataset tests using the PbmcBench collection, the model achieved a mean accuracy of 95.46%, demonstrating superior performance in handling batch effects when training on one sequencing platform (e.g., 10X) and testing on another (e.g., Smart-seq2).
  • Large-scale Scalability: The model successfully processed the Covid-19 Immune Atlas (~1.46 million cells) and the Human Neocortex Atlas (~638,000 cells). While competitors saw processing times skyrocket, scGraphformer maintained a consistently low runtime.
  • Rare Cell and Subtype Detection: In the Baron Human dataset, scGraphformer accurately identified rare populations like Schwann cells and mast cells that other models missed. It also achieved over 95% accuracy in distinguishing highly similar cell subtypes in mouse brain data.

Biological Insights and Interpretability

Beyond classification, scGraphformer provides interpretable insights into cellular interactions. The attention matrices generated by the model correlate strongly with biological reality. For instance, in liver developmental data, the model exhibited high attention weights between definitive endoderm and immature hepatoblasts, effectively rediscovering known developmental lineages. This suggests that the model's self-learned relationships are often cleaner and more biologically relevant than the noisy synthetic networks typically used in GNNs.

Conclusion

scGraphformer represents a significant advancement in single-cell analysis by providing a scalable, transformer-based approach to cell type identification. By learning cell-cell relationships directly from data and utilizing a linear attention mechanism, it overcomes the limitations of predefined graphs and quadratic complexity. While challenges remain in distinguishing between extremely similar phenotypes—such as endothelial cells and brain pericytes—future work integrating gene regulatory networks and spatial transcriptomics promises to further refine our understanding of cellular behavior.

Reference: Fan, X., Liu, J., Yang, Y. et al. scGraphformer: unveiling cellular heterogeneity and interactions in scRNA-seq data using a scalable graph transformer network. Commun Biol 7, 1463 (2024). https://doi.org/10.1038/s42003-024-07154-w

Summary updated

BibTeX
@inproceedings{fan2024scgraphformer,
  author = {Xingyu Fan and Jiacheng Liu and Yaodong Yang and Chunbin Gu and Yuqiang Han and Bian Wu and Yirong Jiang and Guangyong Chen and Pheng‐Ann Heng},
  title = {{scGraphformer: unveiling cellular heterogeneity and interactions in scRNA-seq data using a scalable graph transformer network}},
  booktitle = {Communications},
  year = {2024},
  doi = {10.1038/s42003-024-07154-w},
}
Figure