本文轉自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)
結束!