流程

SC| CellChat实操

手动树立CellChat受配体数据库(1a): CellChatDB考虑了已知的配体受体复合物的组成,包含配体和受体的多聚复合物,以及几种辅助因子类型:可溶性激动剂、拮抗剂、共影响和共抑制膜结合受体。CellChatDB包含2021种已验证的L-R 对,包含60%的排泄相互效果(secreting interactions)。 此外,有48%的相互效果涉及异质分子复合物。

单细胞数据输入与预处理(1b) :CellChat将细胞的基因表达数据和细胞注释的meta信息(也能够运行无标签方式)作为输入,预处理会先在每个类群细胞中鉴定过表达的基因。

细胞通讯模型核算(1c) :CellChat对通讯概率进行建模,并辨认重要通讯。① 交叉引用配体-受体相互效果数据库;②运用质量效果定律(law of mass action)定量细胞通讯概率;③ 推断统计学和生物学上显著的细胞通讯。

细胞通讯成果可视化供给了三种方式(1d) :层次图(hierarchy plot), 圈图 (Circle plot),气泡图(bubble plot)

细胞通讯方式剖析(1e) : CellChat经过图论、方式辨认和流形学习等办法对网络进行定量丈量,从而更好地解说细胞间通讯网络。运用网络中心性剖析辨认细胞的信号人物,发现首要的细胞通讯方式,信号通路拓扑和功用相似性的分类。

SC| CellChat实操

cellchat核算的效果方式

SC| CellChat实操
cellchat能够剖析的是直接效果,旁排泄,自排泄效果(左面三种)

SC| CellChat实操

Cellchat配受体激活考虑到多种要素

SC| CellChat实操

SC| CellChat实操

CellChat database

SC| CellChat实操

1. 经过核算配受体对来核算细胞通讯强度

SC| CellChat实操

2. 经过将前面配受体对map到信号通路中,来看信号通路激活的状况,以及配受体对这种信号激活状况的效果占比

SC| CellChat实操

3. 细胞交流可视化

SC| CellChat实操

  • cellchat能够接纳不同的数据类型–包含细胞的类型,分散的数据,轨迹剖析的数据
  • 细胞品种许多的时分运用Hierarchy plot进行展现
  • 细胞品种少的时分能够运用Circle plot进行展现
  • 固定配受体类型,看他们在不同细胞类型之间的表达的话用Bubble plot
  • 4. 评估不同细胞到底扮演了什么人物,是信号宣布仍是信号接纳(细化的刻画细胞亚群的效果)

  • 细胞群怎么与信号通路联络在一起

  • 细胞内信号网络的相似性

  • 不同细胞群信号通路的共享性与独特性(流式)

SC| CellChat实操

SC| CellChat实操

