KEGGREST提供到京都基因和基因组百科全书(KEGG)REST服务器的客户端接口。
1. 包的查看
# if (!requireNamespace("BiocManager", quietly = TRUE))
# install.packages("BiocManager")
#
# BiocManager::install("KEGGREST")
library(KEGGREST)
ls("package:KEGGREST") # 列出包里的对象,方法
## Lists the KEGG databases which may be searched.
listDatabases()
2. keggList
## returns the list of KEGG organisms with taxonomic classification
org <- keggList("organism")
head(org)
## returns the list of reference pathways
keggList("pathway")
## returns the list of human pathways
res <- keggList("pathway","hsa")
## returns the entire list of human genes
keggList("hsa")
## 返回Entry id 的信息
keggList(c("hsa:9903","hsa:10458"))
3. keggGet
query <- keggGet(c("hsa:10458", "hsa:9903"))
length(query)
names(query[[1]])
query[[1]]$ENTRY
query[[1]]$DBLINKS
query[[1]]$AASEQ # AAStringSet object
query[[1]]$AASEQ[[1]] # AAString object
res <- keggGet(c("hsa:10458", "hsa:9903"), "aaseq")
res[[1]]
# retrieves the image file of a pathway map
png <- keggGet("hsa05130", "image")
library(png)
t <- "~/test.png"
writePNG(png,t)
if (interactive()) browseURL(t)
4. keggConv
Usage
keggConv(target, source, querySize = 100)
Arguments
target | A KEGG organism code (), T number, or one of the external databases |
source | Same as |
querySize | Empirically, KEGG limits queries to 100 source identifiers per query. This argument enables larger queries by dividing |
## conversion from NCBI GeneID to KEGG ID for E. coli genes
head(keggConv("eco", "ncbi-geneid"))
head(keggConv("ncbi-geneid", "eco")) # opposite direction
## conversion from NCBI GeneID to KEGG ID for human genes
head(keggConv("hsa", "ncbi-geneid"))
# Convert KEGG identifiers to/from outside identifiers.
keggConv("ncbi-proteinid", c("hsa:10458", "ece:Z5100"))
5. keggFind
#查找数据库中具有匹配查询关键字或其他查询数据的条目
res <- keggFind("genes", c("shiga", "toxin"))
length(res)
head(res)
res <- keggFind("pathway", c("immune")) # 免疫有关的通路
res <- keggFind("pathway", c("infection")) # 感染有关的通路
res <- keggFind("genes", c("hsa","immune")) # 人类和免疫有关的基因
## for chemical formula containing "O5" and "C7"
res <- keggFind("compound", "O5C7", "formula")
## for 300 =< molecular weight =< 310
res <- keggFind("compound", 300:310, "mol_weight")
直接官网查找更方便。
6. keggLink
## KEGG pathways linked from each of the human genes
## equivalent to 'get.genes.by.pathway' in KEGGSOAP package
res <- keggLink("pathway", "hsa")
length(res)
head(res)
## human genes linked from each of the KEGG pathways
## equivalent to 'get.pathways.by.genes' in KEGGSOAP
res <- keggLink("hsa", "pathway")
## KEGG pathways
## linked from a human gene and an E. coli O157 gene
keggLink("pathway", c("hsa:10458", "ece:Z5100"))
## LinkDB search shows all KEGG resources related to hsa:126
res <- keggLink("hsa:126")
head(res)
7. keggInfo
## displays the current statistics of the KEGG database
res <- keggInfo("kegg")
cat(res)
## displays the number pathway entries including both
## the reference and organism-specific pathways
res <- keggInfo("pathway")
cat(res)
## displays the number of gene entries for the
## KEGG organism Homo sapiens
res <- keggInfo("hsa")
cat(res)
参考
https://www.kegg.jp/kegg/docs/keggapi.html
https://www.bioconductor.org/packages/release/bioc/manuals/KEGGREST/man/KEGGREST.pdf