CpG Transformer for imputation of single-cell methylomes

Gaetan De Waele, Jim Clauwaert, Gerben Menschaert, Willem Waegeman

TL;DR

This paper introduces the CpG Transformer, a novel deep learning architecture that leverages transformer networks with axial and sliding window attention to accurately impute missing DNA methylation data in single-cell experiments. It achieves state-of-the-art performance, offers valuable interpretability, and demonstrates rapid transfer learning capabilities, making it a powerful tool for researchers working with sparse single-cell epigenomic data.

What Problem Does This Paper Address?

Single-cell DNA methylation sequencing (scBS-seq and scRRBS-seq) is crucial for understanding cellular heterogeneity and epigenetic regulation in development and disease. However, these protocols suffer from low coverage, meaning only a fraction of CpG sites are reliably measured per cell. This sparsity leads to noisy data and necessitates effective imputation techniques to reconstruct the complete methylation profile. Existing methods struggle to capture the complex dependencies within and between cells, hindering a comprehensive understanding of epigenomic dynamics at the single-cell level.

Methods

The core innovation is the adaptation of the transformer architecture, a powerful tool for sequence modeling, to handle the 2D nature of methylation matrices. The CpG Transformer combines:

  • Axial Attention: This technique breaks down the full self-attention mechanism (which is computationally prohibitive for large methylation matrices) into separate row-wise and column-wise attention operations. This reduces computational complexity from O(n²m²) to O(mn(n + m)), where n is the number of cells and m is the number of CpG sites.
  • Sliding Window Self-Attention: To further reduce computational cost and leverage the known autocorrelation of nearby CpG sites, the row-wise attention is restricted to a fixed-size window of neighboring CpG sites. This brings the complexity down to O(mn(n + w)), where w is the window size.
  • Input Embeddings: The model takes cell identity, CpG site methylation state (methylated, unmethylated, or unknown), and DNA sequence context as input, all encoded into dense embeddings.
  • Masked Language Modeling (MLM) Objective: Inspired by BERT, the model is trained by masking a percentage of CpG sites and predicting their original methylation state. This denoising autoencoding approach helps the model learn to impute and denoise simultaneously.

Datasets

The study utilizes five publicly available datasets from the Gene Expression Omnibus (GEO):

  • Ser: 20 mouse embryonic stem cells (scBS-seq).
  • 2i: 12 mouse embryonic stem cells (scBS-seq).
  • HCC: 25 human hepatocellular carcinoma cells (scRRBS-seq).
  • MBL: 30 human monoclonal B-cell lymphocytes (scRRBS-seq).
  • Hemato: 122 hematopoietic stem cells and progenitors (scBS-seq).

These datasets represent a range of cell types and sequencing protocols, allowing for robust evaluation.

Key Insights and Ideas

  • Transformers for Methylation: The paper demonstrates that transformer architectures, with appropriate adaptations, are highly effective for modeling complex interactions in DNA methylation data, outperforming previous methods.
  • Local Sparsity is Key: The study highlights that "local sparsity" (the density of observed methylation sites in a local genomic region) is a more significant factor limiting imputation performance than overall sequencing depth or coverage of individual sites.
  • Interpretability Matters: The CpG Transformer's architecture allows for the attribution of predictions to specific input features, providing insights into which factors (CpG embeddings, cell embeddings, DNA context) are most influential for imputation under different conditions.
  • Rapid Transfer Learning: The model's general-purpose representations enable rapid fine-tuning on new datasets, significantly reducing the computational and time burden for researchers.

Key Results

  • State-of-the-Art Performance: CpG Transformer consistently outperforms competing methods like DeepCpG and CaMelia across all tested datasets in terms of ROC AUC and PR AUC. For example, on the Ser dataset, it achieves a ROC AUC of 93.87%, compared to 91.55% for DeepCpG and 92.86% for CaMelia.
  • Computational Efficiency: The model uses a comparable computational budget to DeepCpG and CaMelia.
  • Transfer Learning Speedup: Fine-tuning a pre-trained CpG Transformer on a new dataset (HCC) achieved near-optimal performance within 50 training steps, a ~20x speedup compared to training from scratch (which required 1000 steps).
  • Model Interpretation: Ablation studies confirm the importance of CpG embeddings and cell embeddings for imputation performance, while DNA context embeddings are found to be less critical for the Ser dataset. Analysis of neighboring CpG site contributions reveals a bell-shaped bump at ~160 nucleotides, suggesting a link to nucleosome organization.

Limitations and Future Work

  • Scalability with Cells: The current axial attention mechanism scales quadratically with the number of cells, making it infeasible for datasets with thousands of cells. Future work could explore clustered attention or other sparsity-inducing mechanisms for column-wise attention.
  • Handling Systematic Noise: The current imputation objective assumes random noise and missingness. The paper acknowledges that systematic noise (e.g., bisulfite conversion failures) can be problematic, and future models may need to explicitly account for such biases.
  • Fixed Window Size: The fixed window size for row-wise attention might not be optimal for all genomic regions. Exploring adaptive window sizes or attending to the nearest observed neighbors could be beneficial.
  • Further Interpretation: While the paper provides initial interpretation, further exploration of the learned cell embeddings and their relation to biological cell states is suggested.

Summary updated

BibTeX
@article{waele2022cpg,
  author = {Gaetan De Waele and Jim Clauwaert and Gerben Menschaert and Willem Waegeman},
  title = {{CpG Transformer for imputation of single-cell methylomes}},
  journal = {Bioinformatics},
  year = {2022},
  doi = {10.1093/bioinformatics/btab746},
}
Figure