ixxmu / mp_duty

抓取网络文章到github issues保存

Home Page:https://archives.duty-machine.now.sh/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

听说你的探针转换的数据包不能安装了?

ixxmu opened this issue · comments

听说你的探针转换的数据包不能安装了? by 果子学生信

学员在探针转换时,发现需要用到“IlluminaHumanMethylation450k.db”,于是用如下命令安装

BiocManager::install("IlluminaHumanMethylation450k.db")

却遇到了如下的问题

Warning message:
package ‘IlluminaHumanMethylation450k.db’ is not available for Bioconductor version '3.16'

A version of this package for your version of R might be available elsewhere,
see the ideas at
https://cran.r-project.org/doc/manuals/r-patched/R-admin.html#Installing-packages 

于是,我去搜索了下,找到Bioconductor相应的页面。我发现这个安装命令有点老旧啊(见下图1),于是我点了下图2的链接。

可恶,居然这个包被移除了,而且是两次!这是啥情况啊!

咋办呢?这难不成我们,因为我知道Bioconductor的数据包,本质上是sqlite数据的封装而已,只要我能够下载源代码,我就能进行解析。但离谱是,官方站点的地址给我一个Error。

Error>
<Code>NoSuchKey</Code>
<BucketName>bir190004-bucket01</BucketName>
<RequestId>tx00000f0c9eb33edbd6227-006556ed22-6142ee-default</RequestId>
<HostId>6142ee-default-default</HostId>
</Error>

还好互联网上有很多备份,我找到了一个可用的地址:https://bioconductor.riken.jp/packages/3.5/data/annotation/src/contrib/IlluminaHumanMethylation450k.db_2.0.9.tar.gz

我尝试用 install.packages的方式直接安装,但是估计是底层的包发生了变动,导致安装失败嘞。

install.packages("https://bioconductor.riken.jp/packages/3.5/data/annotation/src/contrib/IlluminaHumanMethylation450k.db_2.0.9.tar.gz",repos = NULL)

# 错误信息
Error: package or namespace load failed for ‘IlluminaHumanMethylation450k.db’:
 .onLoad failed in loadNamespace() for 'IlluminaHumanMethylation450k.db', details:
  call: NULL
  error: 'fun' is defunct.
Use 'FDb.InfiniumMethylation.hg19' instead.
Use 'FDb.InfiniumMethylation.hg18' instead.
Use 'mapToGenome() function in minfi or methylumi' instead.
See help("Defunct")
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/Library/Frameworks/R.framework/Versions/4.2-arm64/Resources/library/IlluminaHumanMethylation450k.db’
Warning in install.packages :
  installation of package ‘/var/folders/65/zlf_hpss17x0s_qcjgsjwcch0000gn/T//Rtmp4eAzEn/downloaded_packages/IlluminaHumanMethylation450k.db_2.0.9.tar.gz’ had non-zero exit status

于是,我只能单独下载这个tar.gz文件,将其解压缩,使用RSQLite直接读取。

library(RSQLite)

# 连接到SQLite数据库
con <- dbConnect(RSQLite::SQLite(), "~/Desktop/IlluminaHumanMethylation450k.db/inst/extdata/IlluminaHumanMethylation450k.sqlite")

# 获取数据库中的所有表名
tables <- dbListTables(con)

# 关闭数据库连接
dbDisconnect(con)

# 查看所有表名
print(tables)

# 显示内容如下
 [1] "accessions"     "controlprobes"  "cpgi"           "cpgilocation"   "cpgirelations"  "cpgislandnames"
 [7] "cpgiview"       "dmr"            "fantom"         "featuregroups"  "featurenames"   "map_counts"    
[13] "map_metadata"   "metadata"       "probedesign"    "probedesign1"   "probedesign2"   "probelocation" 
[19] "probes"         "probesummary"   "reglocation"    "regulatory"     "regview"        "relations"     
[25] "snps"   

那里面的probes不出意外,应该就是我们需要的内容了。

library(RSQLite)

# 连接到SQLite数据库
con <- dbConnect(RSQLite::SQLite(), "~/Desktop/IlluminaHumanMethylation450k.db/inst/extdata/IlluminaHumanMethylation450k.sqlite")

# 读取表中的数据
result <- dbGetQuery(con, "SELECT * FROM probes")

# 关闭数据库连接
dbDisconnect(con)

# 查看读取的结果
print(head(result))

# 结果如下
    probe_id gene_id is_multiple
1 cg00000029    5934           0
2 cg00000108  339883           0
3 cg00000109   64778           0
4 cg00000165    <NA>           0
5 cg00000236    7419           0
6 cg00000289      87           0

那么只要将这个结果保存到本地,后续就能够使用了。

saveRDS(result,file="~/Desktop/IlluminaHumanMethylation450k_probe.Rds")

如果,你想要自己测试这个sqlite数据,可以在果子公众号后台回复 洲更debug,就可以获取数据下载地址。