bioconductor有新的镜像选择啦(西湖大学)

2024-05-27 17:16:50 浏览数 (2)

我的电脑里面有一千多个生物信息学多组学数据处理相关的r包,最近三五年基本上没有怎么安装过新的包,但是最近在一个新电脑里面进行视频号直播的时候发现下面的代码读取cel文件格式的affymetrix表达量芯片的时候其实是会自动安装一个包:

代码语言:javascript复制
library(oligo) 
celFiles <- list.celfiles('../cel_files/',listGzipped = T,
                          full.name=TRUE) 
exon_data <- oligo::read.celfiles( celFiles ) 

如下所示:

代码语言:javascript复制
> celFiles
 [1] "../cel_files//GSM756992_KS1-HG_U133A_2-2757.CEL.gz"
 [2] "../cel_files//GSM756993_KS1-HG_U133A_2-2871.CEL.gz"
 [3] "../cel_files//GSM756994_KS1-HG_U133A_2-2901.CEL.gz"
 [4] "../cel_files//GSM756995_KS1-HG_U133A_2-2905.CEL.gz"
 
Loading required package: pd.hg.u133a.2
Attempting to obtain 'pd.hg.u133a.2' from BioConductor website.
Checking to see if your internet connection works...
'getOption("repos")' replaces Bioconductor standard repositories, see
'help("repositories", package = "BiocManager")' for details.
Replacement repositories:
    CRAN: https://cran.rstudio.com/

假如你不使用bioconductor的镜像但是你又在中国大陆地区,就会遇到下面的报错;

代码语言:javascript复制
试开URL’https://bioconductor.org/packages/3.17/data/annotation/src/contrib/pd.hg.u133a.2_3.12.0.tar.gz'
Content type 'application/gzip' length 9843108 bytes (9.4 MB)
downloaded 6.3 MB

Error in download.file(url, destfile, method, mode = "wb", ...) : 
  download from 'https://bioconductor.org/packages/3.17/data/annotation/src/contrib/pd.hg.u133a.2_3.12.0.tar.gz' failed
此外: Warning messages:
1: In download.file(url, destfile, method, mode = "wb", ...) :
  downloaded length 0 != reported length 0
2: In download.file(url, destfile, method, mode = "wb", ...) :
  URL 'https://mghp.osn.xsede.org/bir190004-bucket01/archive.bioconductor.org/packages/3.17/data/annotation/src/contrib/pd.hg.u133a.2_3.12.0.tar.gz': status was 'Transferred a partial file'
