Cell-cell communication prediction for ST data
Project description
DeepTalk
Deciphering cell-cell communication from spatially resolved transcriptomic data at single-cell resolution with subgraph-based attentional graph neural network
Recent advances in spatial transcriptomics (ST) and single-cell RNA sequencing (scRNA-seq) have revolutionized the study of cell-cell communication (CCC) regarding tissue homeostasis, development, and disease. However, deciphering the spatially resolved CCC at the single-cell resolution remains a significant challenge, impeding a comprehensive understanding of intercellular dynamics and biochemical processes. Here, we introduce DeepTalk, a deep learning model that harnesses cell-specific gene expression data and spatial distances to predict spatially resolved CCC at the single-cell resolution. DeepTalk utilizes graph attention network (GAT) to efficiently integrate the scRNA-seq and ST data, enabling accurate cell type identification for single-cell ST data and deconvolution for spot-based ST data. Additionally, leveraging subgraph-based GAT, DeepTalk effectively captures the connections among cells at multiple levels, yielding outstanding accuracy in predicting spatial CCC at the single-cell resolution. Extensive evaluations using diverse publicly available datasets validate the exceptional performance and robustness of DeepTalk in identifying spatial CCC. Furthermore, DeepTalk discovers meaningful CCC patterns under various conditions, enabling the exploration of context-specific cell cooperation and signaling.
How to install DeepTalk
To install DeepTalk, make sure you have PyTorch and scanpy installed. If you need more details on the dependences, look at the environment.yml
file.
- set up conda environment for DeepTalk
conda env create -f environment.yml
install DeepTalk_ST from shell:
conda activate deeptalk-env
pip install DeepTalk_ST
- To start using DeepTalk, import DeepTalk in your jupyter notebooks or/and scripts
import DeepTalk as dt
How to run DeepTalk for cell type identification
Load your spatial data and your single cell data (which should be in AnnData format), and pre-process them using dt.pp_adatas`:
ad_st = sc.read_h5ad(path)
ad_sc = sc.read_h5ad(path)
dt.pp_adatas(ad_sc, ad_st, genes=None)
The function pp_adatas
finds the common genes between adata_sc, adata_sp, and saves them in two adatas.uns
for mapping and analysis later. Also, it subsets the intersected genes to a set of training genes passed by genes
. If genes=None
, DeepTalk maps using all genes shared by the two datasets. Once the datasets are pre-processed we can map:
ad_map = dt.map_cells_to_space(ad_sc, ad_st)
The returned AnnData,ad_map
, is a cell-by-voxel structure where ad_map.X[i, j]
gives the probability for cell i
to be in voxel j
. This structure can be used to project gene expression from the single cell data to space, which is achieved via dt.project_genes
.
ad_ge = dt.project_genes(ad_map, ad_sc)
The returned ad_ge
is a voxel-by-gene AnnData, similar to spatial data ad_st
, but where gene expression has been projected from the single cells.
How to run DeepTalk for cell-cell communication inference
Generating Training Files for Deep Learning using ad_ge
:
dt.File_Train(data_name, LR_train, outdir = Test_dir)
dt.data_for_train(data_dir, data_name, LR_train)
Generating Predicting Files for Deep Learning using ad_ge
:
dt.CCC_LR_pre(data_name,ligand, receptor, cell_pair, outdir)
dt.data_for_test(data_dir, data_name, LR_test)
Use subgraph-based graph attention network to construct CCC networks for the ligand-receptor pairs with a spatial distance constraint:
dt.Train(data_name,data_path, outdir, pretrained_embeddings, n_epochs = 50, ft_n_epochs=10)
dt.run_predict(data_name, data_path, outdir, pretrained_embeddings, model_path)
Documentation
See detailed documentation and examples at https://deeptalk.readthedocs.io/en/latest/index.html.
Contact
Feel free to submit an issue or contact us at wenyiyang22@163.com for problems about the package.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file deeptalk_st-0.0.3.tar.gz
.
File metadata
- Download URL: deeptalk_st-0.0.3.tar.gz
- Upload date:
- Size: 210.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.8.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 930f1e42e5bfc972a8a08ca6856ff7ba3808dd86a691108b24096800852a77ef |
|
MD5 | 9d2086a79de574ba0e9a715bd2e0ab9c |
|
BLAKE2b-256 | 1b3c65cc5a0adc69595ba2d9a6d60cb2ae57913182ce42ef21e7785657a88bd1 |
File details
Details for the file DeepTalk_ST-0.0.3-py3-none-any.whl
.
File metadata
- Download URL: DeepTalk_ST-0.0.3-py3-none-any.whl
- Upload date:
- Size: 257.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.8.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 441cc4e7452bc3342b6fec21f5a8f4af1c8980eef2cafa7dfebd84c97ef1280a |
|
MD5 | b712a26303941523743270e56389e98f |
|
BLAKE2b-256 | 66b1c459a1ff0dcc56daa8075d23677554ce39cf11ee678881aeaeb8753effdf |