library(Seurat)
library(SeuratData)
library(tidyverse)
library(CellChat)
library(NMF)
library(ggalluvial)
library(patchwork)
library(ggplot2)
library(svglite)
options(stringsAsFactors = FALSE)
###数据预备,先split找高变基因,再进行integrated,然后将每组细胞再split出来###
LoadData("immnue")
# 将数据集分组
immune_split.list <- SplitObject(immune, split.by = "orig.ident")
# 依照组标化数据并找到数据的特征分子
immune_split.list <- lapply(X = immune_split.list, FUN = function(x) {
  x <- NormalizeData(x)
  x <- FindVariableFeatures(x, selection.method = "vst", nfeatures = 2000)
})
# 挑选不同数据集重复的特征分子进行整合
features <- SelectIntegrationFeatures(object.list = immune_split.list)
immune.anchors <- FindIntegrationAnchors(object.list = immune_split.list, anchor.features = features)
immune.combined <- IntegrateData(anchorset = immune.anchors)
DefaultAssay(immune.combined) <- "integrated"#这样整合的数据只要高变基因,
saveRDS(immune.combined,"immune.combined.RDS")
# 依据需求,split数据
# immune_split.list <- subset(immune.combined, idents = c('CD14 Mono','CD4 Memory T','CD8 T','NK'))#这儿是挑选想要剖析的细胞,如果有需求的话
Idents(immune.combined) <-'orig.ident'
AA <- subset(immune.combined, idents = 'AA')
BB <- subset(immune.combined, idents = 'BB')
CC <- subset(immune.combined, idents = 'CC')
# 创立cellchat方针
AA <- createCellChat(AA@assays$RNA@data, meta = AA@meta.data, group.by = "celltype2")
BB <- createCellChat(BB@assays$RNA@data, meta = BB@meta.data, group.by = "celltype2")
CC <- createCellChat(CC@assays$RNA@data, meta = CC@meta.data, group.by = "celltype2")
save(AA, BB,CC,file = "cellchat.rda")
# 创立存放文件的文件夹
dir.create("./Compare")
setwd("./Compare")
#设置cellchart方针
AA <- setIdent(AA, ident.use = "celltype2")#cellchart方针设置Ident的办法
BB <- setIdent(BB, ident.use = "celltype2")
CC <- setIdent(CC, ident.use = "celltype2")
#树立配受体连接
cellchat <- AA
cellchat@DB <- CellChatDB.mouse
cellchat <- subsetData(cellchat) 
cellchat <- identifyOverExpressedGenes(cellchat)
cellchat <- identifyOverExpressedInteractions(cellchat)
#cellchat <- projectData(cellchat, PPI.human)
cellchat <- computeCommunProb(cellchat, raw.use = TRUE, population.size = TRUE)
#cellchat <- filterCommunication(cellchat, min.cells = 5)
df.net <- subsetCommunication(cellchat)
write.csv(df.net,'net_lr.csv') #保存配受体水平细胞通讯网络
cellchat <- computeCommunProbPathway(cellchat)
df.netp <- subsetCommunication(cellchat,slot.name='netP')
write.csv(df.netp,'net_pathway.csv') #保存信号通路水平的细胞通讯网络
cellchat <- aggregateNet(cellchat)#统计细胞之间通讯的数量和强度
cellchat <- netAnalysis_computeCentrality(cellchat, slot.name = "netP")
#cellchat <- computeNetSimilarity(cellchat, type = "functional")
#cellchat <- netEmbedding(cellchat, type = "functional")
#cellchat <- netClustering(cellchat, type = "functional")
#cellchat <- computeNetSimilarity(cellchat, type = "structural")
#cellchat <- netEmbedding(cellchat, type = "structural")
#cellchat <- netClustering(cellchat, type = "structural")
AA <- cellchat
saveRDS(AA, "AA.rds")
#兼并cellchat方针
scRNA.list <- list(AA=AA, BB=BB,CC=CC)
cellchat <- mergeCellChat(scRNA.list, add.names = names(scRNA.list), cell.prefix = TRUE)

能够看什么

1. 看总的不同细胞类群间的互作数量和强度(配受体)

groupSize <- as.numeric(table(cellchat@idents))
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")

SC| CellChat实操
SC| CellChat实操

2. 看悉数各个细胞类群的Signaling pathway状况

a 自动(批量)保存每个信号通路的互作成果

# Access all the signaling pathways showing significant communications将一切信号通路找出来
pathways.show.all <- cellchat@netP$pathways
# check the order of cell identity to set suitable vertex.receiver
levels(cellchat@idents)
vertex.receiver = c(1,2,4,6) #不画层次图就不需求这一步
dir.create("all_pathways_com_circle") #创立文件夹保存批量画图成果
setwd("all_pathways_com_circle")
for (i in 1:length(pathways.show.all)) {
      # Visualize communication network associated with both signaling pathway and individual L-R pairs
      netVisual(cellchat, signaling = pathways.show.all[i], out.format = c("pdf"),
                vertex.receiver = vertex.receiver, layout = "circle") #制作网络图
      # Compute and visualize the contribution of each ligand-receptor pair to the overall signaling pathway
      gg <- netAnalysis_contribution(cellchat, signaling = pathways.show.all[i])
      ggsave(filename=paste0(pathways.show.all[i], "_L-R_contribution.pdf"), 
             plot=gg, width = 5, height = 2.5, units = 'in', dpi = 300)
    }
    setwd("../")

b 经过heatmap看outgoing和incoming的communication probability

netAnalysis_SignalingRole_heatmap(cellchat, pattern = "outgoing")
netAnalysis_SignalingRole_heatmap(cellchat, pattern = "incoming")

SC| CellChat实操

c 经过点图看outgoing和incoming的pattern

netAnalysis_dot(cellchat, pattern = "outgoing")
netAnalysis_dot(cellchat, pattern = "incoming")

SC| CellChat实操

SC| CellChat实操

3. 看特定细胞集体之间的互作

3.1.a 经过气泡图看互作–配受体

挑选好sources.use和targets.use,展现对应细胞集体间一切互作

netVisual_bubble(cellchat, sources.use = 4, targets.use = c(5:11), remove.isolate = FALSE)

SC| CellChat实操

3.1.b 经过Signaling参数选定部分pathway中的互作-比如挑选趋化因子和趋化因子受体对或许TGF-B信号通路

netVisual_bubble(cellchat, sources.use = 4, targets.use = c(5:11), Signaling = c("CCL","CXCL"), remove.isolate = FALSE)

SC| CellChat实操

3.1.c 经过pairLR.use挑选特定互作?

pairLR.use <- extractEnrichedLR(cellchat, Signaling = c("CCL","CXCL","FGF"))
netVisual_bubble(cellchat, sources.use = c(3,4), targets.use = c(5:8), pairLR.use = pairLR.use, remove.isolate = TRUE)

SC| CellChat实操

3.2 经过弦图看互作

#targets.use能够设置为多个receiver
netVisual_chord_gene(cellchat, sources.use = 4, targets.use = c(5:11), lab.cex = 0.5,legend.pos.y = 30)
#sources.use能够设置为多个sender
netVisual_chord_gene(cellchat, sources.use = c(1,2,3,4), targets.use = 8, legend.pos.x = 15)
#参数Signaling能够用来挑选特定pathway
netVisual_chord_gene(cellchat, sources.use = c(1,2,3,4), targets.use = c(5:11), Signaling = c("CCL","CXCL"),legend.pos.x = 8)
#设置slot.name为netP使得输出为pathway而不是单一的互作
netVisual_chord_gene(cellchat, sources.use = c(1,2,3,4), targets.use = c(5:11), slot.name = "netP", legend.pos.x = 10) 

SC| CellChat实操

SC| CellChat实操

SC| CellChat实操

SC| CellChat实操

4. 看特定细胞集体作为sender与其他细胞集体的联络–总的看互作的数量或许强度,不显现配受体或许信号通路的姓名

mat <- cellchat@net$weight
par(mfrow = c(3,4), xpd=TRUE)
for (i in 1:nrow(mat)) {
 mat2 <- matrix(0, nrow = nrow(mat), ncol = ncol(mat), dimnames = dimnames(mat))
 mat2[i, ] <- mat[i, ]
 netVisual_circle(mat2, vertex.weight = groupSize, weight.scale = T, edge.weight.max = max(mat), title.name = rownames(mat)[i])
}

SC| CellChat实操

5. 看特定通路在细胞集体间的联络

