打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
cellchat netEmbedding 运行出错
userphoto

2022.10.25 江苏

关注

运行cellchat <- netEmbedding(cellchat,type = “functional”) 报错如下:

Error in runUMAP(Similarity, min.dist = 0.3, n.neighbors = k) : Cannot find UMAP, please install through pip (e.g. pip install umap-learn or reticulate::py_install(packages = 'umap-learn')).

因为没有安装umap实现,按提示在终端使用pip install umap-learn,直接运行后报错还是一样,因为你没有指定R使用的python版本:

重启Rstudio后:

library(reticulate)
use_python('/usr/bin/python3',required = T) #指定安装umap-learn那个版本的python位置
py_version() #看看是不是指定正确

最后运行后报错:

>cellchat <- netEmbedding(cellchat, type = 'functional')  Manifold learning of the signaling networks for a single dataset /Users/yangl/Library/Python/3.8/lib/python/site-packages/umap/umap_.py:132: UserWarning: A large number of your vertices were disconnected from the manifold. Disconnection_distance = 1 has removed 142 edges. It has fully disconnected 3 vertices. You might consider using find_disconnected_points() to find and remove these points from your data. Use umap.utils.disconnected_vertices() to identify them. warn(

或者直接通过运行:reticulate::py_install(packages = 'umap-learn’)。但也依然报错:

>cellchat <- netEmbedding(cellchat, type = 'functional')
Manifold learning of the signaling networks for a single dataset 
C:\Users\zzu\AppData\Local\R-MINI~1\envs\R-RETI~1\lib\site-packages\umap\umap_.py:133: UserWarning: A large number of your vertices were disconnected from the manifold.
Disconnection_distance = 1 has removed 142 edges.
It has fully disconnected 3 vertices.
You might consider using find_disconnected_points() to find and remove these points from your data.
Use umap.utils.disconnected_vertices() to identify them.
f'A large number of your vertices were disconnected from the manifold.\n'

通过google搜索find_disconnected_points(),GitHub issue中有人提问并得到解决方法:https://github.com/sqjin/CellChat/issues/167(即 source(file = 'CellChat_issue167_netClusteringFix.R’) #使用外部导入修改的函数),但依然报错如旧。

最后我通过查看GitHub issue中所有与netEmbedding函数相关的issue,最终找到了解决办法:https://github.com/sqjin/CellChat/issues/196 (换个umap算法实现,结果也会有些许差异)

install.packages('uwot') library(uwot) cellchat <- netEmbedding(cellchat, umap.method = 'uwot',type = 'functional') #调用uwot实现umap, 程序自带,只需使用参数umap.method = 'uwot',无需修改对应的netEmbedding函数源码

尊重他人劳动成果,转载请注明出处:Bluesky's blog » cellchat netEmbedding 运行出错

本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
CellChat 细胞通讯分析(可视化)
文献解析评估长期受辐射的腮腺中的转录景观和细胞间通讯
Open3d学习计划(4)网格
UMAP:强大的可视化&降维工具
Django3 使用 WebSocket 实现 WebShell
编程学习四年后,才知如何把py打包成exe!
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服