CellChat icon indicating copy to clipboard operation
CellChat copied to clipboard

Error in using netVisual_bubble when comparing two datasets

Open jv-20 opened this issue 4 years ago • 6 comments

Hi @sqjin

A quick question. I get the following error when running the following code

netVisual_bubble(cellchat.HC_CDI,sources.use = 6, targets.use = 9,comparison = c(1,2)) Comparing communications on a merged object

Error in seq.default(0.5 + length(dataset.name[comparison]), length(group.names0) *  : 
  wrong sign in 'by' argument

One thing I forgot to include column named "evidence" in the LR database when running cellchat initially. I noticed some functions wouldn't work without having this column, So after I obtained the cellchat results, I added column name "evidence" as follows

#single datasets
cellchat.DS@LR$LRsig$evidence="evidence"
cellchat.HC@LR$LRsig$evidence="evidence"

#merged object
cellchat.HC_DS@LR$HC$LRsig$evidence="evidence"
cellchat.HC_DS@LR$DS$LRsig$evidence="evidence"

Just wanted to check if this would be the cause of error I am receiving when using netVisual_bubble or I have to re-run the analysis with "evidence" column included at the start of the analysis. Any thoughts?

Thank you, Janaki

jv-20 avatar Feb 02 '22 15:02 jv-20

@jv-20 I think the reason might be that there is only one cluster as source and one cluster as target. There may be a bug in such special case. I will check it and you can also run the source code to fix the issue.

sqjin avatar Feb 07 '22 10:02 sqjin

Hi @sqjin , you are correct. It works when the source or target cell types are more than 1. But if there is only one celltype given in source and target, it gives me the above error. Thanks for looking into this. Much appreciated.

jv-20 avatar Feb 07 '22 21:02 jv-20

I came across the same issue when I limited the source and target to 1 cell type. Do you have a quick fix, Jin? I will look at your source codes and see if I can fix it but just to see if you already have a solution. Thanks!

zhanglab2008 avatar Mar 02 '22 22:03 zhanglab2008

May not be an ideal solution but I returned the data frame and reploted it with ggplot. I just have one more question: Why the p value column is greater than 1? In my case they are all 3

zhanglab2008 avatar Mar 02 '22 22:03 zhanglab2008

I am also facing a similar issue with netVisual_bubble where the p-values are all 3. After looking at the source code, I think what is being returned in the size of the circle to be plotted, which is larger for smaller p-values. So 3 actually means that p-value is < 0.01.

Perhaps instead of re-writing the pval column a new column called pval_size (or something similar) could be created?

malosreet avatar Jul 11 '22 19:07 malosreet

@malosreet This is a good suggestion. I will add this later today. Thanks!

sqjin avatar Jul 11 '22 22:07 sqjin