pathways.show <- c("CXCL")
vertex.receiver = seq(1,4)
默许为Hierarchy plot
netVisual_aggregate(cellchat, Signaling = pathways.show, vertex.receiver = vertex.receiver)
#或许
netVisual_aggregate(cellchat, Signaling = pathways.show, layout = "circle")
#或许弦图
netVisual_aggregate(cellchat, Signaling = pathways.show, layout = "chord") 
#或许热图
netVisual_heatmap(cellchat, Signaling = pathways.show, color.heatmap = "Reds") 
#以上都能够挑选只展现特定互作
pairLR.CXCL <- extractEnrichedLR(cellchat, Signaling = pathways.show, geneLR.return = FALSE)
LR.show <- pairLR.CXCL[1,] # show one ligand-receptor pair
netVisual_individual(cellchat, Signaling = pathways.show, pairLR.use = LR.show, layout = "circle") 作者:dooooob https://www.bilibili.com/read/cv12949609 出处:bilibili

SC| CellChat实操

SC| CellChat实操

SC| CellChat实操

SC| CellChat实操

SC| CellChat实操

6. 看细胞集体在特定pathway中的人物–准确判别身份,信息函量少,但是强度巨细比较容易看,就是说,谁作为首要的Sender或许Receiver

netAnalysis_SignalingRole_network(cellchat, Signaling = “CXCL”, width = 8, height = 2.5, font.size = 10)

SC| CellChat实操

netAnalysis_contribution(cellchat, Signaling = “CXCL”)

SC| CellChat实操

7. 看pathway中相关基因的表达–细致到基因层面

plotGeneExpression(cellchat, Signaling = "CXCL")

SC| CellChat实操

上述内容是单数据集剖析,下面开端的剖析是两组剖析,多组的话添加分组,放在一起进行剖析

8. 细胞互作数量比照网络图–两组

8.1 一切细胞群整体观:通讯数量与强度比照

gg1 <- compareInteractions(cellchat, show.legend = F, group = c(1,2), measure = "count")
gg2 <- compareInteractions(cellchat, show.legend = F, group = c(1,2), measure = "weight")
p <- gg1 + gg2
ggsave("Overview_number_strength.pdf", p, width = 6, height = 4)

SC| CellChat实操

8.2 数量与强度差异网络图

par(mfrow = c(1,2))
netVisual_diffInteraction(cellchat, weight.scale = T)
netVisual_diffInteraction(cellchat, weight.scale = T, measure = "weight")
# save as Diff_number_strength_net.pdf
赤色是case相对于control上调的,蓝色是下调的。

SC| CellChat实操

8.2-1 数量与强度差异热图

par(mfrow = c(1,1))
h1 <- netVisual_heatmap(cellchat)
h2 <- netVisual_heatmap(cellchat, measure = "weight")
h1+h2
# save as Diff_number_strength_heatmap.pdf
# case和control比照,赤色是上调,蓝色是下调

SC| CellChat实操

8.3 细胞互作数量比照网络图

par(mfrow = c(1,2))
weight.max <- getMaxWeight(cco.list, attribute = c("idents","count"))
for (i in 1:length(cco.list)) {
  netVisual_circle(cco.list[[i]]@net$count, weight.scale = T, label.edge= F, 
                   edge.weight.max = weight.max[2], edge.width.max = 12, 
                   title.name = paste0("Number of interactions - ", names(cco.list)[i]))
}
# save as Counts_Compare_net.pdf
#左图是control,右图是case,能够直接比照数量变化。

SC| CellChat实操

8.4 指定细胞互作数量比照网络图

par(mfrow = c(1,2))
s.cell <- c("CD4+ T cells", "CD8+ T cells", "Monocytes")
count1 <- cco.list[[1]]@net$count[s.cell, s.cell]
count2 <- cco.list[[2]]@net$count[s.cell, s.cell]
weight.max <- max(max(count1), max(count2))
netVisual_circle(count1, weight.scale = T, label.edge= T, edge.weight.max = weight.max, edge.width.max = 12, 
                 title.name = paste0("Number of interactions-", names(cco.list)[1]))
netVisual_circle(count2, weight.scale = T, label.edge= T, edge.weight.max = weight.max, edge.width.max = 12, 
                 title.name = paste0("Number of interactions-", names(cco.list)[2]))
# save as Counts_Compare_select.pdf 10*6.5
# 赤色是case相对于control上调的,蓝色是下调的

