Skip to main content

DECIPHER for learning disentangled cellular embeddings in large-scale heterogeneous spatial omics data

Project description

stars-badge Downloads build-badge docs-badge license-badge PyPI Python 3.10

DECIPHER

DECIPHER aims to learn cells’ disentangled intracellular molecular identity embedding and extracellular spatial context embedding from spatial omics data.

Please check our paper DECIPHER for learning disentangled cellular embeddings in large-scale heterogeneous spatial omics data on Nature Communications.

DECIPHER

Installation

PyPI

[!IMPORTANT] Requires Python >= 3.10, install with CUDA-enabled GPU is recommended.

We recommend to install cell-decipher to a new conda environment:

mamba create -n decipher python==3.11 -c conda-forge -y && conda activate decipher
pip install cell-decipher
install_pyg_dependencies

(Optional) You can install RAPIDS to accelerate visualization.

mamba create -n decipher -c conda-forge -c rapidsai -c nvidia python=3.11 rapids=25.06 'cuda-version>=12.0,<=12.8' -y && conda activate decipher
pip install cell-decipher
install_pyg_dependencies

Docker

Build docker image from Dockerfile or pull image from Docker Hub directly:

docker pull huhansan666666/decipher:latest
docker run --gpus all -it --rm huhansan666666/decipher:latest

Documentation

Minimal example

Here is a minimal example for quick start:

import scanpy as sc
from decipher import DECIPHER
from decipher.utils import scanpy_viz

# Init model
model = DECIPHER(work_dir='/path/to/work_dir')

# Register data (adata.X is raw counts, adata.obsm['spatial'] is spatial coordinates)
adata = sc.read_h5ad('/path/to/adata.h5ad')
model.register_data(adata)

# Fit DECIPHER model
model.fit_omics()

# Clustering disentangled embeddings
adata.obsm['X_center'] = model.center_emb  # intracellular molecular embedding
adata.obsm['X_nbr'] =  model.nbr_emb  # spatial context embedding
adata = scanpy_viz(adata, ['center', 'nbr'], rapids=False)

# Plot
adata.obsm['X_umap'] = adata.obsm['X_umap_center'].copy()
sc.pl.umap(adata, color=['cell_type'])
adata.obsm['X_umap'] = adata.obsm['X_umap_nbr'].copy()
sc.pl.umap(adata, color=['region'])

Tutorials

Please check documentation for all tutorials.

Name Description Colab
Basic Model Tutorial Tutorial on how to use DECIPHER Open In Colab
Multi-slices with Batch Effects Tutorial on how to apply DECIPHER to multiple slices with batch effects Open In Colab
Identify Localization-related LRs Tutorial on how to identify ligand-receptors which related with cells’ localization based on DECIPHER embeddings Insufficient resources
Multi-GPUs Training Tutorial on how to use DECIPHER with multi-GPUs on spatial atlas Insufficient resources
More technologies Tutorial on how to use DECIPHER with multiple spatial technologies Insufficient resources

Citation

DECIPHER for learning disentangled cellular embeddings in large-scale heterogeneous spatial omics data (Nature Communications)

If you want to repeat our benchmarks and case studies, please check the benchmark and experiments folder.

FAQ

Please open a new github issue if you meet problem.

  1. Visium or ST data

DECIPHER is designed for single cell resolution data. As for Visium or ST, you can still use DECIPHER after obtaining single-cell resolution through deconvolution or spatial mapping strategies.

Acknowledgement

We thank the following great open-source projects for their help or inspiration:

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cell_decipher-0.3.0.tar.gz (29.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cell_decipher-0.3.0-py3-none-any.whl (37.9 kB view details)

Uploaded Python 3

File details

Details for the file cell_decipher-0.3.0.tar.gz.

File metadata

  • Download URL: cell_decipher-0.3.0.tar.gz
  • Upload date:
  • Size: 29.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for cell_decipher-0.3.0.tar.gz
Algorithm Hash digest
SHA256 52b4ac1afa73ae649cf0736e664d8f7f1b2b98ee1950b3f7c220a3f4055c7211
MD5 b422eab441cfddc561a3ca89335d0b6d
BLAKE2b-256 1ef47d4324a414b694f6af136e564dcb795e27865b3e80bb665ece9ea9106741

See more details on using hashes here.

File details

Details for the file cell_decipher-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: cell_decipher-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 37.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for cell_decipher-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 54c3c73769e4b5294f107afb019ee64545894569fad16eb935f655c30d75aa00
MD5 0b4831a4f641d8ef90d224263b275b53
BLAKE2b-256 167530f15d4e3f4a4ef21085bed9490ce28b8ad4cf8a18df6867da8c8b94a09c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page