1、软件的功能
CellChat主要可以做2部分工作:
1)受体-配体互作。CellChatDB包含人类和小鼠中具有文献支持的配体-受体互作关系,包括多聚体和辅酶因子;
2)细胞-细胞交流。根据scRNA-seq推断细胞与细胞之间的交流。
2、软件安装
CellChat包可以利用devtools从Github上安装:
devtools::install_github("sqjin/CellChat")
此外,需要手动安装R依赖包ComplexHeatmap:
devtools::install_github("jokergoo/ComplexHeatmap")
3、软件使用
1)载入需要的R包
library(CellChat)
library(ggplot2)
library(ggalluvial)
options(stringsAsFactors = FALSE)
2)创建CellChat对象
CellChat需要用户输入两个东西:细胞的基因表达矩阵和细胞的标签。对于表达矩阵,行是基因(行名),列是细胞(列名),矩阵需要是标准化以后的,若输入的是原始的counts,可以用CellChat提供的normalizeData进行标准化。细胞的标签信息需要做成一个dataframe,要求行名是细胞的名字。
load("data_input.rda")
data.input = data_input$data # normalized data matrix
identity = data.frame(group = data_input$labels, row.names = names(data_input$labels)) # create a dataframe consisting of the cell labels
unique(identity$group) # check the cell labels
cellchat <- createCellChat(data = data.input)
为CellChat对象添加更多的meta信息
cellchat <- addMeta(cellchat, meta = identity, meta.name = "labels")
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.mouse # use CellChatDB.human if running on human data
showDatabaseCategory(CellChatDB)
dplyr::glimpse(CellChatDB$interaction) # Show the structure of the database
CellChatDB.use <- subsetDB(CellChatDB, search = "Secreted Signaling") # use Secreted Signaling for cell-cell communication analysis
cellchat@DB <- CellChatDB.use # set the used database in the object
对表达数据进行预处理后用于后续的细胞-细胞交流分析。首先识别出在一类细胞中过表达的配体或受体,然后把基因表达数据投射到蛋白质互作网络中。只要配体或受体有一个过表达,则该配体-受体互作对就被识别出来。
cellchat <- subsetData(cellchat) # subset the expression data of signaling genes for saving computation cost
future::plan("multiprocess", workers = 4) # do parallel
cellchat <- identifyOverExpressedGenes(cellchat)
cellchat <- identifyOverExpressedInteractions(cellchat)
cellchat <- projectData(cellchat, PPI.mouse)
3)推断细胞与细胞之间的交流
CellChat给每一个互作对一个概率值并通过随机计算其互作的显著性,概率值的计算既考虑了表达矩阵,又整合了互作的先验知识。
cellchat <- computeCommunProb(cellchat)
cellchat <- computeCommunProbPathway(cellchat)
cellchat <- aggregateNet(cellchat)
4)细胞-细胞交流网络的可视化和系统分析
如果用hierarchy plot展示细胞交流,需要定义vertex.receiver;如果想要可视化信号通路,使用netVisual_aggregate;如果要可视化与信号通路相关的某个配体-受体对使用netVisual_individual。这里以一个信号通路为例:
pathways.show <- c("TGFb")
vertex.receiver = seq(1,9) # a numeric vector
# Hierarchy plot
netVisual_aggregate(cellchat, signaling = pathways.show, vertex.receiver = vertex.receiver, vertex.size = groupSize)
# Circle plot
netVisual_aggregate(cellchat, signaling = pathways.show, layout = "circle", vertex.size = groupSize)
计算每个配体-受体对于整个信号通路的贡献
netAnalysis_contribution(cellchat, signaling = pathways.show)
CellChat allows ready identification of dominant senders, receivers, mediators and influencers in the intercellular communication network by computing several network centrality measures for each cell group.
cellchat <- netAnalysis_signalingRole(cellchat, slot.name = "netP") # the slot 'netP' means the inferred intercellular communication network of signaling pathways
netVisual_signalingRole(cellchat, signaling = pathways.show)
CellChat利用模式识别来识别每种细胞类型全局交流模式和关键的信号通路。
Identify and visualize outgoing communication pattern of secreting cells
nPatterns = 5
cellchat <- identifyCommunicationPatterns(cellchat, pattern = "outgoing", k = nPatterns)
netAnalysis_river(cellchat, pattern = "outgoing") # river plot
netAnalysis_dot(cellchat, pattern = "outgoing") # dot plot
Identify and visualize incoming communication pattern of target cells
nPatterns = 5
cellchat <- identifyCommunicationPatterns(cellchat, pattern = "incoming", k = nPatterns)
netAnalysis_river(cellchat, pattern = "incoming") # river plot
netAnalysis_dot(cellchat, pattern = "incoming") # dot plot
5)信号通路分类
CellChat计算显著信号通路之间的相似性并据此对信号通路分类。分组可以基于结构相似性或者功能相似性。
功能相似性: major senders and receivers are similar, and it can be interpreted as the two signaling pathways or two ligand-receptor pairs exhibit similar and/or redundant roles.
cellchat <- computeNetSimilarity(cellchat, type = "functional")
cellchat <- netEmbedding(cellchat, type = "functional")
cellchat <- netClustering(cellchat, type = "functional")
netVisual_embedding(cellchat, type = "functional")
netVisual_embeddingZoomIn(cellchat, type = "functional")
结构相似性:compare their signaling network structure, without considering the similarity of senders and receivers.
cellchat <- computeNetSimilarity(cellchat, type = "structural")
cellchat <- netEmbedding(cellchat, type = "structural")
cellchat <- netClustering(cellchat, type = "structural")
netVisual_embedding(cellchat, type = "structural")
netVisual_embeddingZoomIn(cellchat, type = "structural")
6)保存CellChat对象
saveRDS(cellchat, file = "cellchat.rds")
原文链接:https://www.jianshu.com/p/593e5a002dc4
作者:wmcandy