現(xiàn)在開(kāi)始學(xué)習(xí)第二個(gè)適用于單細(xì)胞轉(zhuǎn)錄組數(shù)據(jù)的細(xì)胞通訊工具:Cellchat,也是比較常用的。相較于CellphoneDB的數(shù)據(jù)庫(kù)(配體-受體+多聚體),CellChat在模擬細(xì)胞間通訊的數(shù)據(jù)庫(kù)CellChatDB又納入輔因子,看了它的數(shù)據(jù)庫(kù),相較于其他工具,它涵蓋的有關(guān)鼠的配、受體等會(huì)更多一些(可能對(duì)于小鼠的數(shù)據(jù)會(huì)更有優(yōu)勢(shì)一點(diǎn))。另外,CellChat分析也可以用于多組間的比較,例如正常與疾病條件下的比較。結(jié)果的可視化也是很豐富。下面開(kāi)始學(xué)習(xí)一下吧!
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包、數(shù)據(jù)
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")
三、創(chuàng)建CellChat對(duì)象
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)) #查看每個(gè)cluster有多少個(gè)細(xì)胞
groupSize
[1] 684 481 476 344 291 162 155 32 13
四、導(dǎo)入配體受體數(shù)據(jù)庫(kù)
CellChatDB <- CellChatDB.human #小鼠是CellChatDB.mouse
str(CellChatDB) #查看數(shù)據(jù)庫(kù)信息,包含interaction、complex、cofactor和geneInfo
colnames(CellChatDB$interaction)
CellChatDB$interaction[1:4,1:4]
head(CellChatDB$cofactor)
head(CellChatDB$complex)
head(CellChatDB$geneInfo)
showDatabaseCategory(CellChatDB)

#包括61.8%的旁分泌/自分泌信號(hào)相互作用、21.7%的細(xì)胞外基質(zhì)(ECM)-受體相互作用和16.5%的細(xì)胞-細(xì)胞接觸相互作用。48%的相互作用涉及雜聚分子復(fù)合物,52%的相互作用從最近的文獻(xiàn)中搜集的。
unique(CellChatDB$interaction$annotation)#查看可以選擇的側(cè)面,也就是上圖左中的三種
#這里選擇"Secreted Signaling"進(jìn)行后續(xù)細(xì)胞互作分析
CellChatDB.use <- subsetDB(CellChatDB, search = "Secreted Signaling") #也可默認(rèn)使用所有的
cellchat@DB <- CellChatDB.use # set the used database in the object
五、預(yù)處理
cellchat <- subsetData(cellchat)
future::plan("multicore", workers = 4)#multiprocess
cellchat <- identifyOverExpressedGenes(cellchat)#相當(dāng)于Seurat的FindMarkers,找每個(gè)細(xì)胞群中高表達(dá)的配受體基因
cellchat <- identifyOverExpressedInteractions(cellchat) #基于CellChatDB數(shù)據(jù)庫(kù),識(shí)別出過(guò)表達(dá)的配體-受體相互作對(duì)。
cellchat <- projectData(cellchat, PPI.human) #找到配體受體關(guān)系后,projectData將配體受體對(duì)的表達(dá)值投射到PPI上,來(lái)對(duì)@data.signaling中的表達(dá)值進(jìn)行校正。結(jié)果保存在@data.project
六、推斷細(xì)胞通訊網(wǎng)路
#1.基于配體-受體水平推斷細(xì)胞通訊網(wǎng)絡(luò)
cellchat <- computeCommunProb(cellchat, raw.use = FALSE, population.size = TRUE) #如果不想用上一步PPI矯正的結(jié)果,raw.use = TRUE即可。#根據(jù)表達(dá)值推測(cè)細(xì)胞互作的概率,此步時(shí)間稍久一點(diǎn)兒
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.基于信號(hào)通路水平推斷細(xì)胞通訊網(wǎng)絡(luò)
cellchat <- computeCommunProbPathway(cellchat)
df.netp <- subsetCommunication(cellchat, slot.name = "netP")
write.csv(df.netp, "net_pathway.csv")
七、細(xì)胞間通訊的推斷結(jié)果可視化階段:
cellchat <- aggregateNet(cellchat)#統(tǒng)計(jì)細(xì)胞間通信的數(shù)量(配受體對(duì)的數(shù)目)和強(qiáng)度(概率)
groupSize <- as.numeric(table(cellchat@idents))#計(jì)算每群細(xì)胞各有多少個(gè)
1.先總體看一下細(xì)胞間通訊的數(shù)量與強(qiáng)度
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")

2.下面展示分別以每種細(xì)胞類(lèi)型作為配體信號(hào)時(shí)的通訊網(wǎng)絡(luò)
細(xì)胞間通訊數(shù)目的推斷結(jié)果:
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])}


細(xì)胞間通訊強(qiáng)度的推斷結(jié)果:
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]))}


cellchat@netP$pathways #查看信號(hào)通路
[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") #選擇感興趣的通路,進(jìn)行后續(xù)的分析
3.某個(gè)信號(hào)通路或配-受體對(duì)信號(hào),介導(dǎo)的細(xì)胞間互作通訊的可視化
#下面依次展示層次圖、網(wǎng)絡(luò)圖、和弦圖、熱圖,這里雖然圖不同但是獲取的信息是一樣的。
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")




4.在某個(gè)信號(hào)中,其包含的所有配-受體對(duì),對(duì)該信號(hào)通路影響的大小(貢獻(xiàn)值),依次可以展示層次圖、網(wǎng)絡(luò)圖、和弦圖
pathways.show = 'CD40'#這里隨意選定了'CD40'
netAnalysis_contribution(cellchat, signaling = pathways.show)
pairLR.CD40 <- extractEnrichedLR(cellchat, signaling = pathways.show, geneLR.return = FALSE) #提取對(duì)CD40有影響的所有配-受體
LR.show <- pairLR.CD40[1,] #提取對(duì)該通路影響最大的配-受體對(duì)
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")



5.多個(gè)信號(hào)通路或配-受體對(duì),介導(dǎo)的細(xì)胞間互作通訊的可視化
levels(cellchat@idents)
[1] "Naive CD4 T" "Memory CD4 T" "CD14+ Mono" "B" "CD8 T" "FCGR3A+ Mono"
[7] "NK" "DC" "Platelet"
#指定source細(xì)胞和target細(xì)胞,展示氣泡圖
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)

#同時(shí)指定"CCL"和"TGFb"這兩個(gè)信號(hào)通路
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)

#挑選出細(xì)胞間互作顯著的配-受體對(duì)
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)

6.查看某個(gè)信號(hào)通路中,其中的配-受體基因在細(xì)胞群中的表達(dá)情況
plotGeneExpression(cellchat, signaling = "CCL")#小提琴圖
plotGeneExpression(cellchat, signaling = "CCL", type = "dot",color= "Reds")#點(diǎn)圖


對(duì)于單個(gè)樣本的cellchat方法的學(xué)習(xí)就先到這里吧,后面會(huì)再整理下多個(gè)樣本(多種疾病狀態(tài))之間比較的分析處理。若有錯(cuò)誤之處,感謝指正!??
GitHub - sqjin/CellChat: R toolkit for inference, visualization and analysis of cell-cell communication from single-cell data