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

Error netVisual_heatmap() on a merged object from Seurat #732

Open
molybdenumt opened this issue Dec 11, 2023 · 0 comments
Open

Error netVisual_heatmap() on a merged object from Seurat #732

molybdenumt opened this issue Dec 11, 2023 · 0 comments

Comments

@molybdenumt
Copy link

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:

  1. netVisual_heatmap(cellchat.al)
  2. rownames<-(*tmp*, value = colnames(mat))
  3. row.names<-(*tmp*, value = value)
  4. row.names<-.data.frame(*tmp*, value = value)
  5. .rowNamesDF<-(x, value = value)
  6. 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:

  1. netVisual_heatmap(cellchat.al)
  2. rownames<-(*tmp*, value = colnames(mat))
  3. row.names<-(*tmp*, value = value)
  4. row.names<-.data.frame(*tmp*, value = value)
  5. .rowNamesDF<-(x, value = value)
  6. stop("missing values in 'row.names' are not allowed")
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

1 participant