SC| CellChat实操

9. 看表达流—举例是两组的比照

9.1 保存和特异性信号通路的辨认与可视化

gg1 <- rankNet(cellchat, mode = "comparison", stacked = T, do.stat = TRUE)
gg2 <- rankNet(cellchat, mode = "comparison", stacked = F, do.stat = TRUE)
p <- gg1 + gg2
ggsave("Compare_pathway_strengh.pdf", p, width = 10, height = 6)
#左图最下面5个信号通路是case组独有的

SC| CellChat实操

9.2 流行学习辨认差异信号通路–细胞多了用R根本跑不通

cellchat <- computeNetSimilarityPairwise(cellchat, type = "functional")
cellchat <- netEmbedding(cellchat, type = "functional")
cellchat <- netClustering(cellchat, type = "functional")
#netVisual_embeddingPairwise(cellchat, type = "functional", label.size = 3.5)
#netVisual_embeddingPairwiseZoomIn(cellchat, type = "functional", nCol = 2)
cellchat <- computeNetSimilarityPairwise(cellchat, type = "structural")
cellchat <- netEmbedding(cellchat, type = "structural")
cellchat <- netClustering(cellchat, type = "structural")
#netVisual_embeddingPairwise(cellchat, type = "structural", label.size = 3.5)
#netVisual_embeddingPairwiseZoomIn(cellchat, type = "structural", nCol = 2)
p <- rankSimilarity(cellchat, type = "structural") + ggtitle("Structural similarity of pathway")
ggsave("Pathway_Similarity.pdf", p, width = 8, height = 5)   
saveRDS(cellchat, "cellchat.rds")

SC| CellChat实操

9.3 细胞信号方式比照

library(ComplexHeatmap)
整体信号方式比照
pathway.union <- union(cco.list[[1]]@netP$pathways, cco.list[[2]]@netP$pathways)
ht1 = netAnalysis_signalingRole_heatmap(cco.list[[1]], pattern = "all", signaling = pathway.union, 
                                        title = names(cco.list)[1], width = 8, height = 10)
#pattern = "all"经过修改pattern来显现是悉数的信号,宣布的信号pattern = "outgoing",仍是承受的信号pattern = "incoming"。
ht2 = netAnalysis_signalingRole_heatmap(cco.list[[2]], pattern = "all", signaling = pathway.union,
                                        title = names(cco.list)[2], width = 8, height = 10)
draw(ht1 + ht2, ht_gap = unit(0.5, "cm"))
# save as Compare_signal_pattern_all.pdf  10*6

SC| CellChat实操

10. 特定信号通路的比照

网络图
pathways.show <- c("IL16") 
weight.max <- getMaxWeight(cco.list, slot.name = c("netP"), attribute = pathways.show) 
par(mfrow = c(1,2), xpd=TRUE)
for (i in 1:length(cco.list)) {
  netVisual_aggregate(cco.list[[i]], signaling = pathways.show, layout = "circle", 
                      edge.weight.max = weight.max[1], edge.width.max = 10, 
                      signaling.name = paste(pathways.show, names(cco.list)[i]))
}
# save as Compare_IL16_net.pdf  10*6.5
热图
par(mfrow = c(1,2), xpd=TRUE)
ht <- list()
for (i in 1:length(cco.list)) {
  ht[[i]] <- netVisual_heatmap(cco.list[[i]], signaling = pathways.show, color.heatmap = "Reds",
                               title.name = paste(pathways.show, "signaling ",names(cco.list)[i]))
}
ComplexHeatmap::draw(ht[[1]] + ht[[2]], ht_gap = unit(0.5, "cm"))
# save as Compare_IL16_heatmap.pdf  12*6.5
和弦图
par(mfrow = c(1,2), xpd=TRUE)
for (i in 1:length(cco.list)) {
  netVisual_aggregate(cco.list[[i]], signaling = pathways.show, layout = "chord", pt.title = 3, title.space = 0.05,
                      vertex.label.cex = 0.6, signaling.name = paste(pathways.show, names(cco.list)[i]))
}
# save as Compare_IL16_chord.pdf  10*6.5

