前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >安装一个不存在的R包

安装一个不存在的R包

原创
作者头像
生信探索
修改2023-03-03 09:05:06
5460
修改2023-03-03 09:05:06
举报
文章被收录于专栏:生信探索生信探索

需要用到DNA甲基化芯片的注释包IlluminaHumanMethylation450k.db,但是用BiocManager安装会报错“is not available”.

搜到了生信技能树的文章《如果这个R包真的不存在了肿么办》,但只谈到包被删除了之前是存在的...

https://cloud.tencent.com/developer/article/1508953

代码语言:text
复制
也就是说,这个包是被删除了,在 https://bioconductor.org/about/removed-packages/ 
可以看到是很早之前,就被删除了。
如何安装被移除的R包呢
这个其实跟我之前讲解的如何安装旧版R包有异曲同工之妙。

留给读者解决吧,相信你粉了我们生信技能树这么久,这一点实力,还是可以有的!

那就下载IlluminaHumanMethylation450k.db包的源码压缩包并安装。

https://www.bioconductor.org/packages//2.12/data/annotation/html/IlluminaHumanMethylation450k.db.html

代码语言:shell
复制
# 解压
tar -xf IlluminaHumanMethylation450k.db_2.0.7.tar.gz

提前安装依赖包

代码语言:text
复制
# 'BiocGenerics','S4Vectors','IRanges', 'Biobase', 'BiocGenerics', 'AnnotationDbi', 'org.Hs.eg.db', 'AnnotationForge'
# "bit", "plogr", "blob", "bit64", 'S4Vectors', 'RSQLite', 'DBI','RSQLite','remotes'

修改源代码

修改IlluminaHumanMethylation450k.db/R/zzz.R中的源码

代码语言:shell
复制
AnnotationForge:::createSimpleBimap 
替换为下边的代码,因为报错找不到 createSimpleBimap;发现包换了
AnnotationDbi::createSimpleBimap

正式安装

代码语言:text
复制
library(remotes)
remotes::install_local("IlluminaHumanMethylation450k.db")

安装完才发现有替代的包"FDb.InfiniumMethylation.hg19"...

代码语言:shell
复制
Warning message:
'IlluminaHumanMethylation450k.db' is deprecated.
Use 'FDb.InfiniumMethylation.hg19' instead.
Use 'FDb.InfiniumMethylation.hg18' instead.
Use 'mapToGenome() function in minfi or methylumi' instead.
See help("Deprecated")

查看有哪些注释信息

代码语言:shell
复制
# could not find function "dbGetQuery"
library(DBI)
library(IlluminaHumanMethylation450k.db)
IlluminaHumanMethylation450k.db::IlluminaHumanMethylation450k()

# IlluminaHumanMethylation450kACCNUM has 365088 mapped keys (of 365088 keys)
# IlluminaHumanMethylation450kALIAS2PROBE has 74043 mapped keys (of 143558 keys)
# IlluminaHumanMethylation450kCHR has 331568 mapped keys (of 482931 keys)
# IlluminaHumanMethylation450kCHRLENGTHS has 93 mapped keys (of 640 keys)
# IlluminaHumanMethylation450kCHRLOC has 331443 mapped keys (of 482931 keys)
# IlluminaHumanMethylation450kCHRLOCEND has 331443 mapped keys (of 482931 keys)
# IlluminaHumanMethylation450kENSEMBL has 319028 mapped keys (of 482931 keys)
# IlluminaHumanMethylation450kENSEMBL2PROBE has 18604 mapped keys (of 39708 keys)
# IlluminaHumanMethylation450kENTREZID has 331594 mapped keys (of 482931 keys)
# IlluminaHumanMethylation450kENZYME has 38658 mapped keys (of 482931 keys)
# IlluminaHumanMethylation450kENZYME2PROBE has 925 mapped keys (of 975 keys)
# IlluminaHumanMethylation450kGENENAME has 331594 mapped keys (of 482931 keys)
# IlluminaHumanMethylation450kGO has 302014 mapped keys (of 482931 keys)
# IlluminaHumanMethylation450kGO2ALLPROBES has 13290 mapped keys (of 22963 keys)
# IlluminaHumanMethylation450kGO2PROBE has 10083 mapped keys (of 18933 keys)
# IlluminaHumanMethylation450kMAP has 330724 mapped keys (of 482931 keys)
# IlluminaHumanMethylation450kOMIM has 240300 mapped keys (of 482931 keys)
# IlluminaHumanMethylation450kPATH has 97051 mapped keys (of 482931 keys)
# IlluminaHumanMethylation450kPATH2PROBE has 214 mapped keys (of 229 keys)
# IlluminaHumanMethylation450kPMID has 330468 mapped keys (of 482931 keys)
# IlluminaHumanMethylation450kPMID2PROBE has 275464 mapped keys (of 754859 keys)
# IlluminaHumanMethylation450kREFSEQ has 331594 mapped keys (of 482931 keys)
# IlluminaHumanMethylation450kSYMBOL has 331594 mapped keys (of 482931 keys)
# IlluminaHumanMethylation450kUNIPROT has 316916 mapped keys (of 482931 keys)
代码语言:shell
复制
# 探针与基因名的对应关系
IlluminaHumanMethylation450kSYMBOL
# 染色体信息
IlluminaHumanMethylation450kMAP
IlluminaHumanMethylation450kCHRLOC
IlluminaHumanMethylation450kCHRLOCEND
IlluminaHumanMethylation450kCHRLENGTHS

