Case 2: EC reaction information in KEGG

Starting from an Enzyme Commission (EC) number, this walkthrough finds the associated KEGG reactions, their compounds, and the orthology group.

1. Reactions associated with an EC number

kegg_link takes the target database (reaction) and the EC number as ec:X.X.X.X, and returns every reaction linked to that enzyme:

rxns = KEGGAPI.kegg_link("reaction", "ec:3.2.1.14")
DataFrame(rxns.data, rxns.colnames)
4×2 DataFrame
RowTarget IDSource ID
StringString
1ec:3.2.1.14rn:R01206
2ec:3.2.1.14rn:R02334
3ec:3.2.1.14rn:R06081
4ec:3.2.1.14rn:R06082

2. Reaction information

The second column of rxns.data holds the reaction identifiers (rn:R…). Pass them to kegg_get to retrieve the full entries; .data is a vector with one flat-file String per reaction:

info = KEGGAPI.kegg_get(rxns.data[2])
println(join(first(split(info.data[1], "\n"), 6), "\n"))
ENTRY       R01206                      Reaction
NAME        [1,4-(N-acetyl-beta-D-glucosaminyl)]n glycanohydrolase
DEFINITION  Chitin + H2O <=> N-Acetyl-D-glucosamine + Chitin
EQUATION    C00461 + C00001 <=> C00140 + C00461
REMARK      Same as: R06081
RCLASS      RC00467  C00140_C00461

3. Compounds involved in a reaction

cpds = KEGGAPI.kegg_link("compound", "rn:R01206")
DataFrame(cpds.data, cpds.colnames)
4×2 DataFrame
RowTarget IDSource ID
StringString
1rn:R01206cpd:C00001
2rn:R01206cpd:C00140
3rn:R01206cpd:C00461
4rn:R01206cpd:C00461

Retrieve the compound entries the same way as the reactions:

cpd_info = KEGGAPI.kegg_get(cpds.data[2])
println(join(first(split(cpd_info.data[1], "\n"), 6), "\n"))
ENTRY       C00001                      Compound
NAME        H2O;
            Water
FORMULA     H2O
EXACT_MASS  18.0106
MOL_WEIGHT  18.02

4. Reaction image

The :image option returns the PNG bytes for a reaction, which you can save to disk:

img = KEGGAPI.kegg_get("rn:R01206", :image)
open("R01206.png", "w") do io
    write(io, img.data)
end

5. Orthology group for a reaction

ko = KEGGAPI.kegg_link("ko", "rn:R01206")
DataFrame(ko.data, ko.colnames)
4×2 DataFrame
RowTarget IDSource ID
StringString
1rn:R01206ko:K01183
2rn:R01206ko:K13381
3rn:R01206ko:K20547
4rn:R01206ko:K29107