SC| CellChat实操

SC| CellChat实操

11. 配体-受体比照剖析

11.1 气泡图展现一切配体受体对的差异

levels(cellchat@idents$joint)
p <- netVisual_bubble(cellchat, sources.use = c(4,5), targets.use = c(1,2,3,6),  comparison = c(1, 2), angle.x = 45)
ggsave("Compare_LR_bubble.pdf", p, width = 12, height = 8)

case和control配对的图,文章中常见。cellphoneDB找到的成果,也能够用这种办法呈现。

SC| CellChat实操

11.2 气泡图展现上调或下调的配体受体对

p1 <- netVisual_bubble(cellchat, sources.use = c(4,5), targets.use = c(1,2,3,6), comparison = c(1, 2),
                       max.dataset = 2, title.name = "Increased signaling in TIL", angle.x = 45, remove.isolate = T)
p2 <- netVisual_bubble(cellchat, sources.use = c(4,5), targets.use = c(1,2,3,6), comparison = c(1, 2), 
                       max.dataset = 1, title.name = "Decreased signaling in TIL", angle.x = 45, remove.isolate = T)
pc <- p1 + p2
ggsave("Compare_LR_regulated.pdf", pc, width = 12, height = 5.5)
上调下调分开展现
和弦图
par(mfrow = c(1, 2), xpd=TRUE)
for (i in 1:length(cco.list)) {
  netVisual_chord_gene(cco.list[[i]], sources.use = c(4,5), targets.use = c(1,2,3,6), signaling = "MHC-I", 
                       lab.cex = 0.6, legend.pos.x = 10, legend.pos.y = 20,
                       title.name = paste0("Signaling from Treg - ", names(cco.list)[i]))
}
# save as Compare_LR_chord.pdf  10*6.5

SC| CellChat实操

12. cellchat 加深了解

运用层次结构图、圆图或和弦图可视化每个信号通路

  • 层次结构图:用户应界说vertex.receiver,这是一个数字矢量,将细胞群的索引作为层次图左边的方针。此分层图由两个部分组成:左部分显现自排泄和旁排泄向某些感兴趣的细胞组(即界说的)宣布信号,右部分显现自排泄和旁排泄向数据集中剩余的细胞组宣布信号。因而,层级图供给了一种信息性和直观的办法来可视化自排泄和旁排泄信号之间的细胞群之间的感兴趣通讯。例如,在研讨成纤维细胞和免疫细胞之间的细胞-细胞通讯时,用户能够界说为一切成纤维细胞组。
  • 和弦图:CellChat 供给两种功用netVisual_chord_cell和netVisual_chord_gene,并可视化具有不同意图和不同级别的细胞通讯。netVisual_chord_cell用于可视化不同细胞群之间的细胞-细胞通讯(和弦图中的每个部分是细胞组),netVisual_chord_gene用于可视化由多个配体受体或信号通路调节的细胞-细胞通讯(和弦图中的每个部分都是配体、受体或信号通路)。
  • 边际色彩/权重、节点色彩/巨细/形状的解说:在一切可视化图中,边际色彩与发送者源一致,边际权重与交互强度成正比。较厚的边际线表明信号更强。在层次结构图和圆图中,圆的巨细与每个细胞组中的细胞数量成正比。在层次图中,实心和开放的圆分别代表源和方针。在和弦图中,内条色彩表明从相应的外条接纳信号的方针。内条巨细与方针接纳的信号强度成正比。这种内条有助于解说杂乱的和弦图。请注意,有一些内条没有与任何一些细胞组链接,请疏忽它,由于这是一个本包没有处理的问题。
  • 不同层次的细胞通讯可视化:能够运用netVisual_aggregate可视化信号通路的推断通讯网络,并运用netVisual_individual可视化与该信号通路相关的单个L-R对的推断通讯网络。

