分享

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

 健明 2024-05-27 发布于广东

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

library(oligo) 
celFiles <- list.celfiles('../cel_files/',listGzipped = T,
                          full.name=TRUE
exon_data <- oligo::read.celfiles( celFiles ) 

如下所示:

> 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./

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

试开URL’https:///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:///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./bir190004-bucket01/archive./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 是一个不完整的包,所以安装会失败。这个时候需要设置一下时间问题:

getOption('timeout')
options(timeout=10000)

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

rm(list = ls()) 
options()$repos 
options()$BioC_mirror
#options(BioC_mirror="https://mirrors.ustc.edu.cn/bioc/")
options(BioC_mirror="http://mirrors.tuna./bioconductor/")
options("repos" = c(CRAN="https://mirrors.tuna./CRAN/"))
options()$repos 
options()$BioC_mirror

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

载入需要的程辑包: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./CRAN/
Warning: 无法在貯藏處http://mirrors.tuna./bioconductor//packages/3.17/bioc/src/contrib中读写索引:
  无法打开URL'http://mirrors.tuna./bioconductor//packages/3.17/bioc/src/contrib/PACKAGES'
Warning: 无法在貯藏處http://mirrors.tuna./bioconductor//packages/3.17/data/annotation/src/contrib中读写索引:
  无法打开URL'http://mirrors.tuna./bioconductor//packages/3.17/data/annotation/src/contrib/PACKAGES'
Warning: 无法在貯藏處http://mirrors.tuna./bioconductor//packages/3.17/data/experiment/src/contrib中读写索引:
  无法打开URL'http://mirrors.tuna./bioconductor//packages/3.17/data/experiment/src/contrib/PACKAGES'
Warning: 无法在貯藏處http://mirrors.tuna./bioconductor//packages/3.17/workflows/src/contrib中读写索引:
  无法打开URL'http://mirrors.tuna./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,所以就很尴尬。我们的马拉松助教团队给大家整理了这个问题:

根据 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./about/mirrors/ 官方网站,发现bioconductor有新的镜像选择啦,如下所示的设置:

options(BioC_mirror="https://mirrors./bioconductor")

可以看到就成功了:

试开URL’https://mirrors./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:\Users\jimmy\AppData\Local\Temp\RtmpS0j9qK\downloaded_packages’里
载入需要的程辑包:pd.hg.u133a.2
载入需要的程辑包:RSQLite
载入需要的程辑包:DBI
Platform design info loaded.

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

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

install.packages("https://mirrors.tuna./bioconductor/packages/release/data/annotation/src/contrib/BSgenome.Hsapiens.UCSC.hg19_1.4.3.tar.gz",type = 'source',repos = NULL)

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

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

文末友情宣传

强烈建议你推荐给身边的博士后以及年轻生物学PI,多一点数据认知,让他们的科研上一个台阶:

    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多