适用于scRNA-seq的细胞通讯工具-2:CellChat

现在开始学习第二个适用于单细胞转录组数据的细胞通讯工具:Cellchat,也是比较常用的。相较于CellphoneDB的数据库(配体-受体+多聚体),CellChat在模拟细胞间通讯的数据库CellChatDB又纳入辅因子,看了它的数据库,相较于其他工具,它涵盖的有关鼠的配、受体等会更多一些(可能对于小鼠的数据会更有优势一点)。另外,CellChat分析也可以用于多组间的比较,例如正常与疾病条件下的比较。结果的可视化也是很丰富。下面开始学习一下吧!
Inference and analysis of cell-cell communication using CellChat - PubMed (nih.gov)

一、安装


install.packages('NMF')
devtools::install_github("jokergoo/circlize")
devtools::install_github("jokergoo/ComplexHeatmap")
devtools::install_github("sqjin/CellChat")

二、加载R包、数据

library(Seurat)
library(SeuratData)
library(tidyverse)
library(CellChat)
library(NMF)
library(ggalluvial)
library(patchwork)
library(ggplot2)
library(svglite)
options(stringsAsFactors = FALSE)

pbmc <- readRDS("./pbmc.rds")

三、创建CellChat对象

cellchat <- createCellChat(pbmc@assays$RNA@data, meta = pbmc@meta.data, group.by = "cell_type")
summary(cellchat)
str(cellchat)
levels(cellchat@idents)
# [1] "Naive CD4 T"  "Memory CD4 T" "CD14+ Mono"  "B"            "CD8 T"     
# [6] "FCGR3A+ Mono" "NK"          "DC"          "Platelet"

groupSize <- as.numeric(table(cellchat@idents))  #查看每个cluster有多少个细胞
groupSize
[1] 684 481 476 344 291 162 155  32  13

四、导入配体受体数据库

CellChatDB <- CellChatDB.human #小鼠是CellChatDB.mouse
str(CellChatDB) #查看数据库信息,包含interaction、complex、cofactor和geneInfo
colnames(CellChatDB$interaction)
CellChatDB$interaction[1:4,1:4]
head(CellChatDB$cofactor)
head(CellChatDB$complex)
head(CellChatDB$geneInfo)
showDatabaseCategory(CellChatDB)
image1.png

#包括61.8%的旁分泌/自分泌信号相互作用、21.7%的细胞外基质(ECM)-受体相互作用和16.5%的细胞-细胞接触相互作用。48%的相互作用涉及杂聚分子复合物,52%的相互作用从最近的文献中搜集的。


unique(CellChatDB$interaction$annotation)#查看可以选择的侧面,也就是上图左中的三种

#这里选择"Secreted Signaling"进行后续细胞互作分析
CellChatDB.use <- subsetDB(CellChatDB, search = "Secreted Signaling") #也可默认使用所有的
cellchat@DB <- CellChatDB.use # set the used database in the object

五、预处理

cellchat <- subsetData(cellchat)
future::plan("multicore", workers = 4)#multiprocess
cellchat <- identifyOverExpressedGenes(cellchat)#相当于Seurat的FindMarkers,找每个细胞群中高表达的配受体基因
cellchat <- identifyOverExpressedInteractions(cellchat) #基于CellChatDB数据库,识别出过表达的配体-受体相互作对。
cellchat <- projectData(cellchat, PPI.human) #找到配体受体关系后,projectData将配体受体对的表达值投射到PPI上,来对@data.signaling中的表达值进行校正。结果保存在@data.project

六、推断细胞通讯网路

#1.基于配体-受体水平推断细胞通讯网络
cellchat <- computeCommunProb(cellchat, raw.use = FALSE, population.size = TRUE) #如果不想用上一步PPI矫正的结果,raw.use = TRUE即可。#根据表达值推测细胞互作的概率,此步时间稍久一点儿
cellchat <- filterCommunication(cellchat, min.cells = 10)# Filter out the cell-cell communication if there are only few number of cells in certain cell groups
df.net <- subsetCommunication(cellchat)
write.csv(df.net, "net_lr.csv")
#2.基于信号通路水平推断细胞通讯网络
cellchat <- computeCommunProbPathway(cellchat)
df.netp <- subsetCommunication(cellchat, slot.name = "netP")
write.csv(df.netp, "net_pathway.csv")

七、细胞间通讯的推断结果可视化阶段:

cellchat <- aggregateNet(cellchat)#统计细胞间通信的数量(配受体对的数目)和强度(概率)
groupSize <- as.numeric(table(cellchat@idents))#计算每群细胞各有多少个

1.先总体看一下细胞间通讯的数量与强度

netVisual_circle(cellchat@net$count, vertex.weight = groupSize, weight.scale = T,
                    label.edge= F, title.name = "Number of interactions")
netVisual_circle(cellchat@net$weight, vertex.weight = groupSize, weight.scale = T,
                    label.edge= F, title.name = "Interaction weights/strength")
image2.png

2.下面展示分别以每种细胞类型作为配体信号时的通讯网络

细胞间通讯数目的推断结果:
mat <- cellchat@net$count
par(mfrow = c(2,2),xpd = TRUE)
for (i in 1:nrow(mat)) {
  mat1<- matrix(0,nrow = nrow(mat),ncol = ncol(mat),dimnames = dimnames(mat))
  mat1[i, ] <- mat[i, ]
  netVisual_circle(mat1,vertex.weight = groupSize,
                  weight.scale = T,
                  arrow.width = 2,
                  arrow.size = 0.6,
                  edge.weight.max = max(mat),
                  title.name = rownames(mat)[i])}
