KEGG API

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

[ Top | KEGG API | MEDICUS Extension | KEGG WebLinks | KEGG Database Entry Format ]

General form

URL form

http://rest.kegg.jp/<operation>/<argument>[/<argument2[/<argument3> ...]] <operation> = info | list | find | get | conv | link | ddi

Database name

<database> = KEGG databases (Table 1), KEGG MEDICUS extension databases (Table 2) and Outside databases integrated in KEGG (Table 3) = pathway | brite | module | ko | genome | <org> | vg | ag | compound | glycan | reaction | rclass | enzyme | disease | drug | dgroup | environ | genes | ligand | kegg | <medicus> | <outside> <org> = KEGG organism code <medicus> = disease_ja | drug_ja | dgroup_ja | environ_ja | compound_ja | brite_ja | atc | atc_ja | jtc_en | jtc | ndc | yj <outside> = pubmed | ncbi-geneid | ncbi-proteinid | uniprot | pubchem | chebi

Database entry identifier

<dbentry> = <kid> | <org>:<gene> | <database>:<entry> <kid> = KEGG identifier <gene> = Gene entry name or accession <entry> = Database entry name or accession <dbentries> = <dbentry>1[+<dbentry>2...]

Naming conventions

KEGG is an integrated database consisting of fifteen databases (and one under development) shown in Table 1. Except for "genes" and "enzyme", each database entry is identified by the KEGG identifier <kid> consisting of a database-dependent prefix followed by a five-digit number (see KEGG Objects for more details), such as K number, C number and D numbers as identifiers of "ko", "compound" and "drug" databases, respectively.

A "genes" entry is identified by
<org>:<gene>
where <org> is the three- or four-letter KEGG organism code or the T number genome identifier and <gene> is the gene identifier, usually NCBI GeneID or INSDC Locus_tag (see KEGG GENES).

An "enzyme" entry or an entry of any outside database is identified by
<database>:<entry>
where <database> is the database name or its abbreviation defined in Tables 1-3 and <entry> is the entry name or the accession number given by the database.

Table 1. KEGG databases

DB name Abbrev Content Web page kid prefix

pathway path KEGG pathway maps KEGG PATHWAY map, ko, ec, rn, <org>
brite br BRITE functional hierarchies KEGG BRITE br, jp, ko, <org>
module md KEGG modules KEGG MODULE M, <org>_M
orthology ko KO functional orthologs KEGG ORTHOLOGY K
genome gn KEGG organisms KEGG GENOME T
genes <org>
vg
ag
Genes in KEGG organisms
Genes in viruses category
Genes in addendum category
KEGG GENES -
compound cpd Small molecules KEGG COMPOUND C
glycan gl Glycans KEGG GLYCAN G
reaction rn Biochemical reactions KEGG REACTION R
rclass rc Reaction class RC
enzyme ec Enzyme nomenclature KEGG ENZYME -
disease ds Human diseases KEGG DISEASE H
drug dr Drugs KEGG DRUG D
dgroup dg Drug groups DG
environ ev Health-related substances KEGG ENVIRON E
network nt Disease-related network elements (to be released) N
  • "genes" is a composite database consisting of KEGG organisms with three- or four-letter <org> codes, and viruses (vg) and addendum (ag) categories (see KEGG GENES).
  • "pathway", "brite" and "module" consist of manually created reference datasets and computationally generated organism-specific datasets (see KEGG Pathway Maps).
  • "kegg" stands for the collection of all databases shown above.
  • "ligand" stands for the collection of chemical databases: compound, glycan, reaction and enzyme.

KEGG MEDICUS is a translational bioinformatics resource, both in English and Japanese, promoting use of genomic information in society. Table 2 shows an additional set of databases in KEGG MEDICUS.

Table 2. KEGG MEDICUS extension databases

DB name Abbrev Entry ID Web page

