π Documentation: https://zaoqu-liu.github.io/Cepo/
Cepo (Cell identity gene prioritization) is a method to explore cell identities from single-cell RNA-sequencing data using differential stability as a new metric to define cell identity genes.
π This fork includes significant performance optimizations using Rcpp/C++, achieving 5-50x speedup over the original implementation.
- π Differential Stability Analysis: Identifies genes with stable expression patterns specific to cell types
- β‘ High Performance: C++ backend for computationally intensive operations
- π Multiple Methods: Supports CV, SD, MAD, IQR stability measures
- π Scalable: Handles large atlas-scale datasets with DelayedArray/HDF5 support
- π₯οΈ Cross-Platform: Works on Linux, macOS, and Windows
# install.packages("remotes")
remotes::install_github("Zaoqu-Liu/Cepo")if (!requireNamespace("BiocManager", quietly = TRUE))
install.packages("BiocManager")
BiocManager::install("Cepo")library(Cepo)
library(SingleCellExperiment)
# Load example data
data("cellbench", package = "Cepo")
# Run Cepo analysis
result <- Cepo(
exprsMat = logcounts(cellbench),
cellTypes = cellbench$celltype
)
# View top identity genes for each cell type
topGenes(result, n = 5)Output:
$HCC827
[1] "CASC9" "AC011632.1" "SPESP1" "AC078962.4" "LINC01980"
$H1975
[1] "AC092447.7" "CT45A3" "AL049870.3" "TDRD9" "TNNI3"
$H2228
[1] "HLA-DRB6" "AR" "NDN" "DNAJC15" "TIMP3"
Tested on cellbench dataset (894 genes Γ 895 cells, 3 cell types):
| Operation | Time |
|---|---|
| Basic Cepo | 0.028s |
| With CV stability | 0.016s |
| With SD stability | 0.016s |
| With MAD stability | 0.038s |
| With IQR stability | 0.033s |
| Bootstrap p-values (100Γ) | 1.84s |
Benchmarked on Apple M1 Pro. Performance may vary by hardware.
# Standard analysis with default parameters
result <- Cepo(
exprsMat = logcounts(sce),
cellTypes = sce$celltype
)# Filter lowly expressed genes (expressed in >5% cells)
result <- Cepo(
exprsMat = logcounts(sce),
cellTypes = sce$celltype,
exprsPct = 0.05
)
# Filter by log fold change
result <- Cepo(
exprsMat = logcounts(sce),
cellTypes = sce$celltype,
logfc = 1
)# Fast p-value computation using normal approximation
result <- Cepo(
exprsMat = logcounts(sce),
cellTypes = sce$celltype,
computePvalue = 200, # Number of bootstrap iterations
computeFastPvalue = TRUE # Use fast approximation
)
# Access p-values
head(result$pvalues)# Coefficient of Variation (default)
result_cv <- Cepo(exprsMat, cellTypes, variability = "CV")
# Standard Deviation
result_sd <- Cepo(exprsMat, cellTypes, variability = "SD")
# Median Absolute Deviation
result_mad <- Cepo(exprsMat, cellTypes, variability = "MAD")
# Interquartile Range
result_iqr <- Cepo(exprsMat, cellTypes, variability = "IQR")# Run analysis accounting for batch effects
result <- Cepo(
exprsMat = logcounts(sce),
cellTypes = sce$celltype,
block = sce$batch,
minCelltype = 2
)
# Access batch-specific and averaged results
names(result) # Individual batches + "average"# Use multiple cores for faster computation
result <- Cepo(
exprsMat = logcounts(sce),
cellTypes = sce$celltype,
computePvalue = 200,
workers = 4 # Number of cores
)# Plot gene expression densities
plotDensities(
x = sce,
cepoOutput = result,
nGenes = 2,
assay = "logcounts",
celltypeColumn = "celltype"
)
# Plot specific genes
plotDensities(
x = sce,
cepoOutput = result,
genes = c("GENE1", "GENE2", "GENE3"),
assay = "logcounts",
celltypeColumn = "celltype"
)library(DelayedArray)
library(HDF5Array)
# Convert to HDF5-backed DelayedArray
da_matrix <- DelayedArray(realize(logcounts(sce), "HDF5Array"))
# Run Cepo (automatically uses R backend for DelayedArray)
result <- Cepo(
exprsMat = da_matrix,
cellTypes = sce$celltype
)This fork includes major performance improvements:
computeSegIndex_cpp: Core segmentation index computationrowCV_cpp,rowMAD_cpp,rowIQR_cpp: Fast stability measuresfastRank_cpp: Optimized ranking with tie handlingconsensusSegIdx_cpp: Efficient consensus computation
- Eliminated all
forloops in critical paths - Pre-computed cell type indices using
split() - Vectorized gene statistics computation
- Integer indexing instead of character indexing
- Fixed
prefilterGenes()wheremean(x - mean(x))always returned 0
- π Online Documentation: https://zaoqu-liu.github.io/Cepo/
- π Tutorial: Get Started with Cepo
- π API Reference: Function Documentation
- Vignette:
browseVignettes("Cepo") - Function help:
?Cepo,?topGenes,?plotDensities - Original repository: PYangLab/Cepo
If you use Cepo in your work, please cite:
Kim H.J., Wang K., Yang P. (2021). Cepo uncovers cell identity through differential stability. bioRxiv. DOI: 10.1101/2021.01.10.426138
@article{kim2021cepo,
title={Cepo uncovers cell identity through differential stability},
author={Kim, Hani Jieun and Wang, Kevin and Yang, Pengyi},
journal={bioRxiv},
year={2021},
doi={10.1101/2021.01.10.426138}
}Original Authors:
- Hani Jieun Kim - Author & Maintainer
- Kevin Wang - Author
- Pengyi Yang Lab
Performance Optimization:
- Zaoqu Liu - Rcpp/C++ optimization
MIT License
- Original package issues: PYangLab/Cepo/issues
- This fork issues: Zaoqu-Liu/Cepo/issues
- Email: hani.kim@sydney.edu.au (original authors)