Error netVisual_heatmap() on a merged object from Seurat
molybdenumt opened this issue · 0 comments
molybdenumt commented
When I try to run netVisual_heatmap() on any of my cellchat object I get
Error in
.rowNamesDF<-`(x, value = value): missing values in 'row.names' are not allowed
Traceback:
- netVisual_heatmap(cellchat.al)
rownames<-
(*tmp*
, value = colnames(mat))row.names<-
(*tmp*
, value = value)row.names<-.data.frame
(*tmp*
, value = value).rowNamesDF<-
(x, value = value)- stop("missing values in 'row.names' are not allowed")
`
Idents(merge2.al) = "celltype"
cellchat.al <- createCellChat(object = merge2.al, group.by = "celltype", assay="RNA")
cellchat.rl <- createCellChat(object = merge2.rl, group.by = "celltype", assay="RNA")
CellChatDB <- CellChatDB.human
showDatabaseCategory(CellChatDB)
CellChatDB.use <- subsetDB(CellChatDB, search = "Secreted Signaling", key = "annotation")
cellchat.al@DB <- CellChatDB.use
cellchat.rl@DB <- CellChatDB.use
cellchat.al <- subsetData(cellchat.al) # This step is necessary even if using the whole database
cellchat.rl <- subsetData(cellchat.rl) # This step is necessary even if using the whole database
cellchat.al <- identifyOverExpressedGenes(cellchat.al)
cellchat.al <- identifyOverExpressedInteractions(cellchat.al)
cellchat.rl <- identifyOverExpressedGenes(cellchat.rl)
cellchat.rl <- identifyOverExpressedInteractions(cellchat.rl)
cellchat.al <- setIdent(cellchat.al, ident.use = "celltype")
cellchat.al@idents = droplevels(cellchat.al@idents, exclude = setdiff(levels(cellchat.al@idents), unique(cellchat.al@idents)))
cellchat.rl <- setIdent(cellchat.rl, ident.use = "celltype") # set "celltype2" as default cell identity
cellchat.rl@idents = droplevels(cellchat.rl@idents, exclude = setdiff(levels(cellchat.rl@idents), unique(cellchat.rl@idents)))
cellchat.al <- computeCommunProb(cellchat.al, type = "triMean")
cellchat.al <- filterCommunication(cellchat.al, min.cells = 10)
cellchat.al <- computeCommunProbPathway(cellchat.al)
cellchat.al <- aggregateNet(cellchat.al)
cellchat.rl <- filterCommunication(cellchat.rl, min.cells = 10)
cellchat.rl <- computeCommunProbPathway(cellchat.rl)
cellchat.rl <- aggregateNet(cellchat.rl)
group.new = levels(cellchat.al@idents)
cellchat.rl <- liftCellChat(cellchat.rl, group.new)
object.list <- list(AL = cellchat.al, RL = cellchat.rl)
cellchat.alrl <- mergeCellChat(object.list, add.names = names(object.list))
gg1 <- compareInteractions(cellchat.alrl, show.legend = F, group = c(1,2))
gg2 <- compareInteractions(cellchat.alrl, show.legend = F, group = c(1,2), measure = "weight")
gg1 + gg2
par(mfrow = c(1,1), xpd=TRUE)
netVisual_diffInteraction(cellchat.alrl, weight.scale = T)
netVisual_diffInteraction(cellchat.alrl, weight.scale = T, measure = "weight")
netVisual_heatmap(cellchat.alrl)
Do heatmap based on a single object
Error in .rowNamesDF<-
(x, value = value): missing values in 'row.names' are not allowed
Traceback:
- netVisual_heatmap(cellchat.al)
rownames<-
(*tmp*
, value = colnames(mat))row.names<-
(*tmp*
, value = value)row.names<-.data.frame
(*tmp*
, value = value).rowNamesDF<-
(x, value = value)- stop("missing values in 'row.names' are not allowed")