netVisual_diffInteraction for specific source & targets
Hi I want to show the differential number of interactions for specific clusters in my dataset. I've tried to choose clusters with the 'netVisual_diffInteraction' function but i get this error message:
netVisual_diffInteraction(cellchat, weight.scale = T, measure = "weight", sources.use = 5, targets.use = 4)
Error in quantile.default(abs(net), probs = 1 - top) :
missing values and NaN's not allowed if 'na.rm' is FALSE
I noticed that this issue has come up before but never really solved. I'm using CellChat v1.3.0.
Hope you can help with this Thanks! Tomer
Hi I want to show the differential number of interactions for specific clusters in my dataset. I've tried to choose clusters with the 'netVisual_diffInteraction' function but i get this error message:
netVisual_diffInteraction(cellchat, weight.scale = T, measure = "weight", sources.use = 5, targets.use = 4)Error in quantile.default(abs(net), probs = 1 - top) : missing values and NaN's not allowed if 'na.rm' is FALSEI noticed that this issue has come up before but never really solved. I'm using CellChat v1.3.0.
Hope you can help with this Thanks! Tomer
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.
Thanks @sdzxzh I added your suggestion after lines 47-48 and it did fixed the issue. However, this is not a fixed solution to the problem so I'm leaving this issue open.
@Tomer9w @sdzxzh Thanks for pointing it out. Adding net[is.na(net)] <- 0 fixed the issue. I have updated this.
Hi all, can you explain how you added "net[is.na(net)] <- 0" to your code to get it to work? I can't figure out how to fit it to my own.
cells <- "Microglia" par(mfrow = c(1,2), xpd=TRUE) netVisual_diffInteraction(cellchatM, weight.scale = T, sources.use = cells)
Fix it now in github.
On Thu, Sep 22, 2022 at 12:16 AM luxhexmaster @.***> wrote:
Hi all, can you explain how you added "net[is.na(net)] <- 0" to your code to get it to work? I can't figure out how to fit it to my own.
cells <- "Microglia" par(mfrow = c(1,2), xpd=TRUE) netVisual_diffInteraction(cellchatM, weight.scale = T, sources.use = cells)
— Reply to this email directly, view it on GitHub https://github.com/sqjin/CellChat/issues/371#issuecomment-1253932596, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHXF63AD6RD3JMZAD67K3D3V7MYEDANCNFSM5OOU4CUQ . You are receiving this because you commented.Message ID: @.***>
Hi @sqjin,
I updated to the latest CellChat version (v1.5.0), but the error is still occurring.
Doing netVisual_diffInteraction works as long as I do it for all cell populations:
par(mfrow = c(1,2), xpd=TRUE) netVisual_diffInteraction(cellchatM, weight.scale = T) netVisual_diffInteraction(cellchatM, weight.scale = T, measure = "weight")
However, when I specify targets and/or sources (like in the example below), I get the error people have described previously:
cells <- "Microglia" par(mfrow = c(1,2), xpd=TRUE) netVisual_diffInteraction(cellchatM, weight.scale = T, sources.use = cells) netVisual_diffInteraction(cellchatM, weight.scale = T, measure = "weight", sources.use = cells)
Error in quantile.default(abs(net), probs = 1 - top) : missing values and NaN's not allowed if 'na.rm' is FALSE.