本文转自Y叔公众号
自己KEGG数据库好处:
- 可重复性好
- 没网也可以进行分析
步骤
1 在KEGG官网找到自己物种的3字符缩写
2 加载Y叔获取kegg.db 的R包
1 ##安装Y叔的包 2 library(remotes) remotes::install_github("YuLab-SMU/createKEGGdb") #若报错 force ,则强制安装 remotes::install_github("YuLab-SMU/createKEGGdb", force = TRUE) ✔ checking for file ‘/private/var/folders/yc/9wjshngs31513v_mw3tkxgs00000gn/T/RtmpnuOrB5/remotesefd0472c4df1/YuLab-SMU-createKEGGdb-378e7cf/DESCRIPTION’ (421ms) ─ preparing ‘createKEGGdb’: ✔ checking DESCRIPTION meta-information ... ─ checking for LF line-endings in source and make files and shell scripts ─ checking for empty or unneeded directories ─ building ‘createKEGGdb_0.0.2.tar.gz’ * installing *source* package ‘createKEGGdb’ ... ** using staged installation ** R ** 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 (createKEGGdb)
3 下载所需要物种的KEGG.db
## 下载所需要物种的KEGG.db createKEGGdb::create_kegg_db('soe') 019-12-27 15:13:29 Getting KEGG data of soe. 2019-12-27 15:13:29 KEGG data of soe has been downloaded. 2019-12-27 15:13:29 KEGG data of soe has been added to the sqlite database. ✔ checking for file ‘/private/var/folders/yc/9wjshngs31513v_mw3tkxgs00000gn/T/RtmpnuOrB5/fileefd0bae49ad/DESCRIPTION’ (463ms) ─ preparing ‘KEGG.db’: ✔ checking DESCRIPTION meta-information ... ─ checking for LF line-endings in source and make files and shell scripts ─ checking for empty or unneeded directories ─ building ‘KEGG.db_1.0.tar.gz’ "./KEGG.db_1.0.tar.gz" ## 安装下载好的KEGG.db 包 install.packages("KEGG.db_1.0.tar.gz",repos=NULL, type = "source") * installing *source* package ‘KEGG.db’ ... ** using staged installation ** R ** inst ** byte-compile and prepare package for lazy loading ** help No man pages found in package ‘KEGG.db’ *** 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 (KEGG.db)
4 测试本地的包
1 library(KEGG.db) 2 library(clusterProfiler) 3 4 ## 加载基因名字,ENTREZID格式 5 gene = read.table("geneList.blastp_filter_ENTREZID",sep = "\t",header = T) 6 gene = as.character(gene$Name) 7 head(gene) 8 [1] "110778909" "110805947" "110782171" "110800757" "110785314" "110789473" 9 kegg <- enrichKEGG(gene = gene, 10 organism = 'soe', 11 pvalueCutoff = 0.05, 12 qvalueCutoff = 0.05, 13 use_internal_data = T) 14 15 cnetplot(kegg)
结束!