CellChat 三部曲2:使用CellChat 對多個數(shù)據(jù)集細(xì)胞通訊進(jìn)行比較分析
- 加載所需的包
- 創(chuàng)建目錄以保存圖片
- 加載每個數(shù)據(jù)集的CellChat對象庭猩,然后合并在一起
- 第一部分:預(yù)測細(xì)胞通信的一般原理
- 比較交互總數(shù)和交互強(qiáng)度
- 比較不同細(xì)胞群之間的相互作用數(shù)量和相互作用強(qiáng)度
- 比較 2D 空間中的主要來源和目標(biāo)
- 第二部分:識別保守和環(huán)境特異的信號通路
- 根據(jù)信號/結(jié)構(gòu)的相似性識別差異較大(或更少)的信號網(wǎng)絡(luò)以及信號組
- 識別并可視化保守和環(huán)境特異的信號通路
- 第三部分:識別上調(diào)和下調(diào)的信號配體對
- 第四部分:使用層次結(jié)構(gòu)圖社露、圓圖或和弦圖可視比較細(xì)胞-細(xì)胞通信
- 第五部分:比較不同數(shù)據(jù)集之間的信號基因表達(dá)分布
- 保存合并的CellChat對象
此教程展示了如何應(yīng)用 CellChat 來識別主要的信號變化一屋,以及通過多個細(xì)胞通信網(wǎng)絡(luò)的聯(lián)合多重學(xué)習(xí)和定量對比保守和環(huán)境特異的信號。我們通過將其應(yīng)用于來自兩種生物條件:(NL,正常) 和(LS讲坎, 損傷) 人類皮膚的細(xì)胞的 scRNA-seq 數(shù)據(jù)关筒,來展示 CellChat 的多重分析功能。這兩個數(shù)據(jù)集具有相同的細(xì)胞群組成驶睦。如果不同數(shù)據(jù)集之間的細(xì)胞群組成略有或差異較大砰左,請查看另一個相關(guān)的教程。
CellChat 采用自上而下的方法场航,即從大局出發(fā)缠导,然后對信號機(jī)制進(jìn)行更詳細(xì)的改進(jìn),以識別不同級別的信號變化溉痢,包括細(xì)胞通信的一般原則和功能失調(diào)的細(xì)胞群/信號通路/受配體僻造。
加載所需的包
library(CellChat)
library(patchwork)
創(chuàng)建目錄以保存圖片
data.dir <- './comparison'
dir.create(data.dir)
setwd(data.dir)
加載每個數(shù)據(jù)集的cellchat對象,然后合并在一起
用戶需要在每個數(shù)據(jù)集上單獨運(yùn)行 CellChat孩饼,然后將不同的 CellChat 對象合并在一起髓削。如果您有使用較早版本(< 0.5.0)獲得的 CellChat 對象,請首先updateCellChat
cellchat.NL <- readRDS(url("https://ndownloader.figshare.com/files/25954199"))
cellchat.LS <- readRDS(url("https://ndownloader.figshare.com/files/25956518"))
object.list <- list(NL = cellchat.NL, LS = cellchat.LS)
cellchat <- mergeCellChat(object.list, add.names = names(object.list))
#> Merge the following slots: 'data.signaling','net', 'netP','meta', 'idents', 'var.features' , 'DB', and 'LR'.
cellchat
#> An object of class CellChat created from a merged object with multiple datasets
#> 555 signaling genes.
#> 7563 cells.
第一部分:預(yù)測細(xì)胞通信的一般原理
cellchat從大局出發(fā)镀娶,預(yù)測細(xì)胞通信的一般原理立膛。在比較多種生物條件下的細(xì)胞-細(xì)胞通信時,可以回答以下生物學(xué)問題:
- 細(xì)胞-細(xì)胞通信是否增強(qiáng)
- 細(xì)胞類型顯著變化之間的相互作用
- 主要來源和目標(biāo)如何從一個條件到為另一個條件變化的
比較交互總數(shù)和交互強(qiáng)度
為了回答細(xì)胞-細(xì)胞通信是否增強(qiáng)的問題梯码,CellChat比較了來自不同生物條件的細(xì)胞通信網(wǎng)絡(luò)的相互作用數(shù)量和強(qiáng)度旧巾。
gg1 <- compareInteractions(cellchat, show.legend = F, group = c(1,2))
gg2 <- compareInteractions(cellchat, show.legend = F, group = c(1,2), measure = "weight")
gg1 + gg2
比較不同細(xì)胞群之間的相互作用數(shù)量和強(qiáng)度
為了確定細(xì)胞群之間顯示顯著變化的相互作用,CellChat 比較了不同細(xì)胞群之間的相互作用數(shù)量和強(qiáng)度忍些。
不同細(xì)胞群之間的相互作用數(shù)量或強(qiáng)度的差異
兩個數(shù)據(jù)集之間細(xì)胞通信網(wǎng)絡(luò)中交互或交互強(qiáng)度的差異數(shù)可以使用圓圖可視化鲁猩, 與第一個數(shù)據(jù)集相比,[紅色](或[藍(lán)色]邊表示信號在第二個數(shù)據(jù)集中增加或[減少])罢坝。
par(mfrow = c(1,2), xpd=TRUE)
netVisual_diffInteraction(cellchat, weight.scale = T)
netVisual_diffInteraction(cellchat, weight.scale = T, measure = "weight")
我們還可以使用熱圖在更大的細(xì)節(jié)中顯示交互的差異數(shù)或交互強(qiáng)度廓握。頂部彩色條形圖表示熱圖(傳入信號)中顯示的列值的總和。右邊的彩色條形圖表示一行值(傳出信號)的總和嘁酿。在色條中紅色或藍(lán)色表示第二個數(shù)據(jù)集中與第一個數(shù)據(jù)集相比增加或[減少]信號隙券。
gg1 <- netVisual_heatmap(cellchat)
#> Do heatmap based on a merged object
gg2 <- netVisual_heatmap(cellchat, measure = "weight")
#> Do heatmap based on a merged object
gg1 + gg2
差異網(wǎng)絡(luò)分析僅適用于配對數(shù)據(jù)集。如果有更多的數(shù)據(jù)集進(jìn)行比較闹司,我們可以直接顯示每個數(shù)據(jù)集中任意兩個細(xì)胞群之間的交互次數(shù)或交互強(qiáng)度娱仔。
為了更好地控制不同數(shù)據(jù)集中推斷網(wǎng)絡(luò)的節(jié)點大小和邊緣權(quán)重,我們計算每個細(xì)胞組的最大細(xì)胞數(shù)量以及所有數(shù)據(jù)集中交互(或交互權(quán)重)的最大數(shù)量游桩。
weight.max <- getMaxWeight(object.list, attribute = c("idents","count"))
par(mfrow = c(1,2), xpd=TRUE)
for (i in 1:length(object.list)) {
netVisual_circle(object.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(object.list)[i]))
}
不同細(xì)胞類型之間相互作用或交互強(qiáng)度的差異
為了簡化復(fù)雜的網(wǎng)絡(luò)牲迫,并深入了解細(xì)胞類型級別的細(xì)胞通信耐朴,我們可以根據(jù)定義的細(xì)胞群聚合細(xì)胞-細(xì)胞通信。在這里盹憎,我們將細(xì)胞群分為三種細(xì)胞類型筛峭,然后重新合并CellChat對象列表。
group.cellType <- c(rep("FIB", 4), rep("DC", 4), rep("TC", 4))
group.cellType <- factor(group.cellType, levels = c("FIB", "DC", "TC"))
object.list <- lapply(object.list, function(x) {mergeInteractions(x, group.cellType)})
cellchat <- mergeCellChat(object.list, add.names = names(object.list))
#> Merge the following slots: 'data.signaling','net', 'netP','meta', 'idents', 'var.features' , 'DB', and 'LR'.
然后陪每,我們可以顯示每個數(shù)據(jù)集中任意兩個細(xì)胞類型之間的交互次數(shù)或交互強(qiáng)度影晓。
weight.max <- getMaxWeight(object.list, slot.name = c("idents", "net", "net"), attribute = c("idents","count", "count.merged"))
par(mfrow = c(1,2), xpd=TRUE)
for (i in 1:length(object.list)) {
netVisual_circle(object.list[[i]]@net$count.merged, weight.scale = T, label.edge= T, edge.weight.max = weight.max[3], edge.width.max = 12, title.name = paste0("Number of interactions - ", names(object.list)[i]))
}
此外,我們還可以使用圓圖顯示任意兩種細(xì)胞類型之間的交互或交互強(qiáng)度的差異檩禾。與第一個數(shù)據(jù)集相比挂签,紅色(或藍(lán)色)色邊緣表示第二個數(shù)據(jù)集中的信號增加(或減少)。
par(mfrow = c(1,2), xpd=TRUE)
netVisual_diffInteraction(cellchat, weight.scale = T, measure = "count.merged", label.edge = T)
netVisual_diffInteraction(cellchat, weight.scale = T, measure = "weight.merged", label.edge = T)
比較 2D 空間中的主要來源和目標(biāo)
比較二D空間中的傳出和傳入交互強(qiáng)度盼产,可以識別不同數(shù)據(jù)集之間顯著變化的發(fā)送或接收信號的細(xì)胞群饵婆。
num.link <- sapply(object.list, function(x) {rowSums(x@net$count) + colSums(x@net$count)-diag(x@net$count)})
weight.MinMax <- c(min(num.link), max(num.link)) # control the dot size in the different datasets
gg <- list()
for (i in 1:length(object.list)) {
gg[[i]] <- netAnalysis_signalingRole_scatter(object.list[[i]], title = names(object.list)[i], weight.MinMax = weight.MinMax)
}
#> Signaling role analysis on the aggregated cell-cell communication network from all signaling pathways
#> Signaling role analysis on the aggregated cell-cell communication network from all signaling pathways
patchwork::wrap_plots(plots = gg)
從散點圖中,我們可以看到與 NL 相比辆飘,Inflam.DC 和 cDC1 成為 LS 中的主要來源和目標(biāo)之一啦辐。纖維細(xì)胞群也成為LS的主要來源谓传。
第二部分:識別保守和環(huán)境特異的信號通路
然后蜈项,CellChat 可以根據(jù)其在多種生物條件下的細(xì)胞通信網(wǎng)絡(luò),識別差異較大(或更少)的信號網(wǎng)絡(luò)续挟、信號組以及基于其細(xì)胞通信網(wǎng)絡(luò)的保守和環(huán)境特異的信號通路紧卒。
根據(jù)信號/結(jié)構(gòu)的相似性識別差異較大(或更少)的信號網(wǎng)絡(luò)以及信號組
CellChat 根據(jù)推斷的通信網(wǎng)絡(luò)的功能和拓?fù)湎嗨菩裕瑢ζ溥M(jìn)行聯(lián)合多重學(xué)習(xí)和分類诗祸。NB:此類分析適用于兩個以上的數(shù)據(jù)集跑芳。
功能相似性:功能相似度高表示主要發(fā)射器和接收器相似,可解釋為兩個信號通路或兩個配體受體對具有相似的作用直颅。NB:功能相似性分析不適用于具有不同細(xì)胞類型成分的多個數(shù)據(jù)集博个。
結(jié)構(gòu)相似性:結(jié)構(gòu)相似性用于比較其信號網(wǎng)絡(luò)結(jié)構(gòu),而不考慮發(fā)送器和接收器的相似性功偿。NB:結(jié)構(gòu)相似性分析適用于具有相同細(xì)胞類型組成或截然不同的細(xì)胞類型組成多個數(shù)據(jù)集盆佣。
在這里,我們可以根據(jù)功能相似性運(yùn)行多重和分類學(xué)習(xí)分析械荷,因為兩個數(shù)據(jù)集具有相同的單元類型組成共耍。
根據(jù)信號組的功能相似性識別信號組
cellchat <- computeNetSimilarityPairwise(cellchat, type = "functional")
#> Compute signaling network similarity for datasets 1 2
cellchat <- netEmbedding(cellchat, type = "functional")
#> Manifold learning of the signaling networks for datasets 1 2
cellchat <- netClustering(cellchat, type = "functional")
#> Classification learning of the signaling networks for datasets 1 2
# Visualization in 2D-space
netVisual_embeddingPairwise(cellchat, type = "functional", label.size = 3.5)
#> 2D visualization of signaling networks from datasets 1 2
# netVisual_embeddingZoomIn(cellchat, type = "functional", nCol = 2)
基于結(jié)構(gòu)相似性識別信號組
cellchat <- computeNetSimilarityPairwise(cellchat, type = "structural")
#> Compute signaling network similarity for datasets 1 2
cellchat <- netEmbedding(cellchat, type = "structural")
#> Manifold learning of the signaling networks for datasets 1 2
cellchat <- netClustering(cellchat, type = "structural")
#> Classification learning of the signaling networks for datasets 1 2
# Visualization in 2D-space
netVisual_embeddingPairwise(cellchat, type = "structural", label.size = 3.5)
#> 2D visualization of signaling networks from datasets 1 2
netVisual_embeddingPairwiseZoomIn(cellchat, type = "structural", nCol = 2)
#> 2D visualization of signaling networks from datasets 1 2
計算和可視化通路距離
我們可以根據(jù)信號網(wǎng)絡(luò)在共享雙維空間中的歐幾里德距離來識別差異較大(或更少)的信號網(wǎng)絡(luò)。更大的距離意味著兩個數(shù)據(jù)集之間的通信網(wǎng)絡(luò)在功能或結(jié)構(gòu)相似性方面存在更大的差異吨瞎。NB:我們只計算兩個數(shù)據(jù)集之間重疊信號通路的距離痹兜。此處未考慮僅在一個數(shù)據(jù)集中標(biāo)識的信號通路。如果有三個以上的數(shù)據(jù)集颤诀,可以通過在函數(shù)rankSimilarity中定義comparison進(jìn)行對比字旭。
rankSimilarity(cellchat, type = "functional")
#> Compute the distance of signaling networks between datasets 1 2
識別并可視化保守和環(huán)境特異的信號通路
通過比較每個信號通路的信息流/交互对湃,我們可以識別信號通路,(i) 關(guān)閉谐算,(ii) 減少熟尉,(iii) 打開或(iv) 增加。
比較每個信號通路的整體信息流
我們可以通過簡單地比較每個信號通路的信息流來識別保守和環(huán)境特異的信號通路洲脂,該信息流由推斷網(wǎng)絡(luò)中所有一對細(xì)胞群之間的通信概率之和(即網(wǎng)絡(luò)中的總權(quán)重)定義斤儿。
此條形圖可在堆疊模式下繪制。根據(jù) NL 和 LS 皮膚之間推斷的網(wǎng)絡(luò)中整體信息流的差異對重要信號通路進(jìn)行排名恐锦。紅色的頂部信號通路富含 NL 皮膚往果,綠色在 LS 皮膚中得到了富集。
gg1 <- rankNet(cellchat, mode = "comparison", stacked = T, do.stat = TRUE)
gg2 <- rankNet(cellchat, mode = "comparison", stacked = F, do.stat = TRUE)
gg1 + gg2
比較與每個細(xì)胞群相關(guān)的傳出(或傳入)信號
上述分析將傳出和傳入信號的信息匯總在一起一铅。我們還可以比較兩個數(shù)據(jù)集之間的傳出(或傳入)信號模式陕贮,從而識別顯示不同信號模式的信號通路/受配體。
我們可以將來自不同數(shù)據(jù)集的所有已識別的信號通路進(jìn)行組合潘飘,從而并排比較它們肮之,包括傳出信號、傳入信號和整體信號卜录,方法是將傳出和傳入信號聚合在一起戈擒。NB:rankNet還顯示了整體信號的比較,但它沒有顯示特定細(xì)胞群中的信號強(qiáng)度艰毒。
library(ComplexHeatmap)
#> Loading required package: grid
#> ========================================
#> ComplexHeatmap version 2.7.1.1010
#> Bioconductor page: http://bioconductor.org/packages/ComplexHeatmap/
#> Github page: https://github.com/jokergoo/ComplexHeatmap
#> Documentation: http://jokergoo.github.io/ComplexHeatmap-reference
#>
#> If you use it in published research, please cite:
#> Gu, Z. Complex heatmaps reveal patterns and correlations in multidimensional
#> genomic data. Bioinformatics 2016.
#>
#> This message can be suppressed by:
#> suppressPackageStartupMessages(library(ComplexHeatmap))
#> ========================================
i = 1
# combining all the identified signaling pathways from different datasets
pathway.union <- union(object.list[[i]]@netP$pathways, object.list[[i+1]]@netP$pathways)
ht1 = netAnalysis_signalingRole_heatmap(object.list[[i]], pattern = "outgoing", signaling = pathway.union, title = names(object.list)[i], width = 5, height = 6)
ht2 = netAnalysis_signalingRole_heatmap(object.list[[i+1]], pattern = "outgoing", signaling = pathway.union, title = names(object.list)[i+1], width = 5, height = 6)
draw(ht1 + ht2, ht_gap = unit(0.5, "cm"))
ht1 = netAnalysis_signalingRole_heatmap(object.list[[i]], pattern = "incoming", signaling = pathway.union, title = names(object.list)[i], width = 5, height = 6, color.heatmap = "GnBu")
ht2 = netAnalysis_signalingRole_heatmap(object.list[[i+1]], pattern = "incoming", signaling = pathway.union, title = names(object.list)[i+1], width = 5, height = 6, color.heatmap = "GnBu")
draw(ht1 + ht2, ht_gap = unit(0.5, "cm"))
ht1 = netAnalysis_signalingRole_heatmap(object.list[[i]], pattern = "all", signaling = pathway.union, title = names(object.list)[i], width = 5, height = 6, color.heatmap = "OrRd")
ht2 = netAnalysis_signalingRole_heatmap(object.list[[i+1]], pattern = "all", signaling = pathway.union, title = names(object.list)[i+1], width = 5, height = 6, color.heatmap = "OrRd")
draw(ht1 + ht2, ht_gap = unit(0.5, "cm"))
第三部分:識別上調(diào)和下調(diào)的信號配體對
我們可以比較由某些細(xì)胞群到其他細(xì)胞組的配體受體對調(diào)節(jié)的通信概率筐高。這可以通過設(shè)置comparison在函數(shù)netVisual_bubble中來完成。
netVisual_bubble(cellchat, sources.use = 4, targets.use = c(5:11), comparison = c(1, 2), angle.x = 45)
#> Comparing communications on a merged object
此外丑瞧,我們可以在一個數(shù)據(jù)集中識別與另一個數(shù)據(jù)集相比柑土,上升(增加)和下降調(diào)節(jié)(減少)信號配體受體對。這可以通過指定max.dataset和min.dataset在函數(shù)netVisual_bubble中完成绊汹。信號增加意味著這些信號在一個數(shù)據(jù)集中與其他數(shù)據(jù)集相比具有更高的通信概率(強(qiáng)度)稽屏。
gg1 <- netVisual_bubble(cellchat, sources.use = 4, targets.use = c(5:11), comparison = c(1, 2), max.dataset = 2, title.name = "Increased signaling in LS", angle.x = 45, remove.isolate = T)
#> Comparing communications on a merged object
gg2 <- netVisual_bubble(cellchat, sources.use = 4, targets.use = c(5:11), comparison = c(1, 2), max.dataset = 1, title.name = "Decreased signaling in LS", angle.x = 45, remove.isolate = T)
#> Comparing communications on a merged object
gg1 + gg2
NB:氣泡圖中顯示的配體受體對可以通過signaling.LSIncreased = gg1$data 訪問。
通過比較每個 L-R 對和每對細(xì)胞組的兩個數(shù)據(jù)集之間的通信概率西乖,可以采用上述方法來識別上調(diào)和下調(diào)的信號狐榔。另外,我們可以根據(jù)微分基因表達(dá)分析來識別上調(diào)和下調(diào)的信號配體對浴栽。具體來說荒叼,我們對每個細(xì)胞組執(zhí)行兩種生物條件(即NL和LS)之間的微分表達(dá)分析,然后根據(jù)發(fā)送者細(xì)胞中配體和接收器細(xì)胞中受體的折疊變化獲得上調(diào)和下調(diào)的信號典鸡。此類分析可如下所示被廓。
# define a positive dataset, i.e., the dataset with positive fold change against the other dataset
pos.dataset = "LS"
# define a char name used for storing the results of differential expression analysis
features.name = pos.dataset
# perform differential expression analysis
cellchat <- identifyOverExpressedGenes(cellchat, group.dataset = "datasets", pos.dataset = pos.dataset, features.name = features.name, only.pos = FALSE, thresh.pc = 0.1, thresh.fc = 0.1, thresh.p = 1)
#> Use the joint cell labels from the merged CellChat object
# map the results of differential expression analysis onto the inferred cell-cell communications to easily manage/subset the ligand-receptor pairs of interest
net <- netMappingDEG(cellchat, features.name = features.name)
# extract the ligand-receptor pairs with upregulated ligands in LS
net.up <- subsetCommunication(cellchat, net = net, datasets = "LS",ligand.logFC = 0.2, receptor.logFC = NULL)
# extract the ligand-receptor pairs with upregulated ligands and upregulated recetptors in NL, i.e.,downregulated in LS
net.down <- subsetCommunication(cellchat, net = net, datasets = "NL",ligand.logFC = -0.1, receptor.logFC = -0.1)
由于信號基因在多亞單位中可能很復(fù)雜,我們可以使用net.upnet.down進(jìn)一步的來獲得單個信號基因萝玷。
gene.up <- extractGeneSubsetFromPair(net.up, cellchat)
gene.down <- extractGeneSubsetFromPair(net.down, cellchat)
然后嫁乘,我們使用氣泡圖或和弦圖可視化上調(diào)和向下調(diào)的信號配體對昆婿。
pairLR.use.up = net.up[, "interaction_name", drop = F]
gg1 <- netVisual_bubble(cellchat, pairLR.use = pairLR.use.up, sources.use = 4, targets.use = c(5:11), comparison = c(1, 2), angle.x = 90, remove.isolate = T,title.name = paste0("Up-regulated signaling in ", names(object.list)[2]))
#> Comparing communications on a merged object
pairLR.use.down = net.down[, "interaction_name", drop = F]
gg2 <- netVisual_bubble(cellchat, pairLR.use = pairLR.use.down, sources.use = 4, targets.use = c(5:11), comparison = c(1, 2), angle.x = 90, remove.isolate = T,title.name = paste0("Down-regulated signaling in ", names(object.list)[2]))
#> Comparing communications on a merged object
gg1 + gg2
使用和弦圖可視化上調(diào)和下調(diào)的信號配體對
# Chord diagram
par(mfrow = c(1,2), xpd=TRUE)
netVisual_chord_gene(object.list[[2]], sources.use = 4, targets.use = c(5:11), slot.name = 'net', net = net.up, lab.cex = 0.8, small.gap = 3.5, title.name = paste0("Up-regulated signaling in ", names(object.list)[2]))
#> Note: The first link end is drawn out of sector 'MIF'.
netVisual_chord_gene(object.list[[1]], sources.use = 4, targets.use = c(5:11), slot.name = 'net', net = net.down, lab.cex = 0.8, small.gap = 3.5, title.name = paste0("Down-regulated signaling in ", names(object.list)[2]))
第四部分:使用層次結(jié)構(gòu)圖、圓圖或和弦圖可視比較細(xì)胞-細(xì)胞通信
與單個數(shù)據(jù)集的 CellChat 分析類似蜓斧,我們可以使用層次結(jié)構(gòu)圖仓蛆、圓圖或和弦圖可視化細(xì)胞通信網(wǎng)絡(luò)。
邊緣顏色/重量挎春、節(jié)點顏色/大小/形狀:在所有可視化圖中看疙,邊緣顏色與發(fā)送者源一致,邊緣權(quán)重與交互強(qiáng)度成正比直奋。較厚的邊緣線表示信號更強(qiáng)能庆。在層次結(jié)構(gòu)圖和圓圖中,圓的大小與每個細(xì)胞組中的細(xì)胞數(shù)量成正比脚线。在層次圖中搁胆,實心和開放的圓分別代表源和目標(biāo)。在和弦圖中邮绿,內(nèi)條顏色表示從相應(yīng)的外條接收信號的目標(biāo)渠旁。內(nèi)條大小與目標(biāo)接收的信號強(qiáng)度成正比。這種內(nèi)條有助于解釋復(fù)雜的和弦圖船逮。請注意顾腊,有一些內(nèi)條沒有任何和弦的一些細(xì)胞組,請忽略他們傻唾,因為這是一個本包尚未解決的問題投慈。
pathways.show <- c("CXCL")
weight.max <- getMaxWeight(object.list, slot.name = c("netP"), attribute = pathways.show) # control the edge weights across different datasets
par(mfrow = c(1,2), xpd=TRUE)
for (i in 1:length(object.list)) {
netVisual_aggregate(object.list[[i]], signaling = pathways.show, layout = "circle", edge.weight.max = weight.max[1], edge.width.max = 10, signaling.name = paste(pathways.show, names(object.list)[i]))
}
pathways.show <- c("CXCL")
par(mfrow = c(1,2), xpd=TRUE)
ht <- list()
for (i in 1:length(object.list)) {
ht[[i]] <- netVisual_heatmap(object.list[[i]], signaling = pathways.show, color.heatmap = "Reds",title.name = paste(pathways.show, "signaling ",names(object.list)[i]))
}
#> Do heatmap based on a single object
#>
#> Do heatmap based on a single object
ComplexHeatmap::draw(ht[[1]] + ht[[2]], ht_gap = unit(0.5, "cm"))
# Chord diagram
pathways.show <- c("CXCL")
par(mfrow = c(1,2), xpd=TRUE)
for (i in 1:length(object.list)) {
netVisual_aggregate(object.list[[i]], signaling = pathways.show, layout = "chord", signaling.name = paste(pathways.show, names(object.list)[i]))
}
#> Note: The first link end is drawn out of sector 'Inflam. FIB'.
netVisual_chord_cell對于和弦圖承耿,CellChat 具有獨立函數(shù)冠骄,通過調(diào)整circlize包中的不同參數(shù)來靈活可視化信號網(wǎng)絡(luò)。例如加袋,我們可以定義一個group命名的字符矢量凛辣,以創(chuàng)建多組和弦圖,將細(xì)胞群集分組到不同的細(xì)胞類型职烧。
# Chord diagram
group.cellType <- c(rep("FIB", 4), rep("DC", 4), rep("TC", 4)) # grouping cell clusters into fibroblast, DC and TC cells
names(group.cellType) <- levels(object.list[[1]]@idents)
pathways.show <- c("CXCL")
par(mfrow = c(1,2), xpd=TRUE)
for (i in 1:length(object.list)) {
netVisual_chord_cell(object.list[[i]], signaling = pathways.show, group = group.cellType, title.name = paste0(pathways.show, " signaling network - ", names(object.list)[i]))
}
#> Plot the aggregated cell-cell communication network at the signaling pathway level
#> Plot the aggregated cell-cell communication network at the signaling pathway level
#> Note: The first link end is drawn out of sector 'Inflam. FIB'.
使用和弦圖扁誓,CellChat 提供兩個函數(shù)netVisual_chord_cell和netVisual_chord_gene,
可視化具有不同目的和不同級別的細(xì)胞-細(xì)胞通信蚀之。 netVisual_chord_cell用于可視化不同細(xì)胞群之間的細(xì)胞-細(xì)胞通信(和弦圖中的每個部分是細(xì)胞組)蝗敢,netVisual_chord_gene用于可視化由多個配體受體或信號通路調(diào)解的細(xì)胞-細(xì)胞通信(和弦圖中的每個部分都是配體、受體或信號通路)足删。
par(mfrow = c(1, 2), xpd=TRUE)
# compare all the interactions sending from Inflam.FIB to DC cells
for (i in 1:length(object.list)) {
netVisual_chord_gene(object.list[[i]], sources.use = 4, targets.use = c(5:8), lab.cex = 0.5, title.name = paste0("Signaling from Inflam.FIB - ", names(object.list)[i]))
}
# compare all the interactions sending from fibroblast to inflamatory immune cells
par(mfrow = c(1, 2), xpd=TRUE)
for (i in 1:length(object.list)) {
netVisual_chord_gene(object.list[[i]], sources.use = c(1,2, 3, 4), targets.use = c(8,10), title.name = paste0("Signaling received by Inflam.DC and .TC - ", names(object.list)[i]), legend.pos.x = 10)
}
# show all the significant signaling pathways from fibroblast to immune cells
par(mfrow = c(1, 2), xpd=TRUE)
for (i in 1:length(object.list)) {
netVisual_chord_gene(object.list[[i]], sources.use = c(1,2,3,4), targets.use = c(5:11),slot.name = "netP", title.name = paste0("Signaling pathways sending from fibroblast - ", names(object.list)[i]), legend.pos.x = 10)
}
#> Note: The second link end is drawn out of sector ' '.
#> Note: The first link end is drawn out of sector 'MIF'.
#> Note: The second link end is drawn out of sector ' '.
#> Note: The first link end is drawn out of sector 'CXCL '.
NB:在生成繪圖時寿谴,請忽略注釋,例如"Note: The first link end is drawn out of sector ‘MIF’"失受。如果基因名稱重疊讶泰,您可以通過降低small.gap值來調(diào)整參數(shù)咏瑟。
第五部分:比較不同數(shù)據(jù)集之間的信號基因表達(dá)分布
我們可以利用seurat包裝的函數(shù)plotGeneExpression繪制與L-R對或信號通路相關(guān)的信號基因的基因表達(dá)分布圖。
cellchat@meta$datasets = factor(cellchat@meta$datasets, levels = c("NL", "LS")) # set factor level
plotGeneExpression(cellchat, signaling = "CXCL", split.by = "datasets", colors.ggplot = T)
#> The default behaviour of split.by has changed.
#> Separate violin plots are now plotted side-by-side.
#> To restore the old behaviour of a single split violin,
#> set split.plot = TRUE.
#>
#> This message will be shown once per session.
#> Scale for 'y' is already present. Adding another scale for 'y', which will
#> replace the existing scale.
#> Scale for 'y' is already present. Adding another scale for 'y', which will
#> replace the existing scale.
#> Scale for 'y' is already present. Adding another scale for 'y', which will
#> replace the existing scale.
保存合并的cellchat對象
saveRDS(cellchat, file = "cellchat_comparisonAnalysis_humanSkin_NL_vs_LS.rds")