sqjin / CellChat

R toolkit for inference, visualization and analysis of cell-cell communication from single-cell data
GNU General Public License v3.0
607 stars 140 forks source link

How to infer cell-cell communication networks #329

Open madmcay opened 2 years ago

madmcay commented 2 years ago

Hi, thank you so much for the great tool! I have a question about how to infer cell-cell communication networks. I wanted to see interactions between EP (source) and OB (target) or EP (source) and FB (target) in my sample and the hierarchy plot showed TGFb signaling network only between EP (source) and OB2 (target) on the right panel.

image

Based on the average expression of Tgfb2, Acvr1, and Tgfbr1 which are the most enriched components in the TGFb signaling pathway in my sample, the average expression of the three genes is higher in FB1 compared to OB2, for example. Thus, I am wondering why the plot shows interaction only between EP (source) and OB2 (target) on the right panel. If you need any further information to answer my question, please let me know. Thank you for your time and help.

computeAveExpr(cellchat, features = c("Tgfb2"), type = "truncatedMean", trim = 0.01) FB1 OB1 FB2 EP1 OB2 OB3 EP2 Tgfb2 0.738564 0.8681294 0.6255522 0.02334332 0.1498258 0.6418358 0.06777137 computeAveExpr(cellchat, features = c("Acvr1"), type = "truncatedMean", trim = 0.01) FB1 OB1 FB2 EP1 OB2 OB3 EP2 Acvr1 0.4215661 0.333152 0.3455291 0.005673751 0.2084243 0.2977934 0.1539512 computeAveExpr(cellchat, features = c("Tgfbr1"), type = "truncatedMean", trim = 0.01) FB1 OB1 FB2 EP1 OB2 OB3 EP2 Tgfbr1 0.292677 0.3316346 0.3510025 0.03586872 0.2540105 0.2555799 0.2751074

image

sqjin commented 2 years ago

@madmcay This is interesting! The expression pattern indicates that all cell types are likely the targets for the Tgfb2 signaling. Have you figured out the reason?

madmcay commented 2 years ago

That's what I thought but the result did not show it. I have not figured it out yet. Could you please check my code below and let me know if anything is wrong with the code? Thank you!

data.input <- GetAssayData(Seurat_object, assay = "RNA", slot = "data") labels <- Idents(Seurat_object) meta <- data.frame(group = labels, row.names = names(labels)) cellchat <- createCellChat(object = data.input, meta = meta, group.by = "group") CellChatDB <- CellChatDB.mouse CellChatDB.use <- CellChatDB cellchat@DB <- CellChatDB.use cellchat <- subsetData(cellchat) future::plan("multiprocess", workers = 4) cellchat <- identifyOverExpressedGenes(cellchat) cellchat <- identifyOverExpressedInteractions(cellchat) cellchat <- projectData(cellchat, PPI.mouse) cellchat <- computeCommunProb(cellchat, type = "truncatedMean", trim = 0.01, population.size = FALSE) cellchat <- filterCommunication(cellchat, min.cells = 10) cellchat <- computeCommunProbPathway(cellchat) cellchat <- aggregateNet(cellchat) cellchat@netP$pathways groupSize <- as.numeric(table(cellchat@idents)) pathways.show <- c("TGFb") vertex.receiver = c(4, 7) netVisual_aggregate(cellchat, signaling = pathways.show, vertex.receiver = vertex.receiver, vertex.size = groupSize, layout ="hierarchy")

sqjin commented 2 years ago

@madmcay I did not see any clear issues. But can you try cellchat <- computeCommunProb(cellchat, type = "truncatedMean", trim = 0.1)?

madmcay commented 2 years ago

Thank you for your quick response! I tried cellchat <- computeCommunProb(cellchat, type = "truncatedMean", trim = 0.1) and the result did not show any interaction between EP2 and any FB (or OB). image computeAveExpr(cellchat, features = c("Tgfb1", "Acvr1", "Tgfbr1"), type = "truncatedMean", trim = 0.1) FB1 OB1 FB2 EP1 OB2 OB3 EP2 Tgfb1 0.4418750 1.0430450 0.5412189 0 1.2221765 1.1554247 0.07145507 Acvr1 0.3752778 0.2848885 0.2788003 0 0.1639060 0.2411719 0.09576951 Tgfbr1 0.2334411 0.2756424 0.2790356 0 0.2125865 0.2113715 0.20050961 image

sqjin commented 2 years ago

@madmcay Can you check the inferred network of this particular L-R pair? cellchat@net$prob[, , "X"] and cellchat@net$pval[, , "X"], where X is the L-R interaction name in CellChat.

madmcay commented 2 years ago

It seems that the interactions between cell types depend on p-value which is less than 0.05. Among L-R pairs in the TGFB signaling, "TGFB1_ACVR1C_TGFBR2" is one of them to show the interaction between EP1 (or 2) and OB2. If you see below, p-value is 0.03 between EP1 and OB2 and 0.03 between EP2 and OB2. Thus, the interactions were shown in the first hierarchy plot. On the other hand, p-value is 0.06 between EP1 and OB3 and the interaction was not seen in the plot.

cellchat@net$pval[, , "TGFB1_ACVR1C_TGFBR2"] FB1 OB1 FB2 EP1 OB2 OB3 EP2 FB1 1 1 1 1 0.03 0.05 1 OB1 1 1 1 1 0.00 0.00 1 FB2 1 1 1 1 0.03 0.03 1 EP1 1 1 1 1 0.03 0.06 1 OB2 1 1 1 1 0.00 0.00 1 OB3 1 1 1 1 0.00 0.00 1 EP2 1 1 1 1 0.03 0.06 1

Also, I tried trim = 0.1 and p-value was 1 between EP1 (or 2) between OB2 so the interactions were not seen as shown in the second hierarchy plot.

cellchat@net$pval[, , "TGFB1_ACVR1C_TGFBR2"] FB1 OB1 FB2 EP1 OB2 OB3 EP2 FB1 1 1 1 1 1 1 1 OB1 1 1 1 1 1 1 1 FB2 1 1 1 1 1 1 1 EP1 1 1 1 1 1 1 1 OB2 1 1 1 1 1 1 1 OB3 1 1 1 1 1 1 1 EP2 1 1 1 1 1 1 1

However, the communication probability showed higher in EP1 (or 2)-OB3 than in EP1 (or 2)-OB2, which is opposite to p-value.

cellchat@net$prob[, , "TGFB1_ACVR1C_TGFBR2"] FB1OB1FB2EP1 OB2 OB3 EP2 FB1 0 0 0 0 3.159545e-05 5.410243e-05 0 OB1 0 0 0 0 7.227573e-05 1.237249e-04 0 FB2 0 0 0 0 3.930925e-05 6.730724e-05 0 EP1 0 0 0 0 2.655150e-05 4.547379e-05 0 OB2 0 0 0 0 1.034916e-04 1.771448e-04 0 OB3 0 0 0 0 8.595097e-05 1.471266e-04 0 EP2 0 0 0 0 1.647830e-05 2.822231e-05 0

In addition, the average gene expression of Tgfb1, Acvr1c, and Tgfbr2 is below. The Acvr1c expression, for example, is higher in OB3 than OB2.

computeAveExpr(cellchat, features = c("Tgfb1", "Acvr1c", "Tgfbr2"), type = "truncatedMean", trim = 0.01) FB1 OB1 FB2 EP1 OB2 OB3 EP2 Tgfb1 0.4931653 1.025082 0.5982929 0.16028233 1.198464194 1.125824026 0.12731983 Acvr1c 0.0000000 0.000000 0.0000000 0.00000000 0.001091732 0.004340253 0.00000000 Tgfbr2 0.5841754 0.316450 0.4686722 0.01878447 0.329817363 0.275988525 0.07702624

Therefore, I am still wondering how p-value and communication probability are determined. If there is anything I misunderstood, please advise me. Thank you!