解決方法
- 更改clusterProfiler包的源碼并重新編譯
-
下載源碼: Bioconductor - clusterProfiler
image.png 解壓后進入 \clusterProfiler\R,找到文件kegg-utilities.R
-
將131行和137行的http都改為https
image.png 卸載原來的clusterProfiler包
-
重新編譯新的clusterProfiler包:在RStudio中選擇File->New Project -> 選擇下載的源碼文件夾 -> image.png
重新運行代碼,不再報錯
環(huán)境
- clusterProfiler版本:4.4.1
- R語言版本:4.2.0
- ClusterProfiler包的依賴均為最新版本
報錯代碼
kk.degene <- enrichKEGG(gene = c('12306','12307'),
organism = 'hsa',
#universe = gene_all,
pvalueCutoff = 0.05,
qvalueCutoff = 0.05)
報錯信息
"Failed to download KEGG data.",
"Wrong 'species' or the network is unreachable.",
"The 'species' should be one of organisms listed in",
"'https://www.genome.jp/kegg/catalog/org_list.html'"
分析
因為是突然發(fā)生的問題,之前一直沒有遇到過這個問題,所以考慮到是clusterProfiler包或者R語言的版本問題,于是先采用了更新R語言版本以及clusterProfiler包的方法但是沒有能夠解決。
進而搜索資料,網(wǎng)上的解決方法“換個網(wǎng)絡”或者將“hsa改為human”都不work。通過查看API的更新信息以及源碼發(fā)現(xiàn)可能出現(xiàn)問題:
-
KEGG的API發(fā)生變更,從HTTP to HTTPS
image.png - 源碼中download的地址還是使用http
盡管不熟悉網(wǎng)絡請求的原理,但是抱著試一試的態(tài)度將源碼中HTTP改為了HTTPS,發(fā)現(xiàn)能夠成功請求,十分喜悅,特此記錄。
“想到就去試一試”。 -2020602