disease_ja ds_ja H number KEGG DISEASE (in Japanese)
drug_ja dr_ja D number KEGG DRUG (in Japanese)
dgroup_ja dg_ja DG number
environ_ja ev_ja E number KEGG ENVIRON (in Japanese)
compound_ja cpd_ja C number
brite_ja br jp number KEGG BRITE (in Japanese)
atc 7-letter ATC code ATC classification
atc_ja 7-letter ATC code ATC classification (in Japanese)
jtc Therapeutic category code Therapeutic category in Japan (in Japanese)
jtc_en Therapeutic category code Therapeutic category in Japan
ndc National Drug Code Drug products in the USA
yj YJ code Drug products in Japan (in Japanese)

In addition to these databases, the NCBI PubMed database shown in Table 3 is tightly integrated in KEGG. Table 3 also contains databases used only for ID conversion (conv operation).

Table 3. Outside databases integrated in KEGG

DB name Abbrev Entry ID Web page Remark

pubmed pmid PubMed ID NCBI PubMed
ncbi-geneid Gene ID NCBI Gene ID conversion only
ncbi-proteinid Protein ID NCBI Protein ID conversion only
uniprot up UniProt Accession UniProt ID conversion only
pubchem PubChem SID NCBI PubChem ID conversion only
chebi ChEBI ID ChEBI ID conversion only

Output

Output format

The output of all operations is in a text format:
  • tab-delimited text returned from list, find, conv and link
  • flat file database format returned from get
  • text message returned from info

Status code

The HTTP status code can be used to check if the operation was successful.

Code  Meaning
200Success
400Bad request (syntax error, wrong database name, etc.)
404Not found (e.g., requesting amino acid sequence for RNA)


KEGG API Operations

INFO

Name

info – display database release information and linked db information

URL form

http://rest.kegg.jp/info/<database> <database> = kegg | pathway | brite | module | ko | genome | genes | <org> | vg | ag | ligand | compound | glycan | reaction | rclass | enzyme | disease | drug | dgroup | environ

Description

This operation displays the database release information with statistics for the databases shown in Table 1. Except for kegg, genes and ligand, this operation also displays the list of linked databases that can be used in the link operation.

Examples

/info/kegg    displays the current statistics of the KEGG database
/info/pathway    displays the number of pathway entries including both the reference and organism-specific pathways
/info/hsa    displays the number of gene entries for the KEGG organism Homo sapiens

See also

Current statistics in the KEGG website.


LIST

Name

list – obtain a list of entry identifiers and associated definition

URL form

http://rest.kegg.jp/list/<database>[/<option>] <database> = pathway | brite | module | ko | genome | <org> | vg | ag | compound | glycan | reaction | rclass | enzyme | disease | drug | dgroup | environ | organism | <medicus> <option> = xl

http://rest.kegg.jp/list/<database>/<org> <database> = pathway | module

http://rest.kegg.jp/list/<dbentries> <dbentries> = Entries of the following <database> <database> = pathway | brite | module | ko | genome | <org> | vg | ag | compound | glycan | reaction | rclass | enzyme | disease | drug | dgroup | environ | <medicus>

Description

This operation can be used to obtain a list of all entries in each database. The database names shown in Tables 1 and 2, excluding the composite database names of genes, ligand and kegg, may be given. The special database name "organism" is allowed only in this operation, which may be used to obtain a list of KEGG organisms with the three- or four-letter organism codes.

The option "xl" is applicable only to the brite database for listing binary relation files, which are used to expand brite hierarchies by the Join Brite tool in KEGG Mapper.

When the organism code is known, the second form can be used to obtain a list of organism-specific pathways or modules.

The third form may be used to obtain a list of definitions for a given set of database entry identifiers. The maximum number of identifiers that can be given is 10.

Examples

/list/pathway    returns the list of reference pathways
/list/pathway/hsa    returns the list of human pathways
/list/organism    returns the list of KEGG organisms with taxonomic classification
/list/hsa    returns the entire list of human genes
/list/T01001    same as above
/list/hsa:10458+ece:Z5100    returns the list of a human gene and an E.coli O157 gene
/list/cpd:C01290+gl:G00092    returns the list of a compound entry and a glycan entry
/list/C01290+G00092    same as above


FIND

Name

find – find entries with matching query keyword or other query data

