scSpace (single-cell and spatial position associated co-embeddings) is an integrative algorithm that integrates spatial transcriptome data to reconstruct spatial associations of single cells within scRNA-seq data. Using transfer component analysis (TCA), scSpace could extract the characteristic matrixes of spatial transcriptomics and scRNA-seq, and project single cells into a pseudo space via a multiple layer perceptron (MLP) model, so that gene expression and spatial weight of cells can be embedded jointly for the further cell typing with higher accuracy and precision.
Code for generating the figures in this study can be found here.
For scSpace, the python version need is over 3.8. If you have installed Python3.6 or Python3.7, consider installing Anaconda, and then you can create a new environment.
conda create -n scspace python=3.8
conda activate scspace
The version of pytorch should be suitable to the CUDA version of your machine. You can find the appropriate version on the PyTorch website. Here is an example with CUDA11.6:
pip install torch --extra-index-url https://download.pytorch.org/whl/cu116
cd scSpace-master
pip install -r requirements.txt
python setup.py build
python setup.py install
To use scSpace we require five formatted .csv
files as input (i.e. read in by pandas). We have included a toy dataset
in the vignettes/data folder of this repository as examples to show how to use scSpace:
Additional step-by-step tutorials now available! Preprocessed datasets used can be downloaded from Google Drive.
-
Spatial reconstruction of human DLPFC spatial transcriptomics data
-
Spatial reconstruction of human SCC spatial transcriptomics data
scSpace was developed by Jie Liao and Jingyang Qian. Should you have any questions, please contact Jie Liao at liaojie@zju.edu.cn, or Jingyang Qian at qianjingyang@zju.edu.cn
Qian, J., Liao, J., Liu, Z. et al. Reconstruction of the cell pseudo-space from single-cell RNA sequencing data with scSpace. Nat Commun 14, 2484 (2023). https://doi.org/10.1038/s41467-023-38121-4