# 加载函数与R包 -----------------------------------------------------------------
library(KEGGREST)
library(plyr)
source("./RbioRXN-master/RbioRXN-master/R/get.kegg.all.R")
source("./RbioRXN-master/RbioRXN-master/R/get.kegg.byId.R")
## KEGG数据库中的代谢反应和代谢物注释信息 -------------------------------------------------
keggAll = get.kegg.all()
## 这里需要消耗不少时间,加载提前下载好的数据
load("keggAll.Rdata")
## 查看代谢反应和代谢物的数量
dim(keggAll$reaction)
# [1] 11467 13
dim(keggAll$compound)
# [1] 18749 27
## 根据KEGG API接口查看代谢反应和代谢物信息
## http://rest.kegg.jp/info/reaction
# reaction KEGG Reaction Database
# rn Release 97.0+/12-31, Dec 20
# Kanehisa Laboratories
# 11,467 entries
## http://rest.kegg.jp/info/compound
# compound KEGG Compound Database
# cpd Release 97.0+/12-31, Dec 20
# Kanehisa Laboratories
# 18,749 entries
## 获取代谢信息的列名
colnames(keggAll$reaction)
# [1] "ENTRY" "NAME" "DEFINITION" "EQUATION" "ENZYME"
# [6] "RHEA" "COMMENT" "RCLASS" "PATHWAY" "ORTHOLOGY"
# [11] "MODULE" "REMARK" "REFERENCE"
colnames(keggAll$compound)
# [1] "ENTRY" "NAME" "FORMULA" "EXACT_MASS" "MOL_WEIGHT" "REMARK"
# [7] "REACTION" "PATHWAY" "MODULE" "ENZYME" "BRITE" "ATOM"
# [13] "BOND" "CAS" "PubChem" "ChEBI" "ChEMBL" "PDB.CCD"
# [19] "X3DMET" "NIKKAJI" "KNApSAcK" "COMMENT" "BRACKET" "LIPIDMAPS"
# [25] "LipidBank" "SEQUENCE" "REFERENCE"
write.csv(reaction,file = "keggAllreaction.csv",row.names = F)
write.csv(compound,file = "keggAllcompound.csv",row.names = F)