URL form

http://rest.kegg.jp/find/<database>/<query> <database> = pathway | brite | module | ko | genome | genes | <org> | vg | ag | ligand | compound | glycan | reaction | rclass | enzyme | disease | drug | dgroup | environ | <medicus>

http://rest.kegg.jp/find/<database>/<query>/<option> <database> = compound | drug <option> = formula | exact_mass | mol_weight

Description

This is a search operation. The first form searches entry identifier and associated fields shown below for matching keywords.

DatabaseText search fields (see flat file format)
pathwayENTRY and NAME
moduleENTRY and NAME
koENTRY, NAME and DEFINITION
genomeENTRY, NAME and DEFINITION
genes (<org>, vg, ag)ENTRY, ORTHOLOGY, NAME and DEFINITION
compoundENTRY and NAME
glycanENTRY, NAME and COMPOSITION
reactionENTRY, NAME and DEFINITION
rclassENTRY and DEFINITION
enzymeENTRY and NAME
diseaseENTRY and NAME
drugENTRY and NAME
dgroupENTRY and NAME
environENTRY and NAME
Keyword search against brite is not supported. Use /list/brite to retrieve a short list.

In the second form the chemical formula search is a partial match irrespective of the order of atoms given. The exact mass (or molecular weight) is checked by rounding off to the same decimal place as the query data. A range of values may also be specified with the minus(-) sign.

Examples

/find/genes/shiga+toxin    for keywords "shiga" and "toxin"
/find/genes/"shiga toxin"    for keywords "shiga toxin"
/find/compound/C7H10O5/formula    for chemical formula "C7H10O5"
/find/compound/O5C7/formula    for chemical formula containing "O5" and "C7"
/find/compound/174.05/exact_mass    for 174.045 =< exact mass < 174.055
/find/compound/300-310/mol_weight    for 300 =< molecular weight =< 310

See also

DBGET search interface such as in the KEGG Table of Contents page.


GET

Name

get – retrieve given database entries

URL form

http://rest.kegg.jp/get/<dbentries>[/<option>] <dbentries> = KEGG database entries of the following <database> <database> = pathway | brite | module | ko | genome | <org> | compound | glycan | reaction | rclass | enzyme | disease | drug | dgroup | environ | disease_ja | drug_ja | dgroup_ja | environ_ja | compound_ja <option> = aaseq | ntseq | mol | kcf | image | conf | kgml | json

Description

This operation retrieves given database entries in a flat file format or in other formats with options. Flat file formats are available for all KEGG databases except brite. The input is limited up to 10 entries.

Options allow retrieval of selected fields, including sequence data from genes entries, chemical structure data or gif image files from compound, glycan and drug entries, png image files or kgml files from pathway entries. The input is limited to one compound/glycan/drug entry with the image option, and to one pathway entry with the image or kgml option.

Examples

/get/cpd:C01290+gl:G00092    retrieves a compound entry and a glycan entry
/get/C01290+G00092    same as above
/get/hsa:10458+ece:Z5100    retrieves a human gene entry and an E.coli O157 gene entry
/get/hsa:10458+ece:Z5100/aaseq    retrieves amino acid sequences of a human gene and an E.coli O157 gene
/get/C00002/image    retrieves the gif image file of a compound
/get/hsa05130/image    retrieves the png image file of a pathway map
/get/hsa05130/conf    retrieves the conf file of a pathway map
/get/hsa05130/kgml    retrieves the kgml file of a pathway map
/get/br:br08301    retrieves the htext file of a brite hierarchy
/get/br:br08301/json    retrieves the json file of a brite hierarchy

See also

KEGG WebLinks to retrieve entries in HTML.


CONV

Name

conv – convert KEGG identifiers to/from outside identifiers

URL form

http://rest.kegg.jp/conv/<target_db>/<source_db> (<target_db> <source_db>) = (<kegg_db> <outside_db>) | (<outside_db> <kegg_db>) For gene identifiers: <kegg_db> = <org> <org> = KEGG organism code or T number <outside_db> = ncbi-geneid | ncbi-proteinid | uniprot For chemical substance identifiers: <kegg_db> = compound | glycan | drug <outside_db> = pubchem | chebi

