CellChat三部曲1:使用CellChat對單個數據集進行細胞間通訊分析
自從周運來在簡書寫了一篇cellchat的中文介紹教程,然后R包作者也在B站做了直播介紹,cellchat作為一個細胞通訊分析的新興R包,受到了廣泛關注。教程也如雨后春筍般涌現。
鑒于R包誕生之初有一些bug,作為初學者學習走通可能有一定難度,這里再次對cellchat進行系統(tǒng)介紹,希望對大家有所幫助。當然現在也有些小bug,但這些基本都可以通過搜索解決,這些小bug我大都寫過教程了。
系列教程共三篇:單個數據集分析,多個數據集比較分析,具有較大成分差異的數據集比較分析。本教程是單個數據集分析流程
- 加載所需的包
- 第一部分:CellChat對象的數據輸入、處理及初始化
- 第二部分:細胞通信網絡的推斷
- 第三部分:細胞通信網絡的可視化
- 使用層次結構圖、圓圖或和弦圖可視化每個信號通路
- 可視化由多個配體受體或信號通路調節(jié)的細胞通信
- 使用小提琴/點圖繪制信號基因表達分布
- 第四部分:細胞通信網絡系統(tǒng)分析
- 識別細胞組的信號作用(例如,占主導地位的發(fā)送器、接收器)以及主要貢獻信號
- 確定全局通信模式,探索多個細胞類型和信號通路如何協調在一起
- 信號網絡的多重和分類學習分析
- 第五部分:保存cellchat對象
此教程概述了使用 CellChat 的單個數據集對細胞通信網絡進行推斷、分析和可視化的步驟。我們通過將其應用于人類患者病變皮膚細胞 (LS) 的 scRNA-seq 數據來展示 CellChat 的多種功能。
CellChat 要求將細胞的基因表達數據作為輸入,并通過將基因表達與信號配體、受體與其同因子之間的相互作用的先驗知識相結合來對細胞-細胞通信的概率進行模擬。
在推斷細胞間通信網絡后,CellChat 為進一步的數據探索、分析和可視化提供了功能。
加載所需的包
library(CellChat)
library(patchwork)
options(stringsAsFactors = FALSE)
第一部分:CellChat對象的數據輸入、處理及初始化
CellChat 需要兩個輸入:一個是細胞的基因表達數據,另一個是用戶分配的細胞標簽(即基于標簽的模式)或單細胞數據的低維表示(即無標簽模式)。對于后者,CellChat 通過根據低維空間或偽時間軌跡空間中的細胞距離構建共享的鄰近圖自動對細胞進行分組。
加載數據
對于基因表達數據矩陣,要求基因為行名,細胞為列名。需要將標準化數據作為 CellChat 分析的輸入。如果用戶提供count數據,我們提供一個函數normalizeData來計算文庫大小,然后進行l(wèi)og轉換。對于分組信息,需要使用帶有行名的數據作為CellChat 的輸入。
# Here we load a scRNA-seq data matrix and its associated cell meta data
load(url("https://ndownloader.figshare.com/files/25950872")) # This is a combined data from two biological conditions: normal and diseases
data.input = data_humanSkin$data # normalized data matrix
meta = data_humanSkin$meta # a dataframe with rownames containing cell mata data
cell.use = rownames(meta)[meta$condition == "LS"] # extract the cell names from disease data
# Prepare input data for CelChat analysis
data.input = data.input[, cell.use]
meta = meta[cell.use, ]
# meta = data.frame(labels = meta$labels[cell.use], row.names = colnames(data.input)) # manually create a dataframe consisting of the cell labels
unique(meta$labels) # check the cell labels
#> [1] Inflam. FIB FBN1+ FIB APOE+ FIB COL11A1+ FIB cDC2
#> [6] LC Inflam. DC cDC1 CD40LG+ TC Inflam. TC
#> [11] TC NKT
#> 12 Levels: APOE+ FIB FBN1+ FIB COL11A1+ FIB Inflam. FIB cDC1 cDC2 ... NKT
創(chuàng)建CellChat 對象
用戶可以從數據矩陣、Seurat 或SingleCellExperiment對象創(chuàng)建新的 CellChat 對象。如果輸入是 Seurat 或SingleCellExperiment對象,則默認情況下將使用對象中的meta data,用戶必須提供該數據來定義細胞分組。例如,group.by=Seurat 對象中默認的細胞標識。
NB:如果用戶加載以前計算的CellChat 對象(版本<0.5.0),請通過updateCellChat更新對象
cellchat <- createCellChat(object = data.input, meta = meta, group.by = "labels")
#> Create a CellChat object from a data matrix
#> Set cell identities for the new CellChat object
#> The cell groups used for CellChat analysis are APOE+ FIB FBN1+ FIB COL11A1+ FIB Inflam. FIB cDC1 cDC2 LC Inflam. DC TC Inflam. TC CD40LG+ TC NKT
將細胞信息添加到對象的meta slot中
如果在創(chuàng)建cellchat對象時未添加細胞meta信息,用戶也可以稍后添加該信息,并使用setIdent設置該對象默認的細胞標識。
cellchat <- addMeta(cellchat, meta = meta)
cellchat <- setIdent(cellchat, ident.use = "labels") # set "labels" as default cell identity
levels(cellchat@idents) # show factor levels of the cell labels
groupSize <- as.numeric(table(cellchat@idents)) # number of cells in each cell group
設置配體受體交互數據庫
我們的數據庫 CellChatDB 是一個手動整理的文獻支持的配體受體在人和小鼠中的交互數據庫。小鼠中的CellChatDB包含2,021個經驗證的分子相互作用,包括60%的自分泌/旁分泌信號相互作用、21%的細胞外基質(ECM)受體相互作用和19%的細胞-細胞接觸相互作用。人的CellChatDB包含1,939個經驗證的分子相互作用,包括61.8%的自分泌/旁分泌信號相互作用、21.7%的細胞外基質(ECM)受體相互作用和16.5%的細胞-細胞接觸相互作用。
用戶可以通過添加自己精心整理的配體受體對來更新 CellChatDB。
CellChatDB <- CellChatDB.human # use CellChatDB.mouse if running on mouse data
showDatabaseCategory(CellChatDB)

