Hi,
I am using CellChat
to analyse my single cell dataset. I am new to the package but I think I understand what most of the functions are doing since there are quite a few vignettes online. I am trying to use the shiny app that CellChat developers provide (CellChatShiny), to view the data more interactively for each pathway. The app uses netVisual_aggregate
to generate hierarchical and circular plots, which for some reason simply does not work with my data. I have scoured every issue I can find on this subject but I can't seem to find the solution.
I have shared my code at the end of the post, but my hierarchical and circular plot are the same, even though I set the layout option to be different. And both of them are just an overlapping circular incoherent blob, so the code runs, which makes the issue even harder to debug. Would appreciate any input.
Code used in the app:
pathways.show <- "KIT"
vertex.receiver = seq(1,19) # a numeric vector. I have 19 celltypes. Reducing this number does not solve the issue.
groupSize <- as.numeric(table(cellchatObject@idents))
netVisual_aggregate(cellchatObject, signaling = pathways.show, vertex.receiver = vertex.receiver, vertex.size = groupSize, pt.title = 14, title.space = 4, vertex.label.cex = 0.8)
Funnily the code does not use layout = "hierarchy"
option, but the exploratory data hosted by CellChat seems to output a hierarchical plot anyway CellChat Explorer.
This outputs:
If I remove all the text and point arguments which I don't understand why would be causing an issue, since I also did install.packages(extrafont)
because I read online that maybe RStudio doesn't have the necessary fonts which could be causing the issues. The edited code looks like:
netVisual_aggregate(cellchatObject, signaling = pathways.show, vertex.receiver = vertex.receiver)
Output:
Now the point is to plot a hierarchical and a circle plot, so I need to use the layout =
option. When I use the above code (since that gives me some result), to add the layout option, I get an error:
Code with layout = hierarchy
:
netVisual_aggregate(cellchatObject, signaling = pathways.show, vertex.receiver = vertex.receiver, layout = "hierarchy")
Error in seq.default(space.v, 0, by = -space.v/(m1 - m - 1)) :
wrong sign in 'by' argument
I get the same error if I add the layout
argument in the CellChat shiny app code. (first code block)
Code with layout = circle
:
netVisual_aggregate(cellchatObject, signaling = pathways.show , layout = "circle")
Gives me the same result as without using the layout option:
I am unsure as to what is going wrong here. When I use the Shiny app code, I get the first image (red circle), irrespective of changing pathways, and for both hierarchical and circle plot tabs.
Thank you for the help!