Package: CytoSPACER 1.0.0

CytoSPACER: Mapping Single-Cell Transcriptomes to Spatial Transcriptomics Data

CytoSPACER is an R implementation of CytoSPACE, a computational strategy for assigning single-cell transcriptomes to in situ spatial transcriptomics (ST) data. The method solves single cell/spot assignment by minimizing a correlation-based cost function through a linear programming-based optimization routine using the Jonker-Volgenant algorithm. This package provides high-performance implementations using Rcpp and supports parallel processing across all platforms.

Authors:Zaoqu Liu [aut, cre], CytoSPACE Team [ctb]

CytoSPACER_1.0.0.tar.gz
CytoSPACER_1.0.0.zip(r-4.7)CytoSPACER_1.0.0.zip(r-4.6)CytoSPACER_1.0.0.zip(r-4.5)
CytoSPACER_1.0.0.tgz(r-4.6-x86_64)CytoSPACER_1.0.0.tgz(r-4.6-arm64)CytoSPACER_1.0.0.tgz(r-4.5-x86_64)CytoSPACER_1.0.0.tgz(r-4.5-arm64)
CytoSPACER_1.0.0.tar.gz(r-4.7-arm64)CytoSPACER_1.0.0.tar.gz(r-4.7-x86_64)CytoSPACER_1.0.0.tar.gz(r-4.6-arm64)CytoSPACER_1.0.0.tar.gz(r-4.6-x86_64)
CytoSPACER_1.0.0.tgz(r-4.6-emscripten)
manual.pdf |manual.html
DESCRIPTION
card.svg |card.png
CytoSPACER/json (API)

# Install 'CytoSPACER' in R:
install.packages('CytoSPACER', repos = c('https://zaoqu-liu.r-universe.dev', 'https://cloud.r-project.org'))

Bug tracker:https://github.com/zaoqu-liu/cytospacer/issues

Pkgdown/docs site:https://zaoqu-liu.github.io

Uses libs:
  • c++– GNU Standard C++ Library v3

On CRAN:

Conda:

cpp

3.40 score 7 scripts 23 exports 30 dependencies

Last updated from:885560a47a (on main). Checks:13 OK. Indexed: yes.

TargetResultTimeFilesSyslog
linux-devel-arm64OK210
linux-devel-x86_64OK266
source / vignettesOK250
linux-release-arm64OK196
linux-release-x86_64OK225
macos-release-arm64OK113
macos-release-x86_64OK247
macos-oldrel-arm64OK107
macos-oldrel-x86_64OK345
windows-develOK177
windows-releaseOK171
windows-oldrelOK168
wasm-releaseOK192

Exports:add_cytospace_to_seuratadd_noise_to_costcompute_assignment_costcompute_cost_matrixdownsample_expressionestimate_cell_type_fractionsestimate_cells_per_spotestimate_fractionsextract_seurat_dataextract_spatial_datanormalize_expressionplot_compositionplot_cytospaceread_cytospace_inputread_visium_datarun_cytospacerun_cytospace_seuratsample_cellssample_cells_by_typesave_cytospace_plotsolve_lapsolve_lap_parallelwrite_cytospace_results

Dependencies:clicodetoolscpp11data.tabledigestfarverfuturefuture.applyggplot2globalsgluegtableisobandlabelinglatticelifecyclelistenvMatrixparallellyprogressrR6RColorBrewerRcppRcppArmadillorlangS7scalesvctrsviridisLitewithr

Algorithm Principles
Overview | The Spatial Mapping Problem | Problem Statement | Mathematical Formulation | Algorithm Pipeline | Step 1: Cell Type Fraction Estimation | Step 2: Cell Count Estimation | Step 3: Reference Cell Sampling | Step 4: Cost Matrix Construction | Step 5: Linear Assignment Problem Solving | The Jonker-Volgenant Algorithm | Implementation Details | Distance Metrics | Pearson Correlation | Spearman Correlation | Euclidean Distance | Normalization | Handling Large Datasets | Tie-Breaking | References | Session Info

