跑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

分開跑后發(fā)現(xiàn)是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

翻了下網(wǎng)上應(yīng)該是igraph包version的問題,換個鏡像解決了

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容