安装一个不存在的R包

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

 

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

 

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

 

也就是说,这个包是被删除了,在 https://bioconductor.org/about/removed-packages/ 

可以看到是很早之前,就被删除了。

如何安装被移除的R包呢

这个其实跟我之前讲解的如何安装旧版R包有异曲同工之妙。

 

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

 

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

 

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

 

2c3e95c97be34bdd8362d148651df8d7.png

 

# 解压

tar -xf IlluminaHumanMethylation450k.db_2.0.7.tar.gz

提前安装依赖包

# '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中的源码

 

AnnotationForge:::createSimpleBimap 

替换为下边的代码,因为报错找不到 createSimpleBimap;发现包换了

AnnotationDbi::createSimpleBimap

正式安装

library(remotes)

remotes::install_local("IlluminaHumanMethylation450k.db")

 

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

 

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")

查看有哪些注释信息

# 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)

# 探针与基因名的对应关系

IlluminaHumanMethylation450kSYMBOL

# 染色体信息

IlluminaHumanMethylation450kMAP

IlluminaHumanMethylation450kCHRLOC

IlluminaHumanMethylation450kCHRLOCEND

IlluminaHumanMethylation450kCHRLENGTHS

 

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

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是替代包,所以也安装比较下区别

 

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

 

探针信息

hm450 <- FDb.InfiniumMethylation.hg19::get450k()

as.data.frame(hm450) %>% head()

    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

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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值