# Show the structure of the database
dplyr::glimpse(CellChatDB$interaction)
#> Rows: 1,939
#> Columns: 11
#> $ interaction_name <chr> "TGFB1_TGFBR1_TGFBR2", "TGFB2_TGFBR1_TGFBR2", "TGF…
#> $ pathway_name <chr> "TGFb", "TGFb", "TGFb", "TGFb", "TGFb", "TGFb", "T…
#> $ ligand <chr> "TGFB1", "TGFB2", "TGFB3", "TGFB1", "TGFB1", "TGFB…
#> $ receptor <chr> "TGFbR1_R2", "TGFbR1_R2", "TGFbR1_R2", "ACVR1B_TGF…
#> $ agonist <chr> "TGFb agonist", "TGFb agonist", "TGFb agonist", "T…
#> $ antagonist <chr> "TGFb antagonist", "TGFb antagonist", "TGFb antago…
#> $ co_A_receptor <chr> "", "", "", "", "", "", "", "", "", "", "", "", ""…
#> $ co_I_receptor <chr> "TGFb inhibition receptor", "TGFb inhibition recep…
#> $ evidence <chr> "KEGG: hsa04350", "KEGG: hsa04350", "KEGG: hsa0435…
#> $ annotation <chr> "Secreted Signaling", "Secreted Signaling", "Secre…
#> $ interaction_name_2 <chr> "TGFB1 - (TGFBR1+TGFBR2)", "TGFB2 - (TGFBR1+TGFBR2…
# use a subset of CellChatDB for cell-cell communication analysis
CellChatDB.use <- subsetDB(CellChatDB, search = "Secreted Signaling") # use Secreted Signaling
# use all CellChatDB for cell-cell communication analysis
# CellChatDB.use <- CellChatDB # simply use the default CellChatDB
# set the used database in the object
cellchat@DB <- CellChatDB.use
預處理用于細胞通信分析的表達數據
為了推斷細胞狀態(tài)特異的通信,我們識別一個細胞組中過度表達的配體或受體,然后識別過度表達的配體受體相互作用,是否過表達。
我們還提供將基因表達數據投影到蛋白質-蛋白質相互作用 (PPI) 網絡上的功能。具體來說,投影過程根據高度可信的實驗驗證的蛋白質-蛋白質網絡中定義的基因表達值來平滑基因的表達值。此功能在分析具有淺測序深度的單細胞數據時很有用,因為投影可減少信號基因的dropput效應,特別是對于配體/受體的可能的零表達。人們可能擔心這種投影過程可能引入的人為因素,但是,這幾乎可以忽略不計。用戶還可以通過在函數computeCommunProb()中國設置raw.use = TRUE跳過此步驟。
cellchat <- subsetData(cellchat) # subset the expression data of signaling genes for saving computation cost
future::plan("multiprocess", workers = 4) # do parallel
#> Warning: [ONE-TIME WARNING] Forked processing ('multicore') is disabled
#> in future (>= 1.13.0) when running R from RStudio, because it is
#> considered unstable. Because of this, plan("multicore") will fall
#> back to plan("sequential"), and plan("multiprocess") will fall back to
#> plan("multisession") - not plan("multicore") as in the past. For more details,
#> how to control forked processing or not, and how to silence this warning in
#> future R sessions, see ?future::supportsMulticore
cellchat <- identifyOverExpressedGenes(cellchat)
cellchat <- identifyOverExpressedInteractions(cellchat)
cellchat <- projectData(cellchat, PPI.human)
第二部分:細胞通信網絡的推斷
CellChat 通過分配具有概率值的每個相互作用并進行排列檢驗,來推斷具有生物學意義的細胞-細胞通信。CellChat通過將基因表達與先前已知的信號配體、受體及其同因子之間的相互作用知識相結合,利用大量作用規(guī)律,對細胞-細胞通信的概率進行模擬。
推斷的配體受體對的數量顯然取決于計算每個細胞組平均基因表達的方法。默認情況下,CellChat 使用一種統(tǒng)計學上強大的均值方法,稱為"trimean",與其他方法相比,它產生的相互作用更少。然而,我們發(fā)現 CellChat 在預測更強的交互方面表現良好,這非常有助于縮小交互范圍,以便進一步進行實驗驗證。在computeCommunProb中,我們提供了一個選項,用于使用其他方法,如5%和10%截斷均值,來計算平均基因表達。值得注意的是,"trimean"大約是25%的截斷平均值,這意味著如果一組表達細胞的百分比低于25%,則平均基因表達為零。要使用 10% 截斷的平均值,用戶可以設置type = "truncatedMean"和對trim = 0.1。
在分析未分類的單細胞轉錄組時,假設豐富的細胞群傾向于發(fā)送比稀有細胞群更強的信號,CellChat 還可以在概率計算中考慮每個細胞組中細胞比例的影響。用戶可以設置population.size = TRUE
計算通信概率并推斷cellchat網絡
cellchat <- computeCommunProb(cellchat, raw.use = TRUE)
# Filter out the cell-cell communication if there are only few number of cells in certain cell groups
cellchat <- filterCommunication(cellchat, min.cells = 10)
提取推斷的cellchat網絡作為數據框架
我們提供一個函數subsetCommunication,以輕松訪問推斷感興趣的細胞-細胞通信。例如
-
df.net <- subsetCommunication(cellchat)返回一個數據框架,該數據框架由配體/受體級別的所有推斷細胞通信組成。設置slot.name = "netP"可以在信號通路級別訪問推斷的通信 -
df.net <- subsetCommunication(cellchat, sources.use = c(1,2), targets.use = c(4,5))將推斷的細胞-細胞通信從細胞組1和2發(fā)送到細胞組4和5。 -
df.net <- subsetCommunication(cellchat, signaling = c("WNT", "TGFb"))通過向WNT和TGFb發(fā)出信號來調節(jié)推斷的細胞通信。
在信號通路級別推斷細胞-細胞通信
CellChat 通過總結與每個信號通路相關的所有配體-受體相互作用的通信概率,來計算信號通路級別上的通信概率。
NB:每個配體受體對和每個信號通路的推斷細胞間通信網絡分別存儲在插槽"net"和"netP"中。
cellchat <- computeCommunProbPathway(cellchat)
計算整合的細胞通信網絡
我們可以通過計算鏈接數或匯總通信概率來計算整合的細胞通信網絡。用戶還可以通過設置sources.use和targets.use`
cellchat <- aggregateNet(cellchat)
我們還可以可視化整合的細胞通信網絡。例如,使用圓圖顯示任意兩個細胞組之間的相互作用次數或總交互強度(比重)。
groupSize <- as.numeric(table(cellchat@idents))par(mfrow = c(1,2), xpd=TRUE)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")

由于細胞通信網絡復雜,我們可以檢查每個細胞組發(fā)送的信號。在這里,我們還控制參數edge.weight.max,以便我們可以比較不同網絡之間的邊緣權重。
mat <- cellchat@net$weightpar(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])}

第三部分:細胞通信網絡的可視化
在推斷細胞通信網絡后,CellChat 為進一步的數據探索、分析和可視化提供了各種功能。
- 它提供了幾種可視化細胞通信網絡的方法,包括分層圖、圓圖、和弦圖和氣泡圖。
- 它提供了一個易于使用的工具,用于提取和可視化推斷網絡的高階信息。例如,它允許對細胞群的主要信號輸入和輸出以及這些群和信號如何協調功能進行現成預測。
- 它可以通過結合通訊網絡分析、模式識別和多重學習方法,使用綜合方法對推斷出的細胞-細胞通信網絡進行定量表征和比較。
使用層次結構圖、圓圖或和弦圖可視化每個信號通路
層次結構圖:用戶應定義vertex.receiver,這是一個數字矢量,將細胞群的索引作為層次圖左側的目標。此分層圖由兩個部分組成:左部分顯示自分泌和旁分泌向某些感興趣的細胞組(即定義的)發(fā)出信號,右部分顯示自分泌和旁分泌向數據集中剩余的細胞組發(fā)出信號。因此,層級圖提供了一種信息性和直觀的方式來可視化自分泌和旁分泌信號之間的細胞群之間的感興趣通信。例如,在研究成纖維細胞和免疫細胞之間的細胞-細胞通信時,用戶可以定義為所有成纖維細胞組。
和弦圖:CellChat 提供兩種功能netVisual_chord_cell和netVisual_chord_gene,并可視化具有不同目的和不同級別的細胞通信。 netVisual_chord_cell用于可視化不同細胞群之間的細胞-細胞通信(和弦圖中的每個部分是細胞組),netVisual_chord_gene用于可視化由多個配體受體或信號通路調節(jié)的細胞-細胞通信(和弦圖中的每個部分都是配體、受體或信號通路)。
邊緣顏色/權重、節(jié)點顏色/大小/形狀的解釋:在所有可視化圖中,邊緣顏色與發(fā)送者源一致,邊緣權重與交互強度成正比。較厚的邊緣線表示信號更強。在層次結構圖和圓圖中,圓的大小與每個細胞組中的細胞數量成正比。在層次圖中,實心和開放的圓分別代表源和目標。在和弦圖中,內條顏色表示從相應的外條接收信號的目標。內條大小與目標接收的信號強度成正比。這種內條有助于解釋復雜的和弦圖。請注意,有一些內條沒有與任何一些細胞組鏈接,請忽略它,因為這是一個本包尚未解決的問題。
不同層次的細胞通信可視化:可以使用netVisual_aggregate可視化信號通路的推斷通信網絡,并使用netVisual_individual可視化與該信號通路相關的單個L-R對的推斷通信網絡。
在這里,我們以輸入一個信號通路為例。所有顯示重要通信的信號通路均可通過 cellchat@netP$pathways獲取。
pathways.show <- c("CXCL") # Hierarchy plot# 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 vertex.receiver = seq(1,4) # a numeric vector. netVisual_aggregate(cellchat, signaling = pathways.show, vertex.receiver = vertex.receiver)

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

# Chord diagrampar(mfrow=c(1,1))netVisual_aggregate(cellchat, signaling = pathways.show, layout = "chord")#> Note: The first link end is drawn out of sector 'Inflam. FIB'.

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

對于和弦圖,CellChat 具有獨立函數netVisual_chord_cell,通過調整[circlize ]包中的不同參數來靈活可視化信號網絡。例如,我們可以定義一個group命名的字符矢量,以創(chuàng)建多組和弦圖,將細胞群集分組到不同的細胞類型。
# Chord diagramgroup.cellType <- c(rep("FIB", 4), rep("DC", 4), rep("TC", 4)) # grouping cell clusters into fibroblast, DC and TC cellsnames(group.cellType) <- levels(cellchat@idents)netVisual_chord_cell(cellchat, signaling = pathways.show, group = group.cellType, title.name = paste0(pathways.show, " signaling network"))#> Plot the aggregated cell-cell communication network at the signaling pathway level#> Note: The first link end is drawn out of sector 'Inflam. FIB'.

計算每個配體受體對整體信號通路的貢獻,并可視化由單個配體受體對調節(jié)的細胞通信
netAnalysis_contribution(cellchat, signaling = pathways.show)

我們還可以可視化由單個配體受體對調節(jié)的細胞-細胞通信。我們提供一個函數extractEnrichedLR來提取給定信號通路的所有重要相互作用(L-R對)和相關信號基因。
pairLR.CXCL <- extractEnrichedLR(cellchat, signaling = pathways.show, geneLR.return = FALSE)LR.show <- pairLR.CXCL[1,] # show one ligand-receptor pair# Hierarchy plotvertex.receiver = seq(1,4) # a numeric vectornetVisual_individual(cellchat, signaling = pathways.show, pairLR.use = LR.show, vertex.receiver = vertex.receiver)

# Circle plotnetVisual_individual(cellchat, signaling = pathways.show, pairLR.use = LR.show, layout = "circle")

#> [[1]]# Chord diagramnetVisual_individual(cellchat, signaling = pathways.show, pairLR.use = LR.show, layout = "chord")#> Note: The first link end is drawn out of sector 'Inflam. FIB'.

#> [[1]]
自動保存所有推斷網絡的模塊以進行快速探索
在實際使用中,用戶可以使用‘for … loop’自動保存所有推斷網絡快速探索使用。 netVisual,netVisual支持svg、png和pdf格式的輸出。
# Access all the signaling pathways showing significant communicationspathways.show.all <- cellchat@netP$pathways# check the order of cell identity to set suitable vertex.receiverlevels(cellchat@idents)vertex.receiver = seq(1,4)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], vertex.receiver = vertex.receiver, layout = "hierarchy") # 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 = 3, height = 2, units = 'in', dpi = 300)}
可視化由多個配體受體或信號通路調節(jié)的細胞通信
氣泡圖
我們還可以使用netVisual_bubble顯示從某些細胞組到其他細胞組的所有重要相互作用(L-R對)。
# show all the significant interactions (L-R pairs) from some cell groups (defined by 'sources.use') to other cell groups (defined by 'targets.use')netVisual_bubble(cellchat, sources.use = 4, targets.use = c(5:11), remove.isolate = FALSE)#> Comparing communications on a single object

# show all the significant interactions (L-R pairs) associated with certain signaling pathwaysnetVisual_bubble(cellchat, sources.use = 4, targets.use = c(5:11), signaling = c("CCL","CXCL"), remove.isolate = FALSE)#> Comparing communications on a single object

和弦圖
類似于氣泡圖,cellchat提供了繪制和弦圖的功能netVisual_chord_gene
- 顯示從某些細胞組到其他細胞組的所有相互作用(L-R對或信號通路)。兩個特殊情況:一個顯示從一個細胞組發(fā)送的所有交互,另一個顯示一個細胞組接收的所有交互。
- 顯示用戶輸入的交互或用戶定義的某些信號通路
# show all the significant interactions (L-R pairs) from some cell groups (defined by 'sources.use') to other cell groups (defined by 'targets.use')# show all the interactions sending from Inflam.FIBnetVisual_chord_gene(cellchat, sources.use = 4, targets.use = c(5:11), lab.cex = 0.5,legend.pos.y = 30)#> Note: The first link end is drawn out of sector 'MIF'.

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

# show all the significant interactions (L-R pairs) associated with certain signaling pathwaysnetVisual_chord_gene(cellchat, sources.use = c(1,2,3,4), targets.use = c(5:11), signaling = c("CCL","CXCL"),legend.pos.x = 8)#> Note: The second link end is drawn out of sector 'CXCR4 '.#> Note: The first link end is drawn out of sector 'CXCL12 '.

# show all the significant signaling pathways from some cell groups (defined by 'sources.use') to other cell groups (defined by 'targets.use')netVisual_chord_gene(cellchat, sources.use = c(1,2,3,4), targets.use = c(5:11), slot.name = "netP", 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值來調整參數。
使用小提琴/點圖繪制信號基因表達分布
我們可以利用Seurat 包裝的函數plotGeneExpression繪制與L-R對或信號通路相關的信號基因的基因表達分布圖。
plotGeneExpression(cellchat, signaling = "CXCL")#> Registered S3 method overwritten by 'spatstat':#> method from#> print.boxx cli#> 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.

默認情況下,用戶可以通過plotGeneExpression只顯示與推斷的重要通信相關的信號基因的表達。
plotGeneExpression(cellchat, signaling = "CXCL", enriched.only = FALSE)
或者,用戶可以使用extractEnrichedLR提取與推斷的L-R對或信號通路相關的信號基因,然后使用Seurat包繪制基因表達圖。
第四部分:細胞通信網絡系統(tǒng)分析
為了便于對復雜的細胞間通信網絡進行解釋,CellChat 通過從圖形理論、模式識別和多重學習中抽象的方法對網絡進行量化。
- 它可以使用網絡分析的集中度措施確定給定信號網絡中的主要信號源和目標以及調節(jié)者和影響者
- 它可以通過利用模式識別方法預測特定細胞類型的關鍵傳入和傳出信號,以及不同細胞類型之間的協調響應。
- 它可以通過定義相似度測量方法和從功能和拓撲角度進行多重學習來分組信號通路。
- 它可以通過對多個網絡的聯合多重學習來描繪保存上下文特定的信號通路。
識別細胞組的信號角色(例如,占主導地位的發(fā)送器、接收器)以及主要貢獻信號
CellChat 允許通過計算每個細胞組的多個網絡中心測量,隨時識別細胞間通信網絡中占主導地位的發(fā)送者、接收者、調解者和影響者。具體來說,我們在加權導向網絡中采用了措施,包括度外、度內、介于兩者之間流動和信息集中度,分別識別細胞間通信的主要發(fā)送者、接收者、調解者和影響者。在以權重為計算通信概率的加權定向網絡中,將外向度計算為來自細胞組的傳出信號的通信概率之和,并計算為傳入信號對單元組通信概率的總和的度內,可用于分別識別信號網絡的主要單元件發(fā)送器和接收器。有關信息中心之間流動的定義,請查看本文及相關參考文獻。
計算和可視化網絡中心分數
# Compute the network centrality scorescellchat <- netAnalysis_computeCentrality(cellchat, slot.name = "netP") # the slot 'netP' means the inferred intercellular communication network of signaling pathways# Visualize the computed centrality scores using heatmap, allowing ready identification of major signaling roles of cell groupsnetAnalysis_signalingRole_network(cellchat, signaling = pathways.show, width = 8, height = 2.5, font.size = 10)

在 2D 空間中可視化占主導地位的發(fā)送器(源)和接收器(目標)
我們還提供了另一種直觀方法,使用散點圖在 2D 空間中可視化占主導地位的發(fā)射器(源)和接收器(目標)。
# Signaling role analysis on the aggregated cell-cell communication network from all signaling pathwaysgg1 <- netAnalysis_signalingRole_scatter(cellchat)#> Signaling role analysis on the aggregated cell-cell communication network from all signaling pathways# Signaling role analysis on the cell-cell communication networks of interestgg2 <- netAnalysis_signalingRole_scatter(cellchat, signaling = c("CXCL", "CCL"))#> Signaling role analysis on the cell-cell communication network from user's inputgg1 + gg2

識別對某些細胞組的傳出或傳入信號貢獻最大的信號
我們還可以回答以下問題:哪些信號對某些細胞組的傳出或傳入信號貢獻最大。
# Signaling role analysis on the aggregated cell-cell communication network from all signaling pathwaysht1 <- netAnalysis_signalingRole_heatmap(cellchat, pattern = "outgoing")ht2 <- netAnalysis_signalingRole_heatmap(cellchat, pattern = "incoming")ht1 + ht2

# Signaling role analysis on the cell-cell communication networks of interestht <- netAnalysis_signalingRole_heatmap(cellchat, signaling = c("CXCL", "CCL"))
確定全局通信模式,探索多個細胞類型和信號通路如何協調在一起
除了探索單個通路的詳細通信外,一個重要問題是多個細胞組和信號通路如何協調功能。CellChat 采用模式識別方法識別全局通信模式。
隨著模式數量的增加,可能會有多余的模式,因此很難解釋通信模式。我們選擇了五種模式作為默認模式。一般來說,它具有生物學意義,模式數量要大于2。此外,我們還提供了一個函數selectK來推斷模式的數量,該數基于 NMF R 包中已實施的兩個指標Cophenetic和Silhouette。這兩個指標都根據共識矩陣的分層聚類來衡量特定數量模式的穩(wěn)定性。對于一系列模式,適當的模式數量是Cophenetic 和 Silhouette值開始突然下降的模式。
識別和可視化分泌細胞的傳出通信模式
傳出模式揭示了發(fā)送者細胞(即作為信號源的細胞)如何相互協調,以及它們如何與某些信號通路協調以驅動通信。
為了直觀地顯示潛在模式與細胞群和配體受體對或信號通路的關聯,我們使用了河流(沖積)圖。我們首先將每行 W 和 H 的每列標準化為 [0,1],然后在 W 和 H 中設置為零,如果它們小于 0.5。這種閾值允許發(fā)現與每個推斷模式相關的最豐富的細胞組和信號通路,即每個細胞組或信號通路僅與一個推斷模式相關聯。這些閾值矩陣 W 和 H 用作創(chuàng)建沖積圖的輸入。
為了將細胞群與其豐富的信號通路直接聯系起來,如果 W 和 H 中的元素少于 1/R(R 是潛在模式數),則我們將它們中的元素設置為零。通過使用不太嚴格的閾值,可以獲得與每個細胞組相關的更豐富的信號通路。我們使用每個細胞組對通過乘以 W 乘以 H 計算的每個信號通路的貢獻分數,構建了一個點圖,其中點大小與貢獻分數成正比,以顯示細胞組與其豐富信號通路之間的關聯。用戶還可以降低參數cutoff,以顯示每個細胞組關聯的更豐富的信號通路。
通信模式分析所需的包
library(NMF)#> Loading required package: pkgmaker#> Loading required package: registry#> Loading required package: rngtools#> Loading required package: cluster#> NMF - BioConductor layer [OK] | Shared memory capabilities [NO: bigmemory] | Cores 15/16#> To enable shared memory capabilities, try: install.extras('#> NMF#> ')#> #> Attaching package: 'NMF'#> The following objects are masked from 'package:igraph':#> #> algorithm, comparelibrary(ggalluvial)
在這里,我們運行selectK推斷模式的數量。
selectK(cellchat, pattern = "outgoing")

當傳出模式數為 3 時,Cophenetic 和Silhouette值都開始突然下降。
nPatterns = 3cellchat <- identifyCommunicationPatterns(cellchat, pattern = "outgoing", k = nPatterns)

# river plotnetAnalysis_river(cellchat, pattern = "outgoing")#> Please make sure you have load `library(ggalluvial)` when running this function

# dot plotnetAnalysis_dot(cellchat, pattern = "outgoing")

識別和可視化目標細胞的傳入通信模式
傳入模式顯示目標細胞(即信號接收器中的細胞)如何相互協調,以及它們如何與某些信號通路協調以響應傳入的信號。
selectK(cellchat, pattern = "incoming")

當傳入模式的數量為 4 時,Cophenetic 值開始下降。
nPatterns = 4cellchat <- identifyCommunicationPatterns(cellchat, pattern = "incoming", k = nPatterns)

# river plotnetAnalysis_river(cellchat, pattern = "incoming")#> Please make sure you have load `library(ggalluvial)` when running this function

# dot plotnetAnalysis_dot(cellchat, pattern = "incoming")

信號網絡的多重和分類學習分析
此外,CellChat 能夠量化所有重要信號通路之間的相似性,然后根據其CellChat 網絡的相似性對其進行分組。分組可以基于功能或結構相似性進行。
功能相似性:功能相似度高表示主要發(fā)送器和接收器相似,可解釋為兩個信號通路或兩個配體受體對具有相似的作用。功能相似性分析要求兩個數據集之間的細胞群組成相同。
結構相似性:結構相似性用于比較其信號網絡結構,而不考慮發(fā)送器和接收器的相似性。
根據信號組的功能相似性識別信號組
cellchat <- computeNetSimilarity(cellchat, type = "functional")cellchat <- netEmbedding(cellchat, type = "functional")#> Manifold learning of the signaling networks for a single datasetcellchat <- netClustering(cellchat, type = "functional")#> Classification learning of the signaling networks for a single dataset# Visualization in 2D-spacenetVisual_embedding(cellchat, type = "functional", label.size = 3.5)

# netVisual_embeddingZoomIn(cellchat, type = "functional", nCol = 2)
基于結構相似性識別信號組
cellchat <- computeNetSimilarity(cellchat, type = "structural")cellchat <- netEmbedding(cellchat, type = "structural")#> Manifold learning of the signaling networks for a single datasetcellchat <- netClustering(cellchat, type = "structural")#> Classification learning of the signaling networks for a single dataset# Visualization in 2D-spacenetVisual_embedding(cellchat, type = "structural", label.size = 3.5)

netVisual_embeddingZoomIn(cellchat, type = "structural", nCol = 2)

第五部分:保存cellchat對象
saveRDS(cellchat, file = "cellchat_humanSkin_LS.rds")
以方便后續(xù)使用。