Last update: 2026-01-24
Started: 2026-01-24

Performance Optimization
Introduction | Performance Architecture | Benchmarking | C++ vs R Implementation | LAP Solver Performance | Memory Optimization | Sparse Matrix Handling | Downsampling | Parallel Processing | Setting Up Workers | Parallel LAP Solving | Using Future Plans | Chunked Processing | How Chunking Works | Optimization Guidelines | Dataset Size Recommendations | Memory Guidelines | Best Practices | Profiling | Time Profiling | Troubleshooting Performance Issues | Issue: Out of Memory | Issue: Slow Performance | Session Info

Last update: 2026-01-24
Started: 2026-01-24

Quick Start Guide
Introduction | Installation | Load the Package | Simulated Example | Run CytoSPACER | Explore Results | Visualization | Spatial Cell Type Distribution | With Jitter for Dense Regions | Cell Type Composition | Summary Statistics | Save Results | Next Steps | Session Info

Last update: 2026-01-24
Started: 2026-01-24

Seurat Integration
Introduction | Prerequisites | Workflow Overview | Loading Data | From Seurat Objects | From 10x Visium Output | Running CytoSPACER with Seurat | Direct Analysis | Using Idents | Adding Results to Seurat | Basic Integration | Visualizing with Seurat | Data Extraction Utilities | Extract scRNA-seq Data | Extract Spatial Data | Save to Files | Complete Workflow Example | Working with Seurat v5 | Tips and Best Practices | 1. Cell Type Annotation Quality | 2. Gene Overlap | 3. Memory Management | Troubleshooting | Common Issues | Session Info

Last update: 2026-01-24
Started: 2026-01-24

Visualization Gallery
Introduction | Setup | Generate Example Data | Basic Spatial Plots | Cell Type Distribution | Customizing Point Size and Transparency | Adding Jitter | Custom Colors | Custom Title | Cell Type Composition Plots | Global Composition | With Custom Colors | Advanced Visualizations | Combining with ggplot2 | Faceted by Cell Type | Saving Plots | Color Palettes | Session Info

Last update: 2026-01-24
Started: 2026-01-24

Readme and manuals

Help Manual

Help pageTopics
Add CytoSPACER Results to Seurat Objectadd_cytospace_to_seurat
Add Noise to Cost Matrixadd_noise_to_cost
Cell Sampling Functions for CytoSPACERcell_sampling
Compute Total Assignment Costcompute_assignment_cost
Compute Cost Matrixcompute_cost_matrix
Cost Matrix Computation for CytoSPACERcost_matrix
Data Input/Output Functions for CytoSPACERdata_io
Downsample Expression Matrixdownsample_expression
Estimate Cells per Spotestimate_cells_per_spot
Estimate Cell Type Fractionsestimate_cell_type_fractions estimate_fractions
Extract CytoSPACER Input from Seurat Objectextract_seurat_data
Extract Spatial Data from Seurat Objectextract_spatial_data
Linear Assignment Problem Solvers for CytoSPACERlap_solver
Main CytoSPACER Analysis Functionsmain
Data Normalization Functions for CytoSPACERnormalization
Normalize Expression Datanormalize_expression
Plot Cell Type Compositionplot_composition
Plot CytoSPACER Resultsplot_cytospace
Visualization Functions for CytoSPACERplotting
Read CytoSPACER Input Filesread_cytospace_input
Read Visium Data from SpaceRanger Outputread_visium_data
Run CytoSPACE Analysisrun_cytospace
Run CytoSPACER from Seurat Objectsrun_cytospace_seurat
Sample Single Cells by Cell Type Compositionsample_cells sample_cells_by_type
Save CytoSPACER Plotssave_cytospace_plot
Seurat Integration Functions for CytoSPACERseurat_integration
Solve Linear Assignment Problemsolve_lap
Solve Multiple Assignment Problems in Parallelsolve_lap_parallel
Utility Functions for CytoSPACERutils
Write CytoSPACER Resultswrite_cytospace_results