这篇文章在2020年7月上传到了bioRxiv(Inference and analysis of cell-cell communication using CellChat,https://www.biorxiv.org/content/10.1101/2020.07.21.214387v1.full
在这个工作中,作者构建了一个配体,受体及其辅因子之间相互作用的数据库,该数据库可准确表示已知的异聚分子复合物。并且作者开发了CellChat的一个R包,该工具能够从单细胞RNA测序(scRNA-seq)数据定量推断和分析细胞间通讯网络。
在这之前,已经开发了的几种从scRNA-seq数据推断细胞之间的通信的方法,例如cellphoneDB,celltalker,iTALK和NicheNet。作者认为,之前的方法主要关注点是单一的配体受体,而事实上很多生物学功能是基于受体复合体。
总结下来,作者觉得当前现有数据库或工具的其他局限性包括:
a)缺乏系统地将配体-受体对分类为功能相关的信号通路的方法;
b)自分泌和旁分泌信号相互作用的直观可视化;
c)分析复杂小区间通信的系统方法;
d)鉴于细胞之间的生物变异性可以是离散的也可以是连续的,因此能够针对连续的细胞状态轨迹访问信号串扰。
作者开发的资源包括:
数据库http://www.cellchat.org/
工具包https://github.com/sqjin/CellChat
实操
1.安装
##R安装依赖包:
NMF(https://github.com/sqjin/NMF),
devtools::install_github("sqjin/NMF")
ComplexHeatmap(https://github.com/jokergoo/ComplexHeatmap)
BiocManager::install("ComplexHeatmap", update = F)
##python安装umap
pip install umap-learn
##R安装CellChat
devtools::install_github("sqjin/CellChat")
2.Seurat对象Demo已经定义了细胞类型,并以cellType的meta.data形式存在
#加载需要的R包
library(CellChat)
library(ggplot2)
library(ggalluvial)
library(Seurat)
3.创建cellchat对象
cellchat <- createCellChat(Demo@assays$RNA@data)
meta <- data.frame(cellType = Demo$cellType, row.names = Cells(Demo))
cellchat <- addMeta(cellchat, meta = meta, meta.name = "cellType")
cellchat <- setIdent(cellchat, ident.use = "cellType") # set "labels" as default cell identity
groupSize <- as.numeric(table(cellchat@idents)) # number of cells in each cell group
4.加载与设定需要的CellChatDB数据库
CellChatDB <- CellChatDB.human
CellChatDB.use <- subsetDB(CellChatDB, search = "Secreted signaling") # use Secreted signaling for cell-cell communication analysis
cellchat@DB <- CellChatDB.use # set the used database in the object
5.预处理表达数据以进行细胞间相互作用分析
identifyOverExpressedGenes这步在Rstudio server里测试有bug,但是在window本地运行没问题,估计是该函数与服务器暂时不兼容。
cellchat <- subsetData(cellchat) # subset the expression data of signaling genes for saving computation cost
cellchat <- identifyOverExpressedGenes(cellchat)
cellchat <- identifyOverExpressedInteractions(cellchat)
cellchat <- projectData(cellchat, PPI.human)
6.推断细胞间相互作用网络与分析
cellchat <- computeCommunProb(cellchat)
cellchat <- computeCommunProbPathway(cellchat)
cellchat <- aggregateNet(cellchat)
cellchat <- netAnalysis_signalingRole(cellchat, slot.name = "netP")
netAnalysis_contribution(cellchat, signaling = pathways.show)# Compute and visualize the contribution of each ligand-receptor pair to the overall signaling pathway
7.可视化
pathways.show <- c("TGFb")
vertex.receiver = seq(1,9) # a numeric vector
netVisual_aggregate(cellchat, signaling = pathways.show, vertex.receiver = vertex.receiver, vertex.size = groupSize) # Hierarchy plot
netVisual_aggregate(cellchat, signaling = pathways.show, layout = "circle", vertex.size = groupSize) # Circle plot
netVisual_signalingRole(cellchat, signaling = pathways.show) #Visualize the signaling roles of cell groups
nPatterns = 5
cellchat <- identifyCommunicationPatterns(cellchat, pattern = "outgoing", k = nPatterns)
netAnalysis_river(cellchat, pattern = "outgoing") # river plot
netAnalysis_dot(cellchat, pattern = "outgoing") # dot plot
cellchat <- identifyCommunicationPatterns(cellchat, pattern = "incoming", k = nPatterns)
netAnalysis_river(cellchat, pattern = "incoming") # river plot
netAnalysis_dot(cellchat, pattern = "incoming") # dot plot
几个好用的tips
Tip1:color.use参数设置
比如,Demo_color是存放的对不同细胞类型的配色,属性是一个named vector
那么在cellchat中,一般可视化的函数里面可以直接用 color.use = Demo_color
但是对于netVisual_signalingRole这个函数,需要设置 color.use = Demo_colors[names(cellchat@netPTGFb$outdeg)]
Tip2:看特定信号中所有L-R的作用网络
netVisual_individual(cellchat, signaling = path, layout = "circle", vertex.size = groupSize)
Tip3:图片存为pdf过程会出现的invalid font type
原因:作者把arial作为main font,当R没有这个字体的时候,就会报错
解决方法:
1.先下载Arial字体的TrueType Font文件
2.install.packages('extrafont')
3.font_import()
4.loadfonts(device = "pdf", quiet = F)