跑cellchat遇到的bug

gg1 <- netVisual_heatmap(cellchat)
#> Do heatmap based on a merged object
gg2 <- netVisual_heatmap(cellchat, measure = "weight")
#> Do heatmap based on a merged object
gg1 + gg2
#Error in grid.Call.graphics(C_downvppath, name$path, name$name, strict): Viewport 'Relative values_heatmap_body_1_1' was not found

分开跑后发现是gg1 + gg2出问题
存成pdf即可解决

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)
}
#> Signaling role analysis on the aggregated cell-cell communication network from all signaling pathways
#> Signaling role analysis on the aggregated cell-cell communication network from all signaling pathways
patchwork::wrap_plots(plots = gg)
#Error in netAnalysis_signalingRole_scatter(object.list[[i]], title = names(object.list)[i], : Please run `netAnalysis_computeCentrality` to compute the network centrality scores!

这个就比较明显,netAnalysis_computeCentrality一下就行,需要两个cellchat对象分开跑然后merge,不然报错

cellchat.NL <- netAnalysis_computeCentrality(cellchat.NL, slot.name = "netP") 
cellchat.LS <- netAnalysis_computeCentrality(cellchat.LS, slot.name = "netP") 
object.list <- list(NL = cellchat.NL, LS = cellchat.LS)
cellchat <- mergeCellChat(object.list, add.names = names(object.list))

par(mfrow = c(1,2), xpd=TRUE)
netVisual_diffInteraction(cellchat, weight.scale = T)
netVisual_diffInteraction(cellchat, weight.scale = T, measure = "weight")
#Error in i set edge attr(x, attr(value, "name"), index = value, value = attr(value, : Length of new attribute value must be 1 or 25.the number of target edges, not 22

翻了下网上应该是igraph包version的问题,换个镜像解决了

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容