Skip to content

a computational framework to identify and characterize cell niches from spatial omics data at single-cell resolution

License

Notifications You must be signed in to change notification settings

ZJUFanLab/scNiche

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

scNiche v1.1.0

Identification and characterization of cell niches in tissue from spatial omics data at single-cell resolution

python >=3.9 DOI

scNiche is a computational framework to identify and characterize cell niches from single-cell spatial omics data

avatar

Requirements and Installation

anndata 0.10.1 pandas 1.5.0 squidpy 1.2.3 scanpy 1.9.1 dgl 1.1.0+cu113 torch 1.21.1+cu113 matplotlib 3.6.2 seaborn 0.13.0

Create and activate conda environment with requirements installed.

For scNiche, the Python version need is over 3.9. If you have already installed a lower version of Python, consider installing Anaconda, and then you can create a new environment.

cd scNiche-main

conda env create -f scniche_dev.yaml -n scniche
conda activate scniche

Install PyTorch and DGL

We developed scNiche in a CUDA 11.3 environment. Here is an example of installing PyTorch and DGL with CUDA11.3:

# install PyTorch
pip install torch==1.12.1+cu113 --extra-index-url https://download.pytorch.org/whl/cu113

# install DGL
pip install dgl==1.1.0+cu113 -f https://data.dgl.ai/wheels/cu113/repo.html

The version of PyTorch and DGL should be suitable to the CUDA version of your machine. You can find the appropriate version on the PyTorch and DGL website.

Install scNiche

python setup.py build
python setup.py install

Tutorials (identify cell niches)

- Spatial proteomics data or single-cell spatial transcriptomics data

By default, scNiche requires the single-cell spatial omics data (stored as .h5ad format) as input, where cell population label of each cell needs to be provided.

Here are examples of scNiche on simulated and biological datasets:

scNiche also provides a subgraph-based batch training strategy to scale to large datasets and multi-slices:

  1. Batch training strategy of scNiche for single-slice:
  1. Batch training strategy of scNiche for multi-slices:

- Low-resolution spatial transcriptomics data

We here take 4 slices from the same donor of the human DLPFC 10X Visium data as an example.

In contrast to spatial proteomics data, which usually contain only a few dozen proteins, these spatial transcriptomics data can often measure tens of thousands of genes, with potential batch effects commonly present across tissue slices from different samples. Therefore, dimensionality reduction and batch effect removal need to be performed on the molecular profiles of the cells and their neighborhoods before run scNiche. We used scVI by defalut, however, simple PCA dimensionality reduction or other deep learning-based integration methods like scArches are also applicable.

Furthermore, cell type labels are usually unavailable for these spatial transcriptomics data. As alternatives, we can:

  1. Use the deconvolution results of spots as a substitute view to replace the cellular compositions of neighborhoods. We used the human middle temporal gyrus (MTG) scRNA-seq data by Hodge et al. as the single-cell reference, and deconvoluted the spots using Cell2location:
  1. Only use the molecular profiles of cells and neighborhoods as input:

Multi-slice analysis of 4 slices based on the batch training strategy of scNiche:

- Spatial multi-omics data

The strategy of scNiche for modeling features from different views of the cell offers more possible avenues for expansion, such as application to spatial multi-omics data. We here ran scNiche on a postnatal day (P)22 mouse brain coronal section dataset generated by Zhang et al., which includes RNA-seq and CUT&Tag (acetylated histone H3 Lys27 (H3K27ac) histone modification) modalities. The dataset can be downloaded here.

Tutorials (characterize cell niches)

scNiche also offers a downstream analytical framework for characterizing cell niches more comprehensively.

Here are examples of scNiche on two biological datasets:

Acknowledgements

The scNiche model is developed based on the multi-view clustering framework (CMGEC). We thank the authors for releasing the codes.

About

scNiche is developed by Jingyang Qian. Should you have any questions, please contact Jingyang Qian at [email protected].

References

Qian, J., Shao, X., Bao, H. et al. Identification and characterization of cell niches in tissue from spatial omics data at single-cell resolution. Nat Commun 16, 1693 (2025). https://doi.org/10.1038/s41467-025-57029-9