CellChat icon indicating copy to clipboard operation
CellChat copied to clipboard

netVisual_diffInteraction: Error in quantile.default(abs(net), probs = 1 - top)

Open zqun1 opened this issue 3 years ago • 10 comments

Hi, thanks for the wonderful tool. I am using v1.0.0, though I could not find the newest 1.1.0. I have many cell types so I wanted to subset some and draw the circle plot. When I run the following without specifying cells, everything was fine. par(mfrow = c(1,2), xpd=TRUE) netVisual_diffInteraction(cellchat, weight.scale = T) However, when I specify the cells, par(mfrow = c(1,2), xpd=TRUE) netVisual_diffInteraction(cellchat, weight.scale = T,sources.use = c(1,2,6,7,9),targets.use = c(1,2,6,7,9)) it throws error: "Error in quantile.default(abs(net), probs = 1 - top) : missing values and NaN's not allowed if 'na.rm' is FALSE" I tried to search in the existing issues and found other users also had the problem but you claimed to have fixed it in Feb. I reinstalled CellChat (still v1.0.0) but the problem remained. Could you help please?

zqun1 avatar May 18 '21 20:05 zqun1

@zqun1 It should work now. I suggest you check out the new function subsetCellChat to focus on a subset groups.

sqjin avatar May 20 '21 07:05 sqjin

@sqjin Hi Suoqin, I updated CellChat to the newest version 1.1.0, and rerun my code. It still got an error but the error is different: " " Error in polygon(p[1, ], p[2, ], border = color, lwd = width, lty = lty) : invalid value specified for graphical parameter "lwd" ". I found other users also faced this error for netVisual_aggregate before and got solved. If you need my source data, I can also email you.

I suggest you check out the new function subsetCellChat to focus on a subset groups.

Do you mean you suggest I subset my interest cells, i.e. c(1,2,6,7,9)? This method is feasible but generates extra data variables. Anyway, the lwd bug should be fixed, isn't it? Thank you in advance!

zqun1 avatar May 25 '21 09:05 zqun1

I am having the same error message after updating to CellChat v1.1.0

lizanyu avatar May 27 '21 17:05 lizanyu

@zqun1 Yes, please share me the data and I will take a look. @lizanyu

sqjin avatar May 27 '21 17:05 sqjin

@zqun1 Yes, please share me the data and I will take a look. @lizanyu

@zqun1 I just shared my repository with you! Thanks for your help!

lizanyu avatar Jun 04 '21 23:06 lizanyu

@zqun1 Yes, please share me the data and I will take a look. @lizanyu

I also have this problem when I do netVisual_diffInteraction(cellchat, weight.scale = T, comparison = c('Normal', 'Tumor'), targets.use = 'CC') there have error

Error in quantile.default(abs(net), probs = 1 - top) : missing values and NaN's not allowed if 'na.rm' is FALSE

hahia avatar Jun 22 '21 12:06 hahia

I have the same issue when I tried to show the cell types of interest but not all cell types. Here is the error:

Error in quantile.default(abs(net), probs = 1 - top) : 
  missing values and NaN's not allowed if 'na.rm' is FALSE

I will take a look at your source and see if I can modify it.

zhanglab2008 avatar Aug 23 '21 03:08 zhanglab2008

I have the same issue when I tried to show the cell types of interest but not all cell types. Here is the error:

Error in quantile.default(abs(net), probs = 1 - top) : 
  missing values and NaN's not allowed if 'na.rm' is FALSE

@zqun1 Yes, please share me the data and I will take a look. @lizanyu

I also have this problem when I do netVisual_diffInteraction(cellchat, weight.scale = T, comparison = c('Normal', 'Tumor'), targets.use = 'CC') there have error

Error in quantile.default(abs(net), probs = 1 - top) : missing values and NaN's not allowed if 'na.rm' is FALSE

I found that the NA data could be generated from line 47-48. Add net[is.na(net)] <- 0 behind them could solve this problem.

sdzxzh avatar Feb 14 '22 19:02 sdzxzh

@sdzxzh I can't find the reference code so I'm not sure how you added "net[is.na(net)] <- 0" to fix the error. Could you elaborate on this?

My current code is:

cells <- "Microglia" par(mfrow = c(1,2), xpd=TRUE) netVisual_diffInteraction(cellchatM, weight.scale = T, sources.use = cells)

and I get the same error code described previously.

Error in quantile.default(abs(net), probs = 1 - top) : missing values and NaN's not allowed if 'na.rm' is FALSE

luxhexmaster avatar Sep 21 '22 16:09 luxhexmaster

@

@sdzxzh I can't find the reference code so I'm not sure how you added "net[is.na(net)] <- 0" to fix the error. Could you elaborate on this?

My current code is:

cells <- "Microglia" par(mfrow = c(1,2), xpd=TRUE) netVisual_diffInteraction(cellchatM, weight.scale = T, sources.use = cells)

and I get the same error code described previously.

Error in quantile.default(abs(net), probs = 1 - top) : missing values and NaN's not allowed if 'na.rm' is FALSE

Fix it now.

sqjin avatar Sep 21 '22 23:09 sqjin

Many thanks for your dedication @sqjin, it works with the last update!

flde avatar Oct 20 '22 14:10 flde