今天在R中安装使用 clusterProfiler() 对小麦差异蛋白进行GO注释时,运行library(clusterProfiler)反复提示缺少"DO.db"、"GO.db"、“bindrcpp”等包,以及“R6”包版本太低等问题,其中"DO.db"、"GO.db"可以通过BiocManager进行安装:
> if (!requireNamespace("BiocManager", quietly = TRUE))
install.packages("BiocManager")
> BiocManager::install("DO.db", version = "3.8")
> BiocManager::install("GO.db", version = "3.8")
但在升级R6时反复遇到问题,典型例子如下:
> update.packages(ask='graphics',checkBuilt=TRUE)
There is a binary version available but the source version is later:
binary source needs_compilation
R6 2.3.0 2.4.0 FALSE
installing the source package ‘R6’
trying URL 'https://mirror.lzu.edu.cn/CRAN/src/contrib/R6_2.4.0.tar.gz'
Content type 'application/octet-stream' length 31545 bytes (30 KB)
downloaded 30 KB
* installing *source* package 'R6' ...
** package 'R6' successfully unpacked and MD5 sums checked
** R
** byte-compile and prepare package for lazy loading
Error in unloadNamespace(pkg_name) :
namespace 'R6' is imported by 'shiny', 'promises' so cannot be unloaded
* removing 'D:/mysoft/R/R-3.5.2/library/R6'
* restoring previous 'D:/mysoft/R/R-3.5.2/library/R6'
In R CMD INSTALL
The downloaded source packages are in
‘C:\Users\Administrator\AppData\Local\Temp\Rtmp6Xugno\downloaded_packages’
Warning message:
In install.packages(update[instlib == l, "Package"], l, repos = repos, :
installation of package ‘R6’ had non-zero exit status
无论怎么折腾‘shiny’和‘promises’都无法升级成功,即难以通过常规方法进行升级。进入提示的‘C:\Users\Administrator\AppData\Local\Temp\Rtmp6Xugno\downloaded_packages’发现R默认下载的是Tar ball,和其他正常安装包的形式有所不同,于是自己尝试直接到CRAN网站(https://mirrors.tongji.edu.cn/CRAN/web/packages/R6/index.html)上下载了R6的二进制版本,解压后直接拷到“\R-3.5.2\library\”目录下,再尝试 library(clusterProfiler) 载入clusterProfiler居然成功了!
即二进制版本的R包可以直接放入/library/下进行使用。另外旧版本R下的包在直接复制到新版本的/library/下后能直接使用,这点其实还是挺方便的。