KEGG API 使用方法

2019-10-08

KEGG几乎是最常用的基因功能通路分析网站。掌握其API使用方法,提高工作效率。

初识KEGG API

初识KEGG API

KEGG API Document

KEGG API

KEGG API is a REST-stype Application Programming Interface to the KEGG database resource.

KEGG API Operations

  1. INFO
  2. LIST
  3. FIND
  4. GET
  5. CONV
  6. LINK
  7. DDI

Python code

import pandas as pd

hsaPathway = 'http://rest.kegg.jp/list/pathway/hsa'
res=pd.read_csv(hsaPathway, sep='\t')
res.to_csv('hsaPathway.csv',sep=',',index=None) 

# /list/pathway/hsa 	   	returns the list of human pathways
species = ['hsa', 'mmu','rno']
for i in range(len(species)):
    allPathway = 'http://rest.kegg.jp/list/pathway/{}'.format(species[i])
    res=pd.read_csv(allPathway, sep='\t')
    res.to_csv('Pathways{}.csv'.format(species[i]),sep=',',index=None)