Skip to content
This repository has been archived by the owner on Jan 24, 2024. It is now read-only.

error when calling identifyOverExpressedGenes function #186

Closed
idupanloup opened this issue May 3, 2021 · 3 comments
Closed

error when calling identifyOverExpressedGenes function #186

idupanloup opened this issue May 3, 2021 · 3 comments

Comments

@idupanloup
Copy link

I get an error when calling the identifyOverExpressedGenes function.
Here's my code:

object.list <- list(db1 = db1.cellchat, db2 = db2.cellchat, db3 = db3.cellchat, db4 = db4.cellchat)
merged.cellchat <- mergeCellChat(object.list, cell.prefix = TRUE)
Merge the following slots: 'data.signaling','net', 'netP','meta', 'idents', 'var.features' , 'DB', and 'LR'.
Warning message:
In mergeCellChat(object.list, cell.prefix = TRUE) : Prefix cell names!
CellChatDB.use <- CellChatDB
merged.cellchat@DB <- CellChatDB.use
merged.cellchat <- subsetData(merged.cellchat)
Issue identified!! Please check the official Gene Symbol of the following genes:
H2-Q8 H2-T9 H2-T18 H2-Q9 H2-L H2-BI H2-D H60a H2-Ea-ps
merged.cellchat <- identifyOverExpressedGenes(merged.cellchat)
Use the joint cell labels from the merged CellChat object
Error in h(simpleError(msg, call)) :

Many thanks for your feedback !

@sqjin
Copy link
Owner

sqjin commented May 4, 2021

@idupanloup For the merged cellchat object, you cannot run subsetData and identifyOverExpressedGenes. If you want to compare signaling networks across different datasets, you need to first run cellchat on each dataset and then follow the tutorial on the comparison analysis.

@idupanloup
Copy link
Author

idupanloup commented May 4, 2021

@sqjin I ran CellChat on the 2 datasets and now get a new error message:

db1

data.input <- GetAssayData(db1.Seurat, assay = "RNA", slot = "data") # normalized data matrix
labels <- Idents(db1.Seurat)
meta <- data.frame(labels = labels, row.names = names(labels))
db1.cellchat <- createCellChat(object = data.input, meta = meta, group.by = "labels")
rm(db1.Seurat)

db1.cellchat@DB <- CellChatDB.use

db1.cellchat <- subsetData(db1.cellchat)
db1.cellchat <- identifyOverExpressedGenes(db1.cellchat)
db1.cellchat <- identifyOverExpressedInteractions(db1.cellchat)
db1.cellchat <- projectData(db1.cellchat, PPI.mouse)

db1.cellchat <- computeCommunProb(db1.cellchat, raw.use = TRUE)

Filter out the cell-cell communication if there are only few number of cells in certain cell groups

db1.cellchat <- filterCommunication(db1.cellchat, min.cells = 10)

db1.cellchat <- computeCommunProbPathway(db1.cellchat)
db1.cellchat <- aggregateNet(db1.cellchat)

Compute the network centrality scores

db1.cellchat <- netAnalysis_computeCentrality(db1.cellchat, slot.name = "netP")

db2

data.input <- GetAssayData(db2.Seurat, assay = "RNA", slot = "data") # normalized data matrix
labels <- Idents(db2.Seurat)
meta <- data.frame(labels = labels, row.names = names(labels))
db2.cellchat <- createCellChat(object = data.input, meta = meta, group.by = "labels")
rm(db2.Seurat)

db2.cellchat@DB <- CellChatDB.use

db2.cellchat <- subsetData(db2.cellchat)
db2.cellchat <- identifyOverExpressedGenes(db2.cellchat)
db2.cellchat <- identifyOverExpressedInteractions(db2.cellchat)
db2.cellchat <- projectData(db2.cellchat, PPI.mouse)

db2.cellchat <- computeCommunProb(db2.cellchat, raw.use = TRUE)

Filter out the cell-cell communication if there are only few number of cells in certain cell groups

db2.cellchat <- filterCommunication(db2.cellchat, min.cells = 10)

db2.cellchat <- computeCommunProbPathway(db2.cellchat)
db2.cellchat <- aggregateNet(db2.cellchat)

Compute the network centrality scores

db2.cellchat <- netAnalysis_computeCentrality(db2.cellchat, slot.name = "netP")

merged.cellchat

object.list <- list(db1 = db1.cellchat, db2 = db2.cellchat)
merged.cellchat <- mergeCellChat(object.list, add.names = names(object.list), cell.prefix = TRUE)

Merge the following slots: 'data.signaling','net', 'netP','meta', 'idents', 'var.features' , 'DB', and 'LR'.

merged.cellchat@DB <- CellChatDB.use

gg1 <- compareInteractions(merged.cellchat, show.legend = F, group = c(1,2))
gg2 <- compareInteractions(merged.cellchat, show.legend = F, group = c(1,2), measure = "weight")
gg1 + gg2

netVisual_diffInteraction(merged.cellchat, weight.scale = T)
netVisual_diffInteraction(merged.cellchat, weight.scale = T, measure = "weight")

Error in obj2 - obj1 : non-conformable arrays

Do you know what can be the problem ?
Many thanks for your help and valuable feedback !

@sqjin
Copy link
Owner

sqjin commented May 8, 2021

@idupanloup Sorry. I missed your information. I guess the reason is that you have different cell groups between the two datasets. If so , please check the third tutorial.

@sqjin sqjin closed this as completed Jun 19, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants