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

Compare the major sources and targets in 2D space not working #692

Open
elifozcelik opened this issue Sep 12, 2023 · 1 comment
Open

Compare the major sources and targets in 2D space not working #692

elifozcelik opened this issue Sep 12, 2023 · 1 comment

Comments

@elifozcelik
Copy link

Hi, I am trying to get the plots on the tutorial page with the following code:

num.link <- sapply(object.list, function(x) {rowSums(x@net$count) + colSums(x@net$count)-diag(x@net$count)})
weight.MinMax <- c(min(num.link), max(num.link)) # control the dot size in the different datasets
gg <- list()
for (i in 1:length(object.list)) {
  gg[[i]] <- netAnalysis_signalingRole_scatter(object.list[[i]], title = names(object.list)[i], weight.MinMax = weight.MinMax)
}

but its giving the following error

Error in netAnalysis_signalingRole_scatter(object.list[[i]], title = names(object.list)[i],  : 
  Please run `netAnalysis_computeCentrality` to compute the network centrality scores! 

My code before running the plot (after checking out the github page about this error):

Coco <- readRDS("Coco_cellchat_analysis.rds")
Coco <- netAnalysis_computeCentrality(Coco, slot.name = "net", net.name = "Coco", thresh = 0.05)
Coco <- updateCellChat(Coco)

Milk <- readRDS("Milk_cellchat_analysis.rds")
group.new = levels(Coco@idents)
Milk <- liftCellChat(Milk, group.new)
Milk <- netAnalysis_computeCentrality(Milk, slot.name = "net", net.name = "Milk", thresh = 0.05)
Milk <- updateCellChat(Milk)

object.list <- list("Coco" = Coco, "Milk" = Milk)
cellchat <- mergeCellChat(object.list, add.names = names(object.list))

Thank you.

@ycl6
Copy link

ycl6 commented Sep 28, 2023

Hi @elifozcelik

When you ran netAnalysis_computeCentrality(), you've set slot.name = "net", therefore the network centrality scores is performed with the net data instead of the default netP. When you call netAnalysis_signalingRole_scatter(), you'll need to set slot.name = "net" too, or else, the function will look inside netP and found nothing.

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