在 RStudio
中使用 BiocManager
安裝包
install.packages("BiocManager")
install.packages("ggplot2")
安裝對應版本的 Rtools
安裝完成后,使用命令安裝 KEGGREST
以及所需要的相關包
BiocManager::install("KEGGREST")
BiocManager::install("fmcsR")
~~devtools::install_git("https://github.com/cran/RbioRXN.git")~~
包加載
library(KEGGREST)
~~library(RbioRXN)~~
查看KEGG數據庫包含的數據
listDatabases()
獲取單個數據集中的數據
pathway<- keggList("pathway")
head(pathway)
對單個數據庫進行組織的選擇
org <-keggList("pathway","hsa")
head(org)
如下圖所示:
從上面可以看出keggList不僅可以提取單個數據集還可以獲取對應物種的信息。在這里我們發現同樣的通路編碼ID卻不一樣,map+num泛指KEGG中的所有通路;has+num指的是人類物種的通路信息。
獲取所有的代謝反應和化合物數據
keggAll = get.kegg.all()
save(keggAll,file="C:/data/metabolism/database/KEGG/keggAll.Rdata")
提取數據
reaction=keggAll$reaction
write.csv(reaction," reaction.csv")
compound=keggAll$compound
write.csv(compound," compound.csv")
至此我們就可以將KEGG中的數據提取到本地進行接下來的分析處理。
提取方法參考
數據提取參考