forked from mcrewcow/Axolotl_CellChatDB
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cellchat.R
36 lines (32 loc) · 1.62 KB
/
cellchat.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
library(Seurat)
library(SeuratDisk)
library(CellChat)
axolotl <- readRDS("G:/DPayz_sysAct_seurat_20230327.rds")
axolottest <- axolotl
axolotl_contra <- subset(axolottest, subset = sample == c('contra'))
axolotl_intact <- subset(axolottest, subset = sample == c('intact'))
head(axolotl_intact)
table([email protected])
interaction_input <- read.csv(file = 'C://Users/Emil/10X/cellchat/interaction_input_CellChatDB.csv', row.names = 1)
complex_input <- read.csv(file = 'C://Users/Emil/10X/cellchat/complex_input_CellChatDB.csv', row.names = 1)
cofactor_input <- read.csv(file = 'C://Users/Emil/10X/cellchat/cofactor_input_CellChatDB.csv', row.names = 1)
geneInfo <- read.csv(file = 'C://Users/Emil/10X/cellchat/geneInfo_input_CellChatDB.csv', row.names = 1)
CellChatDB <- list()
CellChatDB$interaction <- interaction_input
CellChatDB$complex <- complex_input
CellChatDB$cofactor <- cofactor_input
CellChatDB$geneInfo <- geneInfo
CellChatDB.mouse <- CellChatDB
cellchat <- subsetData(cellchat)
cellchat <-IdentifyOverExpressedGenes(cellchat)
cellchat <- identifyOverExpressedInteractions(cellchat)
cellchat <- projectData(cellchat, PPI.mouse)
cellchat <- computeCommunProb(cellchat, type = "truncatedMean", trim = 0, raw.use = FALSE, population.size = TRUE)
cellchat <- filterCommunication(cellchat, min.cells = 3)
cellchat <- computeCommunProbPathway(cellchat)
cellchat <- aggregateNet(cellchat)
cellchat <- netAnalysis_computeCentrality(cellchat, slot.name = "netP")
ht1 <- netAnalysis_signalingRole_heatmap(cellchat, pattern = "outgoing")
ht2 <- netAnalysis_signalingRole_heatmap(cellchat, pattern = "incoming")
ht1 + ht2