Warning in download.packages(pkgs, destdir = tmpd, available = available,  :
  下载程序包‘pd.hg.u133a.2’时出了问题
载入需要的程辑包:pd.hg.u133a.2
There was a problem during download or installation.
Package 'pd.hg.u133a.2' cannot be loaded. Please, try again.
Error in oligo::read.celfiles(celFiles) : 
  The annotation package, pd.hg.u133a.2, could not be loaded.
此外: Warning message:
In library(package, lib.loc = lib.loc, character.only = TRUE, logical.return = TRUE,  :
  不存在叫‘pd.hg.u133a.2’这个名字的程辑包

在中国大陆,其实网络问题非常恶心的,下载一个 (9.4 MB)的包需要三五年的时间,而且大概率会失败,比如我上面就仅仅是下载了 6.3 MB 是一个不完整的包,所以安装会失败。这个时候需要设置一下时间问题:

代码语言:javascript复制
getOption('timeout')
options(timeout=10000)

就算是这样,大家也不可能说去等待三五年去安装一个r包,所以就需要镜像帮助你。假如你使用了传统的镜像地址,就是我们一直推荐的清华大学的镜像:

代码语言:javascript复制
rm(list = ls()) 
options()$repos 
options()$BioC_mirror
#options(BioC_mirror="https://mirrors.ustc.edu.cn/bioc/")
options(BioC_mirror="http://mirrors.tuna.tsinghua.edu.cn/bioconductor/")
options("repos" = c(CRAN="https://mirrors.tuna.tsinghua.edu.cn/CRAN/"))
options()$repos 
options()$BioC_mirror

会发现,仍然是会报错,如下所示:

代码语言:javascript复制
载入需要的程辑包:pd.hg.u133a.2
Attempting to obtain 'pd.hg.u133a.2' from BioConductor website.
Checking to see if your internet connection works...
'getOption("repos")' replaces Bioconductor standard repositories, see 'help("repositories",
package = "BiocManager")' for details.
Replacement repositories:
    CRAN: https://mirrors.tuna.tsinghua.edu.cn/CRAN/
Warning: 无法在貯藏處http://mirrors.tuna.tsinghua.edu.cn/bioconductor//packages/3.17/bioc/src/contrib中读写索引:
  无法打开URL'http://mirrors.tuna.tsinghua.edu.cn/bioconductor//packages/3.17/bioc/src/contrib/PACKAGES'
Warning: 无法在貯藏處http://mirrors.tuna.tsinghua.edu.cn/bioconductor//packages/3.17/data/annotation/src/contrib中读写索引:
  无法打开URL'http://mirrors.tuna.tsinghua.edu.cn/bioconductor//packages/3.17/data/annotation/src/contrib/PACKAGES'
Warning: 无法在貯藏處http://mirrors.tuna.tsinghua.edu.cn/bioconductor//packages/3.17/data/experiment/src/contrib中读写索引:
  无法打开URL'http://mirrors.tuna.tsinghua.edu.cn/bioconductor//packages/3.17/data/experiment/src/contrib/PACKAGES'
Warning: 无法在貯藏處http://mirrors.tuna.tsinghua.edu.cn/bioconductor//packages/3.17/workflows/src/contrib中读写索引:
  无法打开URL'http://mirrors.tuna.tsinghua.edu.cn/bioconductor//packages/3.17/workflows/src/contrib/PACKAGES'
Package 'pd.hg.u133a.2' was not found in the BioConductor repository.
The 'pdInfoBuilder' package can often be used in situations like this.
Error in oligo::read.celfiles(celFiles) : 
  The annotation package, pd.hg.u133a.2, could not be loaded.

如果大家打开上面的URL就会发现是;404 Not Found nginx/1.22.1 ,因为清华大学现在开始节省资源了,别说是3.17了,哪怕是3.18都不是主要的直接下载,目前(2024年05月26日 )能直接下载的 是 3.19,而且需要配合4.4版本的r,而我的电脑还是4.3,所以就很尴尬。我们的马拉松助教团队给大家整理了这个问题:

代码语言:javascript复制
根据 Bioconductor 的安排,在 5 月 15 日,3.18 及此前版本的相关数据已经被归档,并从其同步来源中被移除。为节约镜像站磁盘空间,清华源等也相应移除了这些文件。如果大家现在使用的R语言是 4.3 ,Bioconductor 版本是 3.18 ,那么使用 BiocManager::install 的时候可能会报错 Warning: unable to access index for repository *** ,cannot open URL ***

我们查看一下 :https://new.bioconductor.org/about/mirrors/ 官方网站,发现bioconductor有新的镜像选择啦,如下所示的设置:

代码语言:javascript复制
options(BioC_mirror="https://mirrors.westlake.edu.cn/bioconductor")

可以看到就成功了:

代码语言:javascript复制
试开URL’https://mirrors.westlake.edu.cn/bioconductor/packages/3.17/data/annotation/src/contrib/pd.hg.u133a.2_3.12.0.tar.gz'
Content type 'application/gzip' length 9843108 bytes (9.4 MB)
downloaded 9.4 MB

* installing *source* package 'pd.hg.u133a.2' ...
** using staged installation
** R
** data
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded from temporary location
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path
* DONE (pd.hg.u133a.2)

下载的程序包在
 ‘C:UsersjimmyAppDataLocalTempRtmpS0j9qKdownloaded_packages’里
载入需要的程辑包:pd.hg.u133a.2
载入需要的程辑包:RSQLite
载入需要的程辑包:DBI
Platform design info loaded.

但是这个并不是一劳永逸的解决方案,因为西湖大学也有可能会把 bioconductor的 3.18以 及此前版本的相关bioconductor包文件数据归档,并从其同步来源中被移除,为节约镜像站磁盘空间。

另外一个解决方案,就是手动找到每个包的具体地址,使用下面的代码 :

代码语言:javascript复制
install.packages("https://mirrors.tuna.tsinghua.edu.cn/bioconductor/packages/release/data/annotation/src/contrib/BSgenome.Hsapiens.UCSC.hg19_1.4.3.tar.gz",type = 'source',repos = NULL)

可以看到清华大学里面的包还是很多:https://mirrors.tuna.tsinghua.edu.cn/bioconductor/packages/release/data/annotation/src/contrib/ ,每个具体的包都可以右键复制粘贴它们的真实下载地址哦:

清华大学里面的包还是很多

0 人点赞