A scalable sparse neural network framework for rare cell type annotation of single-cell transcriptome data

Yuqi Cheng, Xingyu Fan, Jianing Zhang, Yu Li

Abstract

Automatic cell type annotation methods are increasingly used in single-cell RNA sequencing (scRNA-seq) analysis due to their fast and precise advantages. However, current methods often fail to account for the imbalance of scRNA-seq datasets and ignore information from smaller populations, leading to significant biological analysis errors. Here, we introduce scBalance, an integrated sparse neural network framework that incorporates adaptive weight sampling and dropout techniques for auto-annotation tasks. Using 20 scRNA-seq datasets with varying scales and degrees of imbalance, we demonstrate that scBalance outperforms current methods in both intra- and inter-dataset annotation tasks. Additionally, scBalance displays impressive scalability in identifying rare cell types in million-level datasets, as shown in the bronchoalveolar cell landscape. scBalance is also significantly faster than commonly used tools and comes in a user-friendly format, making it a superior tool for scRNA-seq analysis on the Python-based platform.

Introduction

In the rapidly evolving field of single-cell genomics, single-cell RNA sequencing (scRNA-seq) has become a cornerstone for profiling gene expression at the individual cell level. A primary objective of this analysis is cell type annotation—the process of assigning biological identities to individual data points. While automated tools have improved the speed of this process, they face a significant hurdle: the "imbalance problem."

Biological datasets are inherently skewed; major cell populations often dwarf rare cell types, which may constitute less than 1% of a sample. These rare populations are frequently the most biologically significant, particularly in contexts like oncology or infectious disease research. Existing automated tools typically fall into two traps: they are biased toward majority classes, mislabeling rare cells as common ones, or they fail to scale, crashing when faced with the memory demands of million-cell datasets.

The scBalance Framework

To address these challenges, we developed scBalance, a Python-based sparse neural network framework. The architecture is specifically designed to handle the high dimensionality and sparsity of genomic data while maintaining computational efficiency.

Sparse Architecture and Robustness

The model utilizes a three-layer neural network (comprising 256, 128, and 64 units) with Exponential Linear Unit (ELU) activation functions. A critical component of the training process is the implementation of a 0.5 dropout rate. While dropout is a standard technique to prevent overfitting, in scBalance, it serves as a powerful "noise-canceling" mechanism. This allows the model to bridge technical variations, known as batch effects, which occur when data is sequenced across different platforms or laboratories.

The scBalance sparse neural network architecture featuring hidden layers with ELU activation and dropout.

Adaptive Weighted Sampling

Unlike traditional methods that rely on synthetic data generation (such as SMOTE) to balance classes—a process that is both memory-intensive and potentially introduces artifacts—scBalance employs an adaptive weight sampling strategy. By adjusting the sampling ratio within each training batch, the framework over-samples rare populations and under-samples common ones. This ensures the network receives sufficient signal from rare cell types without the overhead of generating artificial data points.

Experimental Validation and Results

We evaluated scBalance across 23 diverse datasets, ranging from small benchmarks to massive atlases containing over a million cells. These included intra-dataset benchmarks (e.g., Baron Human, Zheng 68K) and inter-protocol benchmarks where the model was trained on one sequencing technology and tested on another.

Superior Accuracy and Speed

In performance benchmarks, scBalance consistently achieved the highest Cohen’s Kappa scores, a metric that specifically penalizes models for failing to identify minority classes. Our results demonstrate that the adaptive sampling approach significantly outperforms traditional oversampling or undersampling techniques in maintaining high classification accuracy for both rare and major cell types.

Comparison of Cohen's Kappa scores across different sampling methods, demonstrating the effectiveness of weighted sampling in scBalance.

Furthermore, scBalance exhibits remarkable scalability. On a 1.5-million-cell COVID-19 Immune Atlas, scBalance was up to 150 times faster than traditional machine learning methods like Support Vector Machines (SVM) or Random Forests. The framework's ability to utilize GPU acceleration allows it to maintain stable running times even as dataset sizes increase exponentially.

Real-World Biological Discovery

The utility of scBalance was further demonstrated in a case study of bronchoalveolar lavage fluid (BALF) from COVID-19 patients. The framework identified 64 distinct cell subtypes, surpassing the resolution of the original manual analysis. Notably, it successfully pinpointed rare pro-inflammatory macrophages (M1) that are critical to understanding the pathology of severe COVID-19 cases.

Conclusion

scBalance represents a significant advancement in automated cell type annotation. By integrating adaptive sampling with a robust sparse neural network, it overcomes the dual challenges of class imbalance and computational scalability. Future work will focus on incorporating prior biological knowledge, such as marker gene sets, and expanding the framework to support multi-modal data like scATAC-seq. Currently, scBalance is available as a user-friendly, plug-and-play tool compatible with the Scanpy and Anndata ecosystems, making it an accessible and powerful resource for the single-cell research community.

Summary updated

BibTeX
@inproceedings{cheng2023scalable,
  author = {Yuqi Cheng and Xingyu Fan and Jianing Zhang and Yu Li},
  title = {{A scalable sparse neural network framework for rare cell type annotation of single-cell transcriptome data}},
  booktitle = {Communications Biology},
  year = {2023},
  url = {https://openreview.net/forum?id=t6INZlM4Hj},
}
Figure