SpaGER (Spatial Gene Expression in R) provides a high-performance R implementation of the SpaGE algorithm for predicting genome-wide expression profiles in spatial transcriptomics data through integration with single-cell RNA sequencing (scRNA-seq) reference datasets.
Spatial transcriptomics technologies, while providing invaluable spatial context, often measure only a limited panel of genes. SpaGER addresses this fundamental limitation by leveraging the comprehensive gene coverage of scRNA-seq data to impute unmeasured gene expression in spatial data, enabling more complete transcriptomic characterization of tissue architecture.
SpaGER employs a domain adaptation approach based on Principal Vectors (PVs) to bridge the gap between spatial and single-cell transcriptomic domains:
The algorithm operates through the following steps:
Z-score Standardization: Both datasets are standardized using population standard deviation to ensure comparability
Principal Vector Computation: Identifies the optimal linear subspace that maximizes alignment between domains through SVD-based decomposition
Cosine Similarity Selection: Principal vectors are retained based on their cosine similarity, representing the alignment quality between domains
Weighted k-NN Imputation: Expression values are predicted using distance-weighted averaging of k nearest neighbors in the aligned subspace
# Install from R-Universe (recommended)
install.packages("SpaGER", repos = "https://zaoqu-liu.r-universe.dev")
# Using remotes
remotes::install_github("Zaoqu-Liu/SpaGER")
# Or using devtools
devtools::install_github("Zaoqu-Liu/SpaGER")
For extended functionality:
install.packages(c("Seurat", "fastICA", "NMF", "pls", "psych"))
library(SpaGER)
# Predict expression of unmeasured genes
predicted <- SpaGE(
spatial_data = spatial_expr, # Spatial transcriptomics data
rna_data = scrna_expr, # scRNA-seq reference
n_pv = 30, # Number of principal vectors
n_neighbors = 50 # k for KNN imputation
)
# With Seurat objects
library(Seurat)
spatial_obj <- SpaGE.Seurat(
spatial_seurat = visium_data,
rna_seurat = scrna_ref,
n_pv = 30
)
See the documentation for comprehensive tutorials and examples.
If you use SpaGER in your research, please cite:
Abdelaal T, Mourragui S, Mahfouz A, Reinders MJT. (2020). SpaGE: Spatial Gene Enhancement using scRNA-seq. Nucleic Acids Research, 48(18):e107. DOI: 10.1093/nar/gkaa740
Liu Z. (2026). SpaGER: Spatial Gene Expression Prediction using scRNA-seq in R. GitHub: https://github.com/Zaoqu-Liu/SpaGER
This project is licensed under the MIT License.