CellChat细胞通讯分析

写在前面的话:关于细胞通讯的工具有很多,cellchat只是其中一个。网上关于CellChat的解读也很多,我在学习的时候也参考了一些,具体参考列表我都在文中标注了哈。这里只是我在学习细胞通讯和CellChat过程中的学习笔记整理,如果能够对大家有一些帮助就再好不过啦。
CellChat细胞通讯分析-图片1

Cell Chat整体分析流程(图片来源:https://www.jianshu.com/p/b3d26ac51c5a)

单个数据集的细胞通讯分析

测试流程:我们就用CellChat来分析一下我们的PBMC数据(有些可视化结果我认为不是特备重要,所以没有实际跑,这里展示就使用教程3中原图代替),看看配受体分析的一般流程。

加载包

  1. # library packages
  2. library(Seurat)
  3. library(dplyr)
  4. library(SeuratData)
  5. library(patchwork) #最强大的拼图包
  6. library(ggplot2)
  7. library(CellChat)
  8. library(ggalluvial)
  9. library(svglite)
  10.  
  11. rm(list=ls()) #清空所有变量
  12. options(stringsAsFactors = F) #输入数据不自动转换成因子(防止数据格式错误)
  13.  
  14. getwd()

Part Ⅰ:数据输入&处理、生成CellChat对象

CellChat需要两个输入:

  • 一个是细胞的基因表达数据,
  • 另一个是细胞标签(即细胞标签)。

对于基因表达数据矩阵,基因应该在带有行名的行中,cell应该在带有名称的列中。CellChat分析的输入是均一化的数据(Seurat@assay$RNA@data)。如果用户提供counts数据,可以用normalizeData函数来均一化。对于细胞的信息,需要一个带有rownames的数据格式作为CellChat的输入。

1.1 加载数据

  1. #我们用Seurat给出的pbmc3k.final数据集,大部分的计算已经存在其对象中了:
  2. data_obj <- readRDS("../data/published_data/pbmc3k_final.rds")
  3.  
  4. DimPlot(data_obj, reduction = "umap")
  5. data_obj$cell_annotations <- Idents(data_obj) # 设置注释slot
  6. data_obj
  7. # An object of class Seurat
  8. # 13714 features across 2638 samples within 1 assay
  9. # Active assay: RNA (13714 features, 2000 variable features)
  10. # 3 dimensional reductions calculated: pca, umap, tsne
  11.  
  12. pbmc3k.final@commands$FindClusters # 你也看一看作者的其他命令,Seurat是记录其分析过程的。
  13.  
  14. ![image.png](https://cdn.nlark.com/yuque/0/2022/png/1783723/1653893194984-fd07f6ae-e95a-4982-a3a2-7c19e6badee4.png#clientId=u23c19154-070b-4&crop=0&crop=0&crop=1&crop=1&from=paste&height=675&id=u5519d391&margin=%5Bobject%20Object%5D&name=image.png&originHeight=675&originWidth=1094&originalType=binary&ratio=1&rotation=0&showTitle=false&size=153190&status=done&style=none&taskId=ua8f97f6e-c492-4594-80f1-875853046e9&title=&width=1094)
  15. ### 1.2 创建CellChat对象
  16. ### 1.3 设置受配体库
  17. ```r
  18. CellChatDB <- CellChatDB.human
  19. colnames(CellChatDB$interaction) # 查看一下数据库信息
  20.  
  21. # 查看数据库具体信息
  22. CellChatDB$interaction[1:4,1:4]
  23. head(CellChatDB$cofactor)
  24. head(CellChatDB$complex)
  25. head(CellChatDB$geneInfo)

CellChat细胞通讯分析-图片2

人类中的CellChatDB包含1,939个经过验证的分子相互作用,包括61.8%的旁分泌/自分泌信号相互作用,21.7%的细胞外基质(ECM) - 受体受体相互作用和16.5%的细胞细胞接触相互作用。

CellChatDB记录了许多许多受配体相关的通路信息,不像有的配受体库只有一个基因对。这样,我们就可以更加扎实地把脚落到pathway上面了。在CellChat中,我们还可以先择特定的信息描述细胞间的相互作者,这个可以理解为从特定的侧面来刻画细胞间相互作用, 比用一个大的配体库又精细了许多呢。

  1. # 可以选择的子数据库,用于分析细胞间相互作用
  2. unique(CellChatDB$interaction$annotation)
  3. # [1] "Secreted Signaling" "ECM-Receptor" "Cell-Cell Contact"
  4.  
  5. CellChatDB.use <- subsetDB(CellChatDB, search = "Secreted Signaling")
  6. # use Secreted Signaling for cell-cell communication analysis
  7.  
  8. # Show the structure of the database
  9. dplyr::glimpse(CellChatDB$interaction)llchat@DB <- CellChatDB.use
  10. # set the used database in the object

1.2 预处理表达数据,为细胞通讯分析做准备

  1. cellchat <- subsetData(cellchat) # subset the expression data of signaling genes for saving computation cost
  2. future::plan("multiprocess", workers = 4) # do parallel (可以不设置这一步)
  3. cellchat <- identifyOverExpressedGenes(cellchat) # 相当于suerat中的FindAllMarkers
  4. cellchat <- identifyOverExpressedInteractions(cellchat)
  5. cellchat <- projectData(cellchat, PPI.human) #储存上一步的结果到cellchat@LR$LRsig

Part Ⅱ:推断配体-受体细胞通讯网络

推断出的配体-受体对的数量取决于计算每个细胞类群平均基因表达的方法。CellChat默认使用的方法是“trimean”,这种方法产生的交互通讯数量较少的,但是有助于我们发现更显著的通讯信息。

2.1 计算通信概率,并推断信号网络

  1. cellchat <- computeCommunProb(cellchat) #注意这个函数如果你可以用就用,这个是作者的。
  2. # mycomputeCommunProb <-edit(computeCommunProb) # computeCommunProb内部似乎有一些bug,同一套数据在window10上没事,到了Linux上有报错。发现是computeExpr_antagonist这个函数有问题,(matrix(1, nrow = 1, ncol = length((group)))),中应为(matrix(1, nrow = 1, ncol = length(unique(group))))? 不然矩阵返回的不对。de了它。
  3. # environment(mycomputeCommunProb) <- environment(computeCommunProb)
  4. #cellchat <- mycomputeCommunProb(cellchat) # 这儿是de过的。
  5. cellchat <- filterCommunication(cellchat, min.cells = 10)
  6.  
  7.  
  8. # 可以将推断的结果提取出来
  9. df.net <- subsetCommunication(cellchat)
  10. df.net <- subsetCommunication(cellchat, sources.use = c(1,2), targets.use = c(4,5))#给出从小区组 1 2 到小区组 4 5 的推断小区间通信。
  11. df.net <- subsetCommunication(cellchat, signaling = c("WNT", "TGFb"))#给出了由信号传导 WNT TGFb 介导的细胞间通讯。
  12. write.csv(df.net, "../output/6_cell_communication/test_cellchat_lr.csv",quote = F,sep = ',')

2.2 计算信号通路水平上的细胞间通讯

CellChat通过汇总与每个信号通路相关的所有配体-受体相互作用的通信概率来计算信号通路水平的通信概率。 注意:推断的每个受配体和么沟通信号通路的细胞通讯网络分别存储在slot "net和“netP”中。

  1. cellchat <- computeCommunProbPathway(cellchat)

2.3 计算聚合的细胞间通讯网络

我们可以通过计算链路的数量或汇总通信概率来计算聚合的细胞通信网络。用户还可以通过设置 sources.use

和 targets.use来计算细胞组子集之间的聚合网络``。cellchat <- aggregateNet(cellchat) 我们还可以可视化聚合的细胞间通信网络。例如,使用circle plot显示任意两个细胞组之间的交互次数或总交互强度(权重)。

  1. groupSize <- as.numeric(table(cellchat@idents))
  2. par(mfrow = c(1,2), xpd=TRUE)
  3. netVisual_circle(cellchat@net$count, vertex.weight = groupSize, weight.scale = T, label.edge= F, title.name = "Number of interactions")
  4. netVisual_circle(cellchat@net$weight, vertex.weight = groupSize, weight.scale = T, label.edge= F, title.name = "Interaction weights/strength")

CellChat细胞通讯分析-图片3

由于细胞间通信网络复杂,我们可以查看各类细胞发出的信号。在这里,我们还控制参数 edge.weight.max

,以便我们可以比较不同网络之间的边缘权重

  1. # 检查每种细胞发出的信号 (每种细胞和其他细胞的互作情况)
  2. mat <- cellchat@net$count
  3. par(mfrow =c(3,3),xpd=T)
  4.  
  5. for (i in 1:nrow(mat)){
  6. mat2 <- matrix(0,nrow = nrow(mat),ncol = ncol(mat),dimnames = dimnames(mat))
  7. mat2[i,] <- mat[i,]
  8. netVisual_circle(mat2,vertex.weight = groupSize, weight.scale = T, arrow.width = 0.2,
  9. arrow.size = 0.1, edge.weight.max = max(mat),title.name = rownames(mat)[i])
  10. }

CellChat细胞通讯分析-图片4

Part Ⅲ:细胞间通讯网络的可视化

在推断出细胞间通信网络后,CellChat 为进一步的数据探索、分析和可视化提供了各种功能。

  • CellChat 提供了几种可视化细胞间通信网络的方法,包括层次图、圆图、弦图和气泡图。
  • CellChat 提供了一个易于使用的工具,用于提取和可视化推断网络的高阶信息。例如,它可以方便地预测细胞群的主要信号输入和输出,以及这些群和信号如何协调在一起以实现功能。
  • CellChat 可以通过结合社交网络分析、模式识别和流形学习方法,使用集成方法对推断的细胞-细胞通信网络进行定量表征和比较。

3.1 使用层次图、圈图或弦图可视化每个信号通路

  1. # 选择其中一个信号,比如说TGFb
  2. pathways.show <- c("TGFb")

层次图 用户应定义vertex.receiver,这是一个数值向量,将细胞的索引作为层次图左侧的目标(Target)。该分层图由两个部分组成:左侧部分显示对某些感兴趣的细胞(即定义的vertex.receiver)的自分泌和旁分泌信号,右侧部分显示对数据集中剩余细胞的自分泌和旁分泌信号,在层次图中,实心圆和空心圆分别代表源和目标。。因此,层次图提供了一种信息丰富且直观的方式来可视化感兴趣的细胞群之间的自分泌和旁分泌信号通信。例如,在研究成纤维细胞和免疫细胞之间的细胞间通讯时,可以定义vertex.receiver为所有成纤维细胞群。

  1. # Hierarchy plot
  2. # Here we define `vertex.receive` so that the left portion of the hierarchy plot shows signaling to fibroblast and the right portion shows signaling to immune cells
  3. vertex.receiver = seq(1,2,4,6) # a numeric vector.
  4. netVisual_aggregate(cellchat, signaling = pathways.show, vertex.receiver = vertex.receiver)

CellChat细胞通讯分析-图片5

圈图 边缘颜色与信号发出源一致,边缘权重与交互强度成正比。较粗的边缘线表示较强的信号。在Hierarchy plot 和 Circle plot中,圆圈大小与每个细胞类群中的细胞数成正比。

  1. # Circle plot
  2. par(mfrow=c(1,1))
  3. netVisual_aggregate(cellchat, signaling = pathways.show, layout = "circle")

CellChat细胞通讯分析-图片6

和弦图 CellChatt提供两种功能netVisual_chord_cell, netVisual_chord_gene用于可视化具有不同目的和不同级别的细胞间通信。netVisual_chord_cell 用于可视化不同细胞群间细胞与细胞通讯(和弦图每个扇区都是一个细胞类群),net_Visual_chord_gene用于可视化由多个配受体或信号通路介导的细胞通讯

  1. # Chord diagram
  2. par(mfrow=c(1,1))
  3. netVisual_aggregate(cellchat, signaling = pathways.show, layout = "chord")

CellChat细胞通讯分析-图片7

对于和弦图,CellChat 有一个独立的功能netVisual_chord_cell,可以通过调整circlize包中的不同参数来灵活地可视化信令网络。例如,我们可以定义一个命名的字符向量 group 来创建多组和弦图,例如,将细胞簇分组为不同的细胞类型。

  1. # Chord diagram
  2. group.cellType <- c(rep("FIB", 4), rep("DC", 4), rep("TC", 4)) # grouping cell clusters into fibroblast, DC and TC cells
  3. names(group.cellType) <- levels(cellchat@idents)
  4. netVisual_chord_cell(cellchat, signaling = pathways.show, group = group.cellType, title.name = paste0(pathways.show, " signaling network"))
  5. #> Plot the aggregated cell-cell communication network at the signaling pathway level

CellChat细胞通讯分析-图片8

热图

  1. # Heatmap
  2. par(mfrow=c(1,1))
  3. netVisual_heatmap(cellchat, signaling = pathways.show, color.heatmap = "Reds")
  4. #> Do heatmap based on a single object

CellChat细胞通讯分析-图片9

3.2 计算受配体对整个信号通路的贡献,并可视化单个配体-受体对介导的细胞-细胞通讯

  1. netAnalysis_contribution(cellchat, signaling = pathways.show)

CellChat细胞通讯分析-图片10

我们还可以可视化由单个配体-受体对介导的细胞间通讯。我们提供了一个函数extractEnrichedLR

来提取给定信号通路的所有重要相互作用(LR 对)和相关信号基因。

  1. pairLR.TGFb <- extractEnrichedLR(cellchat, signaling = pathways.show, geneLR.return = FALSE)
  2. LR.show <- pairLR.TGFb[1,] # show one ligand-receptor pair
  3. # Hierarchy plot
  4. vertex.receiver = seq(1,2,4,6) # a numeric vector
  5. netVisual_individual(cellchat, signaling = pathways.show, pairLR.use = LR.show, vertex.receiver = vertex.receiver)
  6. #> [[1]]
  7. # Circle plot
  8. netVisual_individual(cellchat, signaling = pathways.show, pairLR.use = LR.show, layout = "circle")

CellChat细胞通讯分析-图片11

  1. # Chord diagram
  2. netVisual_individual(cellchat, signaling = pathways.show, pairLR.use = LR.show, layout = "chord")

3.3 自动保存所有推断网络图以便快速探索

在实际使用中,用户可以使用'for ...循环'自动保存所有推断的网络,以便快速探索使用netVisual。

netVisual支持 svg、png和 pdf格式的输出。

  1. # Access all the signaling pathways showing significant communications
  2. pathways.show.all <- cellchat@netP$pathways
  3. # check the order of cell identity to set suitable vertex.receiver
  4. levels(cellchat@idents)
  5. vertex.receiver = seq(1,2,4,6)
  6. for (i in 1:length(pathways.show.all)) {
  7. # Visualize communication network associated with both signaling pathway and individual L-R pairs
  8. netVisual(cellchat, signaling = pathways.show.all[i], vertex.receiver = vertex.receiver, layout = "hierarchy")
  9. # Compute and visualize the contribution of each ligand-receptor pair to the overall signaling pathway
  10. gg <- netAnalysis_contribution(cellchat, signaling = pathways.show.all[i])
  11. ggsave(filename=paste0(pathways.show.all[i], "_L-R_contribution.pdf"), plot=gg, width = 3, height = 2, units = 'in', dpi = 300)
  12. }

3.4 可视化由多个受配体或信号通路介导的细胞间通讯

气泡图

  1. # 气泡图(全部配体-受体)
  2.  
  3. levels(cellcaht@idents)
  4. # show all the significant interactions (L-R pairs)
  5.  
  6. # 需要制定受体细胞核配体细胞
  7. p=netVisual_bubble(cellchat, sources.use = c(3,5,7,8,9),
  8. targets.use = c(1,2,4,6),remove.isolate = FALSE)
  9. p

CellChat细胞通讯分析-图片12

  1. #比如指定CCL和CXCL这两个信号通路
  2. netVisual_bubble(cellchat,sources.use = c(3,5,7,8,9),targets.use = c(1,2,4,6),
  3. signaling = c("CCL","CXCL"),remove.isolate = F)

CellChat细胞通讯分析-图片13

和弦图可视化细胞类群与通讯通路之间的关系 CellChat 与 Bubble plot 类似,提供了netVisual_chord_gene

绘制 Chord 图的功能

  • 显示从某些细胞群到其他细胞群的所有相互作用(LR 对或信号通路)。两种特殊情况:一种是显示从一个细胞组发送的所有交互,另一种是显示一个细胞组接收到的所有交互。
  • 显示用户输入的交互或用户定义的某些信号通路
  1. # show all the significant interactions (L-R pairs) from some cell groups (defined by 'sources.use') to other cell groups (defined by 'targets.use')
  2. # show all the interactions sending from Inflam.FIB
  3. netVisual_chord_gene(cellchat, sources.use = 4, targets.use = c(5:11), lab.cex = 0.5,legend.pos.y = 30)

CellChat细胞通讯分析-图片14

  1. # show all the interactions received by Inflam.DC
  2. netVisual_chord_gene(cellchat, sources.use = c(1,2,3,4), targets.use = 8, legend.pos.x = 15)

CellChat细胞通讯分析-图片15

  1. # show all the significant interactions (L-R pairs) associated with certain signaling pathways
  2. netVisual_chord_gene(cellchat, sources.use = c(1,2,3,4), targets.use = c(5:11), signaling = c("CCL","CXCL"),legend.pos.x = 8)

CellChat细胞通讯分析-图片16

  1. # show all the significant signaling pathways from some cell groups (defined by 'sources.use') to other cell groups (defined by 'targets.use')
  2. netVisual_chord_gene(cellchat, sources.use = c(1,2,3,4), targets.use = c(5:11), slot.name = "netP", legend.pos.x = 10)

CellChat细胞通讯分析-图片17

3.5 使用小提琴/点图绘制信号基因表达分布

我们可以使用 Seurat 包装函数绘制与 LR 对或信号通路相关的信号基因的基因表达分布plotGeneExpression。

  1. plotGeneExpression(cellchat, signaling = "CXCL")
  2. #> Registered S3 method overwritten by 'spatstat.geom':
  3. #> method from
  4. #> print.boxx cli
  5. #> Scale for 'y' is already present. Adding another scale for 'y', which will
  6. #> replace the existing scale.
  7. #> Scale for 'y' is already present. Adding another scale for 'y', which will
  8. #> replace the existing scale.
  9. #> Scale for 'y' is already present. Adding another scale for 'y', which will
  10. #> replace the existing scale.

CellChat细胞通讯分析-图片18

默认情况下,plotGeneExpression仅显示与推断的重要通信相关的信号基因的表达。用户可以通过以下方式显示与一个信号通路相关的所有信号基因的表达。

  1. plotGeneExpression(cellchat, signaling = "CXCL", enriched.only = FALSE)

Part Ⅳ:通讯网络系统分析

为了便于解释复杂的细胞间通信网络,CellChat 通过从图论、模式识别和流形学习中抽象出来的方法对网络进行定量测量。

  • CellChat可以使用网络分析中的中心性度量来确定给定信号网络内的主要信号源和目标以及中介和影响者
  • CellChat可以利用模式识别方法预测特定细胞类型的关键传入和传出信号以及不同细胞类型之间的协调反应。
  • CellChat可以通过定义相似性度量并从功能和拓扑角度执行多种学习来对信号通路进行分组。
  • CellChat可以通过多个网络的联合流形学习来描绘保守的和特定于上下文的信号通路。

4.1 计算和可视化网络中心性评分

  1. # Compute the network centrality scores
  2. cellchat <- netAnalysis_computeCentrality(cellchat, slot.name = "netP") # the slot 'netP' means the inferred intercellular communication network of signaling pathways
  3. # Visualize the computed centrality scores using heatmap, allowing ready identification of major signaling roles of cell groups
  4. netAnalysis_signalingRole_network(cellchat, signaling = pathways.show, width = 8, height = 2.5, font.size = 10)

CellChat细胞通讯分析-图片19

4.2 在二维空间中可视化主要的发送者(源)和接收者(目标)

我们还提供了另一种直观的方法,使用散点图在 2D 空间中可视化主要的发送者(源)和接收者(目标)。

  1. # Signaling role analysis on the aggregated cell-cell communication network from all signaling pathways
  2. gg1 <- netAnalysis_signalingRole_scatter(cellchat)
  3. #> Signaling role analysis on the aggregated cell-cell communication network from all signaling pathways
  4. # Signaling role analysis on the cell-cell communication networks of interest
  5. gg2 <- netAnalysis_signalingRole_scatter(cellchat, signaling = c("CXCL", "CCL"))
  6. #> Signaling role analysis on the cell-cell communication network from user's input
  7. gg1 gg2

CellChat细胞通讯分析-图片20

4.3 识别对某些细胞类群的输出和输入信号贡献最大的信号

CellChat还可以回答哪些信号对某些细胞组的传出或传入信号贡献最大的问题。

  1. # Signaling role analysis on the aggregated cell-cell communication network from all signaling pathways
  2. ht1 <- netAnalysis_signalingRole_heatmap(cellchat, pattern = "outgoing")
  3. ht2 <- netAnalysis_signalingRole_heatmap(cellchat, pattern = "incoming")
  4. ht1 ht2

CellChat细胞通讯分析-图片21

  1. # Signaling role analysis on the cell-cell communication networks of interest
  2. ht <- netAnalysis_signalingRole_heatmap(cellchat, signaling = c("CXCL", "CCL"))

4.4 识别全局通讯模式,探索多种细胞类型和信号通路如何协同工作

除了探索单个通路的详细通信之外,一个重要的问题是多个细胞群和信号通路如何协调发挥作用。CellChat 采用模式识别方法来识别全局通信模式。 识别和可视化分泌细胞的传出通信模式 (pattern) 传出模式揭示了发送细胞(即作为信号源的细胞)如何相互协调,以及它们如何与某些信号通路协调以驱动通信。

  1. #加载通信模式分析所需的包
  2. library(NMF)
  3. #> Loading required package: pkgmaker
  4. #> Loading required package: registry
  5. #> Loading required package: rngtools
  6. #> Loading required package: cluster
  7. #> NMF - BioConductor layer [OK] | Shared memory capabilities [NO: bigmemory] | Cores 15/16
  8. #> To enable shared memory capabilities, try: install.extras('
  9. #> NMF
  10. #> ')
  11. #>
  12. #> Attaching package: 'NMF'
  13. #> The following objects are masked from 'package:igraph':
  14. #>
  15. #> algorithm, compare
  16. library(ggalluvial)

CellChat细胞通讯分析-图片22

在这里,我们运行selectK以推断模式的数量。

  1. #创建Cellchat 对象
  2. cellchat <- createCellChat(object = data_obj@assays$RNA@data, meta = data_obj@meta.data, group.by = "cell_annotations" )
  3. cellchat
  4.  
  5. # An object of class CellChat created from a single dataset
  6. # 13714 genes.
  7. # 2638 cells.

当输出模式的数量为 3 时,Cophenetic 和 Silhouette 值都开始突然下降。

  1. nPatterns = 3
  2. cellchat <- identifyCommunicationPatterns(cellchat, pattern = "outgoing", k = nPatterns)

CellChat细胞通讯分析-图片23

  1. # river plot
  2. netAnalysis_river(cellchat, pattern = "outgoing")
  3. #> Please make sure you have load `library(ggalluvial)` when running this function

CellChat细胞通讯分析-图片24

  1. # dot plot
  2. netAnalysis_dot(cellchat, pattern = "outgoing")

识别和可视化目标细胞的传入通信模式

输入模式显示目标细胞(即作为信号接收器的细胞)如何相互协调,以及它们如何与某些信号通路协调以响应输入信号。selectK(cellchat, pattern = "incoming")当传入模式的数量为 4 时,相关值开始下降。

CellChat细胞通讯分析-图片25

后续同outgoing, 只需要把参数patten 改为 =“incoming”

4.5 信号网络的流行和分类学习分析

CellChat可以量化所有重要悉尼号通路之间的相似性,然后根据她们的通讯网络相似性对她们进行分组。可以根据功能或结构相似性进行分组。(一般功能相似性比较靠谱) 根据功能相似性识别信号组

  1. cellchat <- computeNetSimilarity(cellchat, type = "functional")
  2. cellchat <- netEmbedding(cellchat, type = "functional")
  3. #> Manifold learning of the signaling networks for a single dataset
  4. cellchat <- netClustering(cellchat, type = "functional")
  5. #> Classification learning of the signaling networks for a single dataset
  6. # Visualization in 2D-space
  7. netVisual_embedding(cellchat, type = "functional", label.size = 3.5)
  8.  
  9. # netVisual_embeddingZoomIn(cellchat, type = "functional", nCol = 2)

CellChat细胞通讯分析-图片26

4.6 根据结构相似性识别信号组

  1. cellchat <- computeNetSimilarity(cellchat, type = "structural")
  2. cellchat <- netEmbedding(cellchat, type = "structural")
  3. #> Manifold learning of the signaling networks for a single dataset
  4. cellchat <- netClustering(cellchat, type = "structural")
  5. #> Classification learning of the signaling networks for a single dataset
  6. # Visualization in 2D-space
  7. netVisual_embedding(cellchat, type = "structural", label.size = 3.5)
  1. netVisual_embeddingZoomIn(cellchat, type = "structural", nCol = 2)

Part Ⅴ:保存CellChat对象

  1. saveRDS(cellchat, file = "cellchat_humanSkin_LS.rds")
  2.  
  3. sessionInfo()
  4. #> R version 4.1.2 (2021-11-01)
  5. #> Platform: x86_64-apple-darwin17.0 (64-bit)
  6. #> Running under: macOS Big Sur 10.16
  7. #>
  8. #> Matrix products: default
  9. #> BLAS: /Library/Frameworks/R.framework/Versions/4.1/Resources/lib/libRblas.0.dylib
  10. #> LAPACK: /Library/Frameworks/R.framework/Versions/4.1/Resources/lib/libRlapack.dylib
  11. #>
  12. #> locale:
  13. #> [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
  14. #>
  15. #> attached base packages:
  16. #> [1] parallel stats graphics grDevices utils datasets methods
  17. #> [8] base
  18. #>
  19. #> other attached packages:
  20. #> [1] doParallel_1.0.16 iterators_1.0.13 foreach_1.5.1
  21. #> [4] ggalluvial_0.12.3 NMF_0.23.0 cluster_2.1.2
  22. #> [7] rngtools_1.5.2 pkgmaker_0.32.2 registry_0.5-1
  23. #> [10] patchwork_1.1.1 CellChat_1.4.0 Biobase_2.54.0
  24. #> [13] BiocGenerics_0.40.0 ggplot2_3.3.5 igraph_1.2.10
  25. #> [16] dplyr_1.0.7
  26. #>
  27. #> loaded via a namespace (and not attached):
  28. #> [1] backports_1.4.1 circlize_0.4.13 systemfonts_1.0.2
  29. #> [4] plyr_1.8.6 lazyeval_0.2.2 splines_4.1.2
  30. #> [7] listenv_0.8.0 scattermore_0.7 gridBase_0.4-7
  31. #> [10] digest_0.6.29 htmltools_0.5.2 fansi_0.5.0
  32. #> [13] magrittr_2.0.1 tensor_1.5 ROCR_1.0-11
  33. #> [16] sna_2.6 ComplexHeatmap_2.10.0 globals_0.14.0
  34. #> [19] matrixStats_0.61.0 svglite_2.0.0 spatstat.sparse_2.1-0
  35. #> [22] colorspace_2.0-2 ggrepel_0.9.1 xfun_0.29
  36. #> [25] crayon_1.4.2 jsonlite_1.7.2 spatstat.data_2.1-2
  37. #> [28] survival_3.2-13 zoo_1.8-9 glue_1.6.0
  38. #> [31] polyclip_1.10-0 gtable_0.3.0 leiden_0.3.9
  39. #> [34] GetoptLong_1.0.5 car_3.0-12 future.apply_1.8.1
  40. #> [37] shape_1.4.6 abind_1.4-5 scales_1.1.1
  41. #> [40] DBI_1.1.2 rstatix_0.7.0 miniUI_0.1.1.1
  42. #> [43] Rcpp_1.0.7 viridisLite_0.4.0 xtable_1.8-4
  43. #> [46] clue_0.3-60 spatstat.core_2.3-2 reticulate_1.22
  44. #> [49] stats4_4.1.2 htmlwidgets_1.5.4 httr_1.4.2
  45. #> [52] FNN_1.1.3 RColorBrewer_1.1-2 ellipsis_0.3.2
  46. #> [55] Seurat_4.0.6 ica_1.0-2 pkgconfig_2.0.3
  47. #> [58] farver_2.1.0 uwot_0.1.11 deldir_1.0-6
  48. #> [61] sass_0.4.0 here_1.0.1 utf8_1.2.2
  49. #> [64] later_1.3.0 tidyselect_1.1.1 labeling_0.4.2
  50. #> [67] rlang_0.4.12 reshape2_1.4.4 munsell_0.5.0
  51. #> [70] tools_4.1.2 cli_3.1.0 generics_0.1.1
  52. #> [73] statnet.common_4.5.0 broom_0.7.10 ggridges_0.5.3
  53. #> [76] evaluate_0.14 stringr_1.4.0 fastmap_1.1.0
  54. #> [79] goftest_1.2-3 yaml_2.2.1 knitr_1.37
  55. #> [82] fitdistrplus_1.1-6 purrr_0.3.4 RANN_2.6.1
  56. #> [85] nlme_3.1-153 pbapply_1.5-0 future_1.23.0
  57. #> [88] mime_0.12 compiler_4.1.2 rstudioapi_0.13
  58. #> [91] plotly_4.10.0 png_0.1-7 ggsignif_0.6.3
  59. #> [94] spatstat.utils_2.3-0 tibble_3.1.6 bslib_0.3.1
  60. #> [97] stringi_1.7.6 highr_0.9 RSpectra_0.16-0
  61. #> [100] forcats_0.5.1 lattice_0.20-45 Matrix_1.3-4
  62. #> [103] vctrs_0.3.8 pillar_1.6.4 lifecycle_1.0.1
  63. #> [106] spatstat.geom_2.3-1 lmtest_0.9-39 jquerylib_0.1.4
  64. #> [109] GlobalOptions_0.1.2 RcppAnnoy_0.0.19 data.table_1.14.2
  65. #> [112] cowplot_1.1.1 irlba_2.3.5 httpuv_1.6.4
  66. #> [115] R6_2.5.1 promises_1.2.0.1 network_1.17.1
  67. #> [118] gridExtra_2.3 KernSmooth_2.23-20 IRanges_2.28.0
  68. #> [121] parallelly_1.30.0 codetools_0.2-18 MASS_7.3-54
  69. #> [124] assertthat_0.2.1 rprojroot_2.0.2 rjson_0.2.20
  70. #> [127] withr_2.4.3 SeuratObject_4.0.4 sctransform_0.3.2
  71. #> [130] S4Vectors_0.32.3 mgcv_1.8-38 rpart_4.1-15
  72. #> [133] grid_4.1.2 tidyr_1.1.4 coda_0.19-4
  73. #> [136] rmarkdown_2.11 carData_3.0-4 Rtsne_0.15
  74. #> [139] ggpubr_0.4.0 shiny_1.7.1

发表评论

匿名网友

拖动滑块以完成验证
加载失败