CellNiche
Overview ✨
CellNiche is a lightweight and scalable representation learning framework for atlas-scale spatial omics that identifies and characterizes cellular microenvironments. It flexibly accommodates multiple forms of cellular identity representations, including expression matrices, pretrained embeddings, and discrete cell labels, making it well suited for heterogeneous spatial omics data. With efficient computation and strong robustness across input types, CellNiche supports cross-sample analysis of cancer spatial omics cohorts and the construction of large-scale virtual organ atlases.
Please check our paper CellNiche represents cellular microenvironments in atlas-scale spatial omics data with contrastive learning on Nature Communications.
Installation ⚙️
From Source (recommend)
git clone https://github.com/Super-LzzZ/CellNiche.git
cd CellNiche
From PyPI
pip install CellNiche
Requirements
- Python ≥ 3.9
- PyTorch ≥ 1.12
- PyTorch Geometric (torch-geometric, torch-scatter, torch-sparse, torch-cluster, torch-spline-conv)
- Scanpy ≥ 1.9
- Anndata ≥ 0.9
- scikit-learn ≥ 1.3
- numpy ≥ 1.22
- scipy ≥ 1.10
- pandas ≥ 2.0
- networkx ≥ 3.1
- tqdm ≥ 4.67.1
You can install most dependencies with:
pip install torch torchvision torchaudio
pip install torch-geometric torch-scatter torch-sparse torch-cluster torch-spline-conv
pip install scanpy anndata scikit-learn numpy scipy pandas networkx tqdm
A successful example
conda create -n cellniche python=3.9
conda activate cellniche
pip install torch==2.0.1 torchvision==0.15.2 torchaudio==2.0.2
pip install torch_cluster-1.6.3+pt20cu117-cp39-cp39-linux_x86_64.whl
pip install torch_scatter-2.1.2+pt20cu117-cp39-cp39-linux_x86_64.whl
pip install torch_sparse-0.6.18+pt20cu117-cp39-cp39-linux_x86_64.whl
pip install torch_spline_conv-1.2.2+pt20cu117-cp39-cp39-linux_x86_64.whl
pip install torch-geometric==2.6.1
pip install CellNiche
pip install pyyaml
...
Tutorials 📚
Spatial proteomics data or single-cell spatial transcriptomics data
The data required to run tutorials is located in data/. Please note that due to Github size limitations, you have to download the relevant data for analysis from Google Drive.
CellNiche for single-slice
- CellNiche's demonstration on cortex osmFISH data
- CellNiche's demonstration on mouse_spleen CODEX data
- CellNiche's demonstration on mouse_brain STAPmap data
CellNiche for integrated multiple slices from the same experiment
CellNiche for integrated multiple slices across different technologies
- Constructing a cross-technique integrated mouse brain dataset
- CellNiche's demonstration of batch effects on mergedBrain data
- CellNiche's demonstration on mergedBrain data (part1: Atlas1)
- CellNiche's demonstration on mergedBrain data (part2: Atlas2, 3, 4)
Getting Started 🚀
bash (recommend)
python -m cellniche.main --config ./configs/cortex_osmFISH.yaml
python
# way 1: If you download from source (better suited for personalized use)
sys.path.append('/share/home/liangzhongming/phd_code/530/CellNiche/release')
import cellniche as cn
# way 2: If you download from PyPI (better suited for stable use)
# import cellniche as cn
# Parse arguments from a YAML config
# Run training/inference
adata = cn.cli(["--config", "./configs/cortex_osmFISH.yaml"])
Contribution
For questions or comments, please use the issue tracker and/or email Zhongming Liang (liangzhongming21@mails.ucas.ac.cn).
Metadata
Release files for CellNiche 0.1.8
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| cellniche-0.1.8.tar.gz | 20.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| cellniche-0.1.8-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 43.7 kB
Release files / cellniche-0.1.8.tar.gz
| Download URL | cellniche-0.1.8.tar.gz |
|---|---|
| Size | 20.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7da523332fef14f7d81fea254e6460a3480639d098c832eb20df22b2d78cdeb8
|
|
BLAKE2b-256 checksum How to use checksums |
540e8f19510349c9235f888e46ea9abc5fca3fed62d2c5c4141ae760f3be7c32
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.9.13
|
Release files / cellniche-0.1.8-py3-none-any.whl
| Download URL | cellniche-0.1.8-py3-none-any.whl |
|---|---|
| Size | 22.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9e86bd99a5fd0c7e1fa610f15e622fc38eee560b2ef6cbba9abcc9082293d528
|
|
BLAKE2b-256 checksum How to use checksums |
b75278d141f369f191c9a643f73ecd21763f89f20b6d76fb283477da3beece80
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.9.13
|