①
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的问题,换个镜像解决了