http://rest.kegg.jp/conv/<target_db>/<dbentries> For gene identifiers: <dbentries> = database entries of the following <database> <database> = <org> | genes | ncbi-geneid | ncbi-proteinid | uniprot <org> = KEGG organism code or T number For chemical substance identifiers: <dbentries> = database entries of the following <database> <database> = compound | glycan | drug | pubchem | chebi

Description

This operation can be used to convert entry identifiers (accession numbers) of outside databases to KEGG identifiers, and vice versa. The first form allows database to database mapping, while the second form allows conversion of a selected number of entries. The database name "genes" may be used only in the second form.

Examples

/conv/eco/ncbi-geneid    conversion from NCBI GeneID to KEGG ID for E. coli genes
/conv/ncbi-geneid/eco    opposite direction
/conv/ncbi-proteinid/hsa:10458+ece:Z5100    conversion from KEGG ID to NCBI ProteinID
/conv/genes/ncbi-geneid:19831932    conversion from NCBI GeneID to KEGG ID when the organism code is not known

See also



LINK

Name

link – find related entries by using database cross-references

URL form

http://rest.kegg.jp/link/<target_db>/<source_db> <target_db> = <database> <source_db> = <database> <database> = pathway | brite | module | ko | genome | <org> | compound | glycan | reaction | rclass | enzyme | disease | drug | dgroup | environ | atc | jtc | ndc | yj | pubmed

http://rest.kegg.jp/link/<target_db>/<dbentries> <dbentries> = KEGG database entries of the following <database> <database> = pathway | brite | module | ko | genome | <org> | compound | glycan | reaction | rclass | enzyme | disease | drug | dgroup | environ | genes | atc | jtc | ndc | yj | pubmed

Description

This operation allows retrieval of cross-references within all KEGG databases, as well as pubmed. It is useful for finding various relationships, such as relationships between genes and pathways. The first form allows retrieval of database to database cross-references, while the second form allows retrieval for a selected number of entries. The database name "genes" may be used only for "ko" entries in the second form.

Examples

/link/pathway/hsa    KEGG pathways linked from each of the human genes
/link/hsa/pathway    human genes linked from each of the KEGG pathways
/link/pathway/hsa:10458+ece:Z5100    KEGG pathways linked from a human gene and an E. coli O157 gene
/link/genes/K00500    List of genes with the KO assignment of K00500
/link/hsa/hsa00010    List of human genes in pathway hsa00010
/link/ko/map00010 or /link/ko/ko00010    List of KO entries in pathway map00010 or ko00010
/link/rn/map00010 or /link/rn/rn00010    List of reaction entries in pathway map00010 or rn00010
/link/ec/map00010 or /link/ec/ec00010    List of EC number entries in pathway map00010 or ec00010
/link/cpd/map00010    List of compound entries in pathway map00010
/link/drug/ndc    NDC codes linked from KEGG DRUG entries
/link/ndc/D00564    NDC codes that correspond to given a KEGG DRUG entry


DDI

Name

ddi – find adverse drug-drug interactions

URL form

http://rest.kegg.jp/ddi/<dbentry> <dbentry> = Single entry of the following <database> <database> = drug | ndc | yj

http://rest.kegg.jp/ddi/<dbentries> <dbentries> = Multiple entries of the following <database> <database> = drug | ndc | yj

Description

This operation searches against the KEGG MEDICUS drug interaction database, where drug-drug interactions designated as contraindication (CI) and precaution (P) in Japanese drug labels are extracted and standardized by D number and DG number identifiers. The first form reports all known interactions, while the second form can be used to check if any drug pair in a given set of drugs is CI or P. The database name "drug" should be used instead of "drug_ja". In the second form, multiple entries must belong to the same database.

Examples

/ddi/D00564    drugs that are known to interact with a given drug
/ddi/D00564+D00100+D00109    checks if adverse drug-drug interactions are present among given drugs

See also



Last updated: September 1, 2017