Spatial CommunicationSpatial communication is a point of interest for us for the 空间转录组学 Society, and we would like to find the conduction process of spatial communication.Here, we introduce two method integrated in OmicVerse named COMMOT and flowsig.We made three improvements in integrating the COMMOT and flowsig algorithm in OmicVerse:- We reduced the installation conflict of COMMOT and flowsig, user only need to update OmicVerse to the latest version.- We optimized the 可视化 of COMMOT and flowsig and unified the data 预处理 process so that users don’t need to struggle with different data processing flows.- We have fixed some bugs that could occur during function.If you found this tutorial helpful, please cite COMMOT, flowsig and OmicVerse:- Cang, Z., Zhao, Y., Almet, A.A. et al. Screening cell–cell communication in 空间转录组学 via collective optimal transport. Nat Methods 20, 218–228 (2023). https://doi.org/10.1038/s41592-022-01728-4- Almet, A.A., Tsai, YC., Watanabe, M. et al. Inferring pattern-driving intercellular flows from 单细胞 and 空间转录组学. Nat Methods (2024). https://doi.org/10.1038/s41592-024-02380-w#
import omicverse as ov# print(f"OmicVerse version: {ov.__version__}")导入 scanpy as sc#print(f"scanpy version: {sc.__version__}")ov.plot_set()
____ _ _ __
/ __ \____ ___ (_)___| | / /__ _____________
/ / / / __ `__ \/ / ___/ | / / _ \/ ___/ ___/ _ \
/ /_/ / / / / / / / /__ | |/ / __/ / (__ ) __/
\____/_/ /_/ /_/_/\___/ |___/\___/_/ /____/\___/
Version: 1.6.7, Tutorials: https://omicverse.readthedocs.io/
All dependencies are satisfied.
预处理 dataHere we present our re-analysis of 151676 sample of the dorsolateral prefrontal cortex (DLPFC) dataset. Maynard et al. has manually annotated DLPFC layers and white matter (WM) based on the morphological features and 基因 markers.This tutorial demonstrates how to identify spatial domains on 10x Visium data using STAGATE. The processed data are available at LieberInstitute/spatialLIBD. We downloaded the manual 注释 from the spatialLIBD package and provided at https://drive.google.com/drive/folders/10lhz5VY7YfvHrtV40MwaqLmWz56U9eBP?usp=sharing.#
adata = sc.read_visium(path='data', count_file='151676_filtered_feature_bc_matrix.h5')adata.var_names_make_unique()
reading data/151676_filtered_feature_bc_matrix.h5
(0:00:00)
Note
We introduced the spatial special svg calculation module prost in OmicVerse versions greater than `1.6.0` to replace scanpy's HVGs, if you want to use scanpy's HVGs you can set mode=`scanpy` in `ov.space.svg` or use the following code.
sc.pp.calculate_qc_metrics(adata, inplace=True)adata = adata[:,adata.var['total_counts']>100]adata=ov.space.svg(adata,mode='prost',n_svgs=3000,target_sum=1e4,platform="visium",)adata
adata.write('data/cluster_svg.h5ad',compression='gzip')
# adata=ov.读取('data/cluster_svg.h5ad',compression='gzip')
Communication Analysis with COMMOT### Spatial communication inferenceWe will use the CellChatDB ligand-receptor database here. Only the secreted signaling LR pairs will be used.Jin, Suoqin, et al. “Inference and analysis of cell-cell communication using CellChat.” Nature communications 12.1 (2021): 1-20.#
df_cellchat = ov.external.commot.pp.ligand_receptor_database(species='human', signaling_type='Secreted Signaling', database='CellChat')print(df_cellchat.shape)
(1199, 4)
We then 筛选 the LR pairs to keep only the pairs with both ligand and receptor expressed in at least 5% of the spots.
df_cellchat_filtered = ov.external.commot.pp.filter_lr_database(df_cellchat, adata, min_cell_pct=0.05)print(df_cellchat_filtered.shape)
(19, 4)
Now perform spatial communication inference for these 250 ligand-receptor pairs with a spatial distance limit of 500. CellChat database considers heteromeric units. The signaling results are stored as 点位-by-点位 matrices in the obsp slots. For example, the score for 点位 i signaling to 点位 j through the LR pair can be retrieved from adata.obsp['commot-cellchat-Wnt4-Fzd4_Lrp6'][i,j].
ov.external.commot.tl.spatial_communication(adata, database_name='cellchat', df_ligrec=df_cellchat_filtered, dis_thr=500, heteromeric=True, pathway_sum=True)
(Optional) We 读取 the ground truth area of our spatial dataThis step is not mandatory to run, in the tutorial, it’s just to demonstrate the accuracy of our 聚类分析 effect, and in your own tasks, there is often no Ground_truth
Note
You can also use Celltype and other annotated results in adata.obs, here is just a randomly selected type, there is no particular significance, in order to facilitate the 可视化 and study the signal