cellchat@DB <- CellChatDB.mouse

cellchat <- subsetData(cellchat)

这一步会首先需求选取在上一步挑选的interaction database中的基因,这一步并不是一般含义的subset,由于它还会将对应基因的表达矩阵赋值给cellchat@data.Signaling,所以不是可选项,而是有必要有的一步

cellchat <- identifyOverExpressedGenes(cellchat)

cellchat <- identifyOverExpressedInteractions(cellchat)

各个细胞类型过表达的基因是依据表达该基因的细胞份额,差异倍数,和p值来判定的。默许参数是,细胞份额阈值为0(thresh.pc =0),差异倍数为0(thresh.fc = 0,only.pos = TRUE),p值0.05(thresh.p = 0.05)(这儿不是校正后的p值,尽管源码中有做bonferroni矫正,但是没有用这个值做判定)。

最后过表达的基因会存于object@var.features,基因名存在方式为cellchat@var.features$feature

差异基因核算成果的表格存在方式为cellchat@var.features$features.info

然后这些过表达基因所在的互作即过表达互作。过表达互作会存于cellchat@LR$LRsig

cellchat <- computeCommunProb(cellchat)

首先核算得到每一个互作的communicationprobability(详细原理参见宣布原文),并经过permutation test得到对应互作的p值。这些成果存在于cellchat@net

这儿默许是用cellchat@data.Signaling中的表达数据做剖析,如果希望运用引入了蛋白质互作网络处理之后的数据,则加入参数raw.use = FALSE

默许运用的Ligand和Receptor是cellchat@LR$LRsig,对应参数为LR.use = NULL

可选的核算每个细胞类群基因表达均值办法有三种,”triMean”, “truncatedMean”, “median”,

默许运用的是triMean,详细实现为

triMean <- function(x, na.rm = TRUE) {mean(stats::quantile(x, probs = c(0.25, 0.50, 0.50, 0.75), na.rm = na.rm))}

truncatedMean的详细实现为

truncatedMean = function(x) mean(x, trim = trim, na.rm = TRUE)

cellchat <- computeCommunProbPathway(cellchat)

再经过求和每个pathway中一切互作的communication probability得到依据pathway的,存于cellchat@netP 。这儿默许(thresh = 0.05)不计入p值大于0.05的

cellchat <- aggregateNet(cellchat)

之后再统计细胞类型之间一切pathway的互作数量和communication probability ,这儿相同默许(thresh = 0.05)不计入p值大于0.05的

不同细胞间各种相互效果最终形成了一套通讯网络,这儿能够剖析互作过程中的不同人物,包含dominant senders, receivers, mediators and influencers。即weighted-directed network中,核算out-degree, in-degree, flow betweenesss,以及information centrality。其中,out-degree和in-degree是直接求和各个细胞类群对应outgoing Signaling和incoming Signaling的communication probabilities

cellchat <- netAnalysis_computeCentrality(cellchat, slot.name = “netP”)

首先是核算这些network centrality scores,成果会存在于cellchat@netP$centr

之后能够关注communication pattern(outgoing和incoming),得到cellchat@netP$pattern 先寻找适宜的k,即pattern数目,以outgoing为例

selectK(cellchat, pattern = “outgoing”)

SC| CellChat实操
cellchat <- identifyCommunicationPatterns(cellchat, pattern = “outgoing”, k = 3) 这儿依据上面的成果设置pattern为3,由于两种score都在4的时分下降许多

参阅: 1.# 单细胞剖析之细胞交互-3:CellChat

2.# CellChat三部曲1:运用CellChat对单个数据集进行细胞间通讯剖析

3.# CellChat三部曲2:运用CellChat 对多个数据集细胞通讯进行比较剖析

4.# CellChat 三部曲3:具有不同细胞类型成分的多个数据集的细胞通讯比较剖析