R语言KEGGREST包

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 ncbi-gincbi-geneidncbi-proteiniduniprot, or (for chemical substance identifiers) drugcompound, or glycanpubchem, or chebi.

source

Same as target, but may also be a list of KEGG identifers representing internal or external names.

querySize

Empirically, KEGG limits queries to 100 source identifiers per query. This argument enables larger queries by dividing source into sub-queries of no more than querySize identifiers.

## 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

  • 1
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值