image3_count.png
image4_count.png
细胞间通讯强度的推断结果:
mat <- cellchat@net$weight
par(mfrow = c(2,2),xpd = T)
for (i in 1:nrow(mat)){
  mat2 <- matrix(0,nrow(mat),ncol = ncol(mat),dimnames =dimnames(mat))
  mat2[i, ] <- mat[i, ]
  netVisual_circle(mat2,
                  vertex.weight = groupSize,
                  weight.scale = T,
                  arrow.width = 2,
                  arrow.size = 0.6,
                  edge.weight.max = max(mat),
                  title.name = rownames(mat[i]))}
image5_weight.png
image6_weight.png
cellchat@netP$pathways  #查看信号通路
[1] "MIF"        "CCL"        "GALECTIN"  "IL2"        "ANNEXIN"    "LT"        "BAFF"     
[8] "FLT3"      "BTLA"      "TRAIL"      "TGFb"      "LIGHT"      "IL10"      "CSF"     
[15] "IL1"        "CD40"      "VISFATIN"  "GRN"        "IL16"      "IFN-II"    "BAG"     
[22] "PARs"      "FASLG"      "IL6"        "GAS"        "CXCL"      "COMPLEMENT" "NRG"     
[29] "PDGF"
pathways.show <- c("TGFb")  #选择感兴趣的通路,进行后续的分析

3.某个信号通路或配-受体对信号,介导的细胞间互作通讯的可视化

#下面依次展示层次图、网络图、和弦图、热图,这里虽然图不同但是获取的信息是一样的。
levels(cellchat@idents)    # show all celltype
[1] "Naive CD4 T"  "Memory CD4 T" "CD14+ Mono"  "B"            "CD8 T"        "FCGR3A+ Mono"
[7] "NK"          "DC"          "Platelet"

vertex.receiver = c(1,3,5,7)
netVisual_aggregate(cellchat, signaling = pathways.show,  vertex.receiver = vertex.receiver,layout = 'hierarchy')

par(mfrow=c(1,1))
netVisual_aggregate(cellchat, signaling = pathways.show, layout = "circle")

par(mfrow=c(1,1))
netVisual_aggregate(cellchat, signaling = pathways.show, layout = "chord")

par(mfrow=c(1,1))
netVisual_heatmap(cellchat, signaling = pathways.show, color.heatmap = "Reds")
image_hierarchy.png
image_circle.png
image_chord.png
image_heatmap.png

4.在某个信号中,其包含的所有配-受体对,对该信号通路影响的大小(贡献值),依次可以展示层次图、网络图、和弦图

pathways.show = 'CD40'#这里随意选定了'CD40'
netAnalysis_contribution(cellchat, signaling = pathways.show)
pairLR.CD40 <- extractEnrichedLR(cellchat, signaling = pathways.show, geneLR.return = FALSE) #提取对CD40有影响的所有配-受体
LR.show <- pairLR.CD40[1,] #提取对该通路影响最大的配-受体对

vertex.receiver = c(1,3,5,7)
netVisual_individual(cellchat, signaling = pathways.show,  pairLR.use = LR.show, vertex.receiver = vertex.receiver, layout = "hierarchy")
netVisual_individual(cellchat, signaling = pathways.show, pairLR.use = LR.show, layout = "circle")
netVisual_individual(cellchat, signaling = pathways.show, pairLR.use = LR.show, layout = "chord")
image_hierarchy.png
image_circle.png
image_chord.png

5.多个信号通路或配-受体对,介导的细胞间互作通讯的可视化

levels(cellchat@idents)
[1] "Naive CD4 T"  "Memory CD4 T" "CD14+ Mono"  "B"            "CD8 T"        "FCGR3A+ Mono"
[7] "NK"          "DC"          "Platelet"

#指定source细胞和target细胞,展示气泡图
p = netVisual_bubble(cellchat, sources.use = c(2,4,6,8),
                    targets.use = c(3,5,7,9), remove.isolate = FALSE)
ggsave("bubble_1.pdf", p, width = 8, height = 12)
image_bubble_1.png
#同时指定"CCL"和"TGFb"这两个信号通路
p1 = netVisual_bubble(cellchat, sources.use = c(2,4,6,8), targets.use = c(3,5,7,9),
                signaling = c("CCL","TGFb"), remove.isolate = FALSE)
ggsave("bubble_2.pdf", p1, width = 6, height = 8)
image_bubble_2.png
#挑选出细胞间互作显著的配-受体对
pairLR.use <- extractEnrichedLR(cellchat, signaling = c("CCL","GALECTIN"))
netVisual_bubble(cellchat, sources.use = c(2,4,6,8), targets.use = c(3,5,7,9),
                pairLR.use = pairLR.use, remove.isolate = TRUE)
image_bubble_3.png

6.查看某个信号通路中,其中的配-受体基因在细胞群中的表达情况

plotGeneExpression(cellchat, signaling = "CCL")#小提琴图

plotGeneExpression(cellchat, signaling = "CCL", type = "dot",color= "Reds")#点图
image_violin.png
image_dot.png

对于单个样本的cellchat方法的学习就先到这里吧,后面会再整理下多个样本(多种疾病状态)之间比较的分析处理。若有错误之处,感谢指正!😊
GitHub - sqjin/CellChat: R toolkit for inference, visualization and analysis of cell-cell communication from single-cell data

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容