一:最近,KEGG用起来会出现报错,如下所示:
fail to download KEGG data...
Error in download.KEGG.Path(species) :
'species' should be one of organisms listed in 'http://www.genome.jp/kegg/catalog/org_list.html'...
In addition: Warning message:
In utils::download.file(url, quiet = quiet, method = "libcurl", :
URL 'https://rest.kegg.jp/link/hsa/pathway': status was 'Failure when receiving data from the peer'
网上也有很多比较好的,也可能行之有效的方法,比如:
1. 建明老师的方法是:
library(R.utils)
R.utils::setOption("clusterProfiler.download.method",'auto')
2.Y叔的:
options(clusterProfiler.download.method = "wininet")
3.或者改用其他下载方式:
目前的下载方式有“internal”、“wininet”(仅限Windows)、“libcurl”、“wget”和“curl”,其中有一个值“auto”:参见‘Details’和‘Note’。
由于的作者在linux上运行R,所以
options(clusterProfiler.download.method = "wget")
然后成功运行,如果大家在前面的运行的有问题,可以把这几个方法都尝试一遍。
参见:
(最全)关于fail to download KEGG data... Error in download.KEGG.Path(species) - 知乎 (zhihu.com)
二、我是在linux上跑的R,以上方法都试过了,还是报错,
继续寻找网上的一些方法,大家说可能是R版本问题,有人用R4.1.3运行上述解决方法就成功了,于是我决定尝试一下,但是我没有在linux上重装R4.1.3,而是在自己电脑上下了一个R4.1.3,可参见这篇文章进行下载:(2条消息) 安装低版本的R语言、和自行下载安装各个版本的R语言包、以及多环境运行R_卧新实验室的博客-CSDN博客_r语言旧版本安装
然后切换RStudio的R版本,相关操作也可参考上面那篇文章。
然后重新下载相关R包 ,
if (!requireNamespace("BiocManager", quietly = TRUE))
install.packages("BiocManager")
library(BiocManager)
library(dplyr)
library(Seurat)
library(patchwork)
library(ggplot2)
BiocManager::install('clusterProfiler')
library(clusterProfiler)
library(org.Hs.eg.db) ##加载人类
install.packages("R.utils")
library(R.utils)
#改变KEGG下载方式
getOption("clusterProfiler.download.method")
R.utils::setOption("clusterProfiler.download.method","auto")
成功!
> ekegg <- enrichKEGG(gene, organism = organism)
Reading KEGG annotation online:
Reading KEGG annotation online:
版权声明:本文为x_yAOTU原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。