提取探针与基因名的对应关系

代码语言:shell
复制
a=IlluminaHumanMethylation450k.db::IlluminaHumanMethylation450kSYMBOL
b=as.data.frame(a)
head(b)
#     probe_id symbol
# 1 cg03123289   A1BG
# 2 cg03630821   A1BG
# 3 cg10734734   A1BG
# 4 cg11001216   A1BG
# 5 cg14222245   A1BG
# 6 cg22286978   A1BG

FDb.InfiniumMethylation.hg19的注释信息

FDb.InfiniumMethylation.hg19是替代包,所以也安装比较下区别

代码语言:text
复制
BiocManager::install("FDb.InfiniumMethylation.hg19")
library(FDb.InfiniumMethylation.hg19)
FDb.InfiniumMethylation.hg19::FDb.InfiniumMethylation.hg19
# FeatureDb object:
# | Db type: FeatureDb
# | Supporting package: GenomicFeatures
# | data_nrow: 487173
# | Db created by: GenomicFeatures package from Bioconductor
# | Creation time: 2013-05-07 17:02:12 -0700 (Tue, 07 May 2013)
# | GenomicFeatures version at creation time: 1.13.2
# | RSQLite version at creation time: 0.11.3
# | DBSCHEMAVERSION: 1.0
# | Data source: NCBI/GEO and dbSNP
# | Genome: hg19
# | Resource: Illumina Infinium DNA methylation probes, mapped to hg19
# | Genus and Species: Homo sapiens
# | URL: ftp://ftp.illumina.com
  • 探针信息
代码语言:text
复制
hm450 <- FDb.InfiniumMethylation.hg19::get450k()
as.data.frame(hm450) %>% head()
代码语言:text
复制
    seqnames  start  end  width  strand  addressA  addressB  channel  platform  percentGC  sourceSeq  probeType  probeStart  probeEnd  probeTarget
cg04913815  chr16  60438  60439  2  *  24771476  ""  Both  HM450  0.58  TTTCGGTGGTACTGCGAAGGCAGAGCAGAGTTCTGCTCAGGTCAGACCCG  cg  60438  60487  60438
cg01686861  chr16  60748  60749  2  *  36644319  45624454  Red  HM450  0.76  CGCCCCCAGGCCGGCGCCGTGCGACTTTGCTCCTGCAACACACGCCCCCC  cg  60700  60749  60748
cg05558259  chr16  61085  61086  2  *  65765435  ""  Both  HM450  0.56  CAGCTAGGGACATTGCAGGCTCCTCTTGCTCAAAGTGTAGTGGCAGCACG  cg  61037  61086  61085
cg26978960  chr16  62460  62461  2  *  28717484  ""  Both  HM450  0.66  CGGCCCAGTAGAGCCCTAGGGGTGACGCCACTCCCACTCACTGTCGACTC  cg  62412  62461  62460
cg03792876  chr16  73243  73244  2  *  42725455  ""  Both  HM450  0.64  ATGGAGGCTTGGGCGGGTCACCCCCAGTGCAGGCCAAGATGCAGGTTACG  cg  73195  73244  73243
cg09699726  chr16  91602  91603  2  *  34629364  ""  Both  HM450  0.68  GCACTAGAGCCCCAGGGCCAGGGGAGACCCAGCATCCAAGGTGCACCACG  cg  91554  91603  91602
  • 探针最近的基因、转录本、TSS
代码语言:text
复制
gene <- FDb.InfiniumMethylation.hg19::getNearestGene(hm450)
head(gene)
#            queryHits subjectHits distance nearestGeneSymbol
# cg04913815         1         666     1115          DDX11L10
# cg01686861         2         666      805          DDX11L10
# cg05558259         3         666      468          DDX11L10
# cg26978960         4         666        0          DDX11L10
# cg03792876         5         666     9152          DDX11L10
# cg09699726         6       14930     5375            POLR3K
transcript <- FDb.InfiniumMethylation.hg19::getNearestTranscript(hm450)
head(transcript)
#            queryHits subjectHits distance nearestGeneSymbol nearestTranscript
# cg04913815         1        1033     1115          DDX11L10        uc010bqm.2
# cg01686861         2        1033      805          DDX11L10        uc010bqm.2
# cg05558259         3        1033      468          DDX11L10        uc010bqm.2
# cg26978960         4        1033        0          DDX11L10        uc010bqm.2
# cg03792876         5        1033     9152          DDX11L10        uc010bqm.2
# cg09699726         6       40773     5375            POLR3K        uc002cfi.2
tss <- FDb.InfiniumMethylation.hg19::getNearestTSS(hm450)
head(tss)
#   queryHits subjectHits distance nearestGeneSymbol nearestTranscript
# cg04913815  1  799 1115   DDX11L10   uc010bqm.2
# cg01686861  2  799 805   DDX11L10   uc010bqm.2
# cg05558259  3  799 468   DDX11L10   uc010bqm.2
# cg26978960  4  799 904   DDX11L10   uc010bqm.2
# cg03792876  5  799 11687   DDX11L10   uc010bqm.2
# cg09699726  6   24097    12028     POLR3K   uc002cfi.2

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 提前安装依赖包
  • 修改源代码
  • 正式安装
  • 查看有哪些注释信息
  • 提取探针与基因名的对应关系
  • FDb.InfiniumMethylation.hg19的注释信息
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档