An adaptation of the SCP package with full Seurat V5 support and modern Python dependency management.
- Full V5 Support: Native compatibility with Seurat V5's layer-based data structure
- Version Agnostic: Seamlessly handles both Seurat V4 and V5 objects
- Automatic Detection: Smart detection and conversion of legacy objects
- Zero Migration Cost: Existing pipelines work without modification
- UV-Only: Ultra-fast Python package manager (10-100x faster than pip/conda)
- Modular Installation: Install only the features you need
- Cross-Platform: Works on macOS, Linux, and Windows
- Simple Setup: One command to install all dependencies
- RNA velocity analysis (scVelo, CellRank)
- Trajectory inference (Palantir, WOT)
- Advanced dimensionality reduction (UMAP, PHATE, PaCMAP, TriMAP)
- Batch correction (Scanorama, BBKNN, Harmony)
- Doublet detection (Scrublet, DoubletDetection)
- Deep learning methods (scvi-tools)
- And much more...
# Install devtools if needed
install.packages("devtools")
# Install SCP
devtools::install_github("jinworks/SCP-SeuratV5")SCP uses Python for advanced analysis features, managed exclusively via UV (ultra-fast package manager).
library(SCP)
# Install core dependencies only (~5 seconds)
PrepareEnv()
# Install all features (~60 seconds)
PrepareEnv(extras = "all")
# Install specific features
PrepareEnv(extras = c("velocity", "trajectory", "spatial"))
# Add more features to existing environment later
uv_install_extras("deeplearning")Performance: UV is 10-100x faster than pip/conda!
For detailed Python setup instructions, see PYTHON_DEPENDENCIES.md.
library(SCP)
# Load your Seurat object (automatic V5 conversion if needed)
srt <- readRDS("your_seurat_object.rds")
# Check if it's Seurat V5
IsSeurat5(srt)
# Convert to V5 if needed
srt <- EnsureSeurat5(srt)
# Run standard analysis
srt <- RunStandardWorkflow(srt)
# Visualize
CellDimPlot(srt, group.by = "cell_type")
FeatureDimPlot(srt, features = c("CD3D", "CD8A", "CD4"))# Version-agnostic data access
counts <- get_seurat_data(srt, layer = "counts")
data <- get_seurat_data(srt, layer = "data")
# Set data back
srt <- set_seurat_data(srt, data = normalized_data, layer = "data")
# Feature metadata
feature_meta <- get_feature_metadata(srt)
srt <- set_feature_metadata(srt, metadata = new_meta)
# Variable features
var_genes <- get_var_features(srt)# RNA Velocity with scVelo
srt <- RunScvelo(srt,
group.by = "cell_type",
linear_reduction = "pca",
nonlinear_reduction = "umap"
)
# Trajectory with Palantir
srt <- RunPalantir(srt,
start_cell = "CELL_001",
num_waypoints = 500
)
# Cell fate with CellRank
srt <- RunCellRank(srt,
group.by = "cell_type",
linear_reduction = "pca"
)- R >= 4.1.0
- Seurat >= 5.0.0
- SeuratObject >= 5.0.0
- Plus standard Bioconductor packages (automatically installed)
- Python 3.10, 3.11, or 3.12 (3.10 recommended)
- Managed via UV (ultra-fast package manager)
- Quick start:
# One-time install
PrepareEnv(extras = c("spatial", "velocity"))
# In new sessions, activate environment
library(SCP)
use_uv_env()See PYTHON_DEPENDENCIES.md for the complete list.
IsSeurat5(srt)- Check if object is Seurat V5EnsureSeurat5(srt)- Convert to V5 if neededGetSeuratVersion(srt)- Get detailed version info
get_seurat_data(srt, layer)- Get data from any layerset_seurat_data(srt, data, layer)- Set data to a layerget_feature_metadata(srt)- Get feature metadataset_feature_metadata(srt, metadata)- Set feature metadataget_var_features(srt)- Get variable features
PrepareEnv(extras)- Set up UV Python environment with optional feature groupsuse_uv_env()- Configure R to use UV environmentcheck_uv()- Check if UV is installeduv_env_exists()- Check if UV environment existsuv_install_extras(extras)- Add optional feature groups to existing environmentuv_install_packages(packages)- Install individual Python packagesRemoveEnv()- Remove UV Python environmentcheck_Python(packages)- Verify Python packages are available
See the original SCP documentation for the full list of analysis functions.
- Minimal scRNA smoke test:
tests/testthat/test_seurat_v5_basics.R - Optional Chromium test: set
SCP_TEST_10X_H5to a 10x HDF5 path - Optional Visium HD test: set
SCP_TEST_VISIUM_BASEto a binned output dir (e.g.,.../square_008um) and runtests/interactive/test_spatial_visium_hd.R
- Python Dependencies: PYTHON_DEPENDENCIES.md
- UV Setup Guide: UV_SETUP.md
- Original SCP Docs: SCP Repository
library(SCP)
# Activate UV environment
use_uv_env()
# Check specific packages
check_Python(c("numpy", "pandas", "scanpy", "anndata"))
# Check UV installation
check_uv()
uv_env_exists()library(SCP)
# Test basic functionality
IsSeurat5(your_object)
# Test Python environment
use_uv_env()
py_config <- reticulate::py_config()
print(py_config)# Remove and recreate environment
RemoveEnv()
PrepareEnv(force = TRUE)
# Or manually
uv_remove_env()
PrepareEnv(extras = "all")
# Verify installation
use_uv_env() # Activate environment
check_Python(c("numpy", "scanpy", "anndata")) # Check packages# Get detailed version info
GetSeuratVersion(srt)
# Force update to V5
srt <- UpdateSeuratObject(srt)
srt <- EnsureSeurat5(srt)# Install specific feature groups to existing environment
uv_install_extras(c("velocity", "trajectory"))
# Or reinstall with new extras
PrepareEnv(extras = c("velocity", "trajectory", "spatial"), update = TRUE)- Modular Installation: Install only specific
extrasyou need instead of "all" for faster setup - Seurat V5 Native: Use V5 objects for better memory efficiency
- Apple Silicon: Use
extras = "apple_silicon"for Metal acceleration in deep learning - UV Speed: Python environment setup is 10-100x faster than traditional pip/conda
| Platform | Python (UV) | Status |
|---|---|---|
| macOS (Intel) | ✅ | Full support |
| macOS (Apple Silicon) | ✅ | Full support + Metal acceleration |
| Linux | ✅ | Full support |
| Windows | ✅ | Full support |
Contributions are welcome! Please:
- Fork the repository
- Create a feature branch
- Make your changes
- Submit a pull request
If you use SCP in your research, please cite the original package:
Zhang, H. (2024). SCP: Single Cell Pipeline.
GitHub: https://github.com/zhanghao-njmu/SCP
GPL-3.0-or-later
- Original SCP package by Hao Zhang
- Seurat team for Seurat V5
- UV team at Astral for the amazing Python package manager
- Seurat - Single-cell RNA-seq analysis
- scanpy - Python-based single-cell analysis
- scVelo - RNA velocity analysis
- UV - Fast Python package manager
For issues and questions:
- Bug Reports: GitHub Issues
- Original SCP: SCP Issues
- Python Dependencies: See PYTHON_DEPENDENCIES.md
Version: 0.7.0 Last Updated: 2025-10-14