Note: this question has also been asked on Biostars

I need the get the list of gene names involved in glycolysis (to put an example). Not manually, I need to do this in a script. Ideally with Python. I think KEGG is the proper database to do this, but any other (free) suggestion would do.

How can I do it?

  • $\begingroup$ To your knowledge there are other metabolic pathways, including metaCyc, reactome,... $\endgroup$ – llrs Sep 24 '17 at 15:50
  • $\begingroup$ I could see that this question is reposted on Biostars. Here is the solution, https://www.biostars.org/p/274321/#274326 $\endgroup$ – EagleEye Sep 24 '17 at 17:24

I whipped this little script up using the KEGG API:

#!/usr/bin/env python3
import urllib.request
import re
import sys
pathway = 'hsa00010' # glycolysis
url = "http://rest.kegg.jp/get/" + pathway
with urllib.request.urlopen(url) as f:
    lines = f.read().decode('utf-8').splitlines()
    want = 0
    for line in lines:
        fields = line.split()
        ## The list of genes starts here
        if fields[0] == 'GENE':
            want = 1
            ## The line with GENE is different
        ## We reached the next section of the file
        elif want == 1 and re.match('^\S', line):
        ## We're still in the list of genes
        if want == 1 and len(fields)>1:

using the REST API of togows: one can fetch a json structure of the genes associated to a kegg pathway. eg: http://togows.org/entry/kegg-pathway/hsa00010/genes.json

    "3101": "HK3; hexokinase 3 [KO:K00844] [EC:]",
    "3098": "HK1; hexokinase 1 [KO:K00844] [EC:]",
    "3099": "HK2; hexokinase 2 [KO:K00844] [EC:]",
    "80201": "HKDC1; hexokinase domain containing 1 [KO:K00844] [EC:]",
    "2645": "GCK; glucokinase [KO:K12407] [EC:]",
    "2821": "GPI; glucose-6-phosphate isomerase [KO:K01810] [EC:]",
    "5213": "PFKM; phosphofructokinase, muscle [KO:K00850] [EC:]",
    "5214": "PFKP; phosphofructokinase, platelet [KO:K00850] [EC:]",
    "5211": "PFKL; phosphofructokinase, liver type [KO:K00850] [EC:]",
    "2203": "FBP1; fructose-bisphosphatase 1 [KO:K03841] [EC:]",
    "8789": "FBP2; fructose-bisphosphatase 2 [KO:K03841] [EC:]",
    "230": "ALDOC; aldolase, fructose-bisphosphate C [KO:K01623] [EC:]",
    "226": "ALDOA; aldolase, fructose-bisphosphate A [KO:K01623] [EC:]",
    "229": "ALDOB; aldolase, fructose-bisphosphate B [KO:K01623] [EC:]",
    "7167": "TPI1; triosephosphate isomerase 1 [KO:K01803] [EC:]",
    "2597": "GAPDH; glyceraldehyde-3-phosphate dehydrogenase [KO:K00134] [EC:]",
    "26330": "GAPDHS; glyceraldehyde-3-phosphate dehydrogenase, spermatogenic [KO:K10705] [EC:]",
    "5232": "PGK2; phosphoglycerate kinase 2 [KO:K00927] [EC:]",
    "5230": "PGK1; phosphoglycerate kinase 1 [KO:K00927] [EC:]",
    "5223": "PGAM1; phosphoglycerate mutase 1 [KO:K01834] [EC:]",
    "5224": "PGAM2; phosphoglycerate mutase 2 [KO:K01834] [EC:]",
    "441531": "PGAM4; phosphoglycerate mutase family member 4 [KO:K01834] [EC:]",
    "2027": "ENO3; enolase 3 [KO:K01689] [EC:]",
    "2026": "ENO2; enolase 2 [KO:K01689] [EC:]",
    "2023": "ENO1; enolase 1 [KO:K01689] [EC:]",
    "5315": "PKM; pyruvate kinase, muscle [KO:K00873] [EC:]",
    "5313": "PKLR; pyruvate kinase, liver and RBC [KO:K12406] [EC:]",
    "5161": "PDHA2; pyruvate dehydrogenase alpha 2 [KO:K00161] [EC:]",
    "5160": "PDHA1; pyruvate dehydrogenase alpha 1 [KO:K00161] [EC:]",
    "5162": "PDHB; pyruvate dehydrogenase (lipoamide) beta [KO:K00162] [EC:]",
    "1737": "DLAT; dihydrolipoamide S-acetyltransferase [KO:K00627] [EC:]",
    "1738": "DLD; dihydrolipoamide dehydrogenase [KO:K00382] [EC:]",
    "160287": "LDHAL6A; lactate dehydrogenase A like 6A [KO:K00016] [EC:]",
    "92483": "LDHAL6B; lactate dehydrogenase A like 6B [KO:K00016] [EC:]",
    "3939": "LDHA; lactate dehydrogenase A [KO:K00016] [EC:]",
    "3945": "LDHB; lactate dehydrogenase B [KO:K00016] [EC:]",
    "3948": "LDHC; lactate dehydrogenase C [KO:K00016] [EC:]",
    "124": "ADH1A; alcohol dehydrogenase 1A (class I), alpha polypeptide [KO:K13951] [EC:]",
    "125": "ADH1B; alcohol dehydrogenase 1B (class I), beta polypeptide [KO:K13951] [EC:]",
    "126": "ADH1C; alcohol dehydrogenase 1C (class I), gamma polypeptide [KO:K13951] [EC:]",
    "131": "ADH7; alcohol dehydrogenase 7 (class IV), mu or sigma polypeptide [KO:K13951] [EC:]",
    "127": "ADH4; alcohol dehydrogenase 4 (class II), pi polypeptide [KO:K13980] [EC:]",
    "128": "ADH5; alcohol dehydrogenase 5 (class III), chi polypeptide [KO:K00121] [EC:]",
    "130": "ADH6; alcohol dehydrogenase 6 (class V) [KO:K13952] [EC:]",
    "10327": "AKR1A1; aldo-keto reductase family 1 member A1 [KO:K00002] [EC:]",
    "217": "ALDH2; aldehyde dehydrogenase 2 family (mitochondrial) [KO:K00128] [EC:]",
    "224": "ALDH3A2; aldehyde dehydrogenase 3 family member A2 [KO:K00128] [EC:]",
    "219": "ALDH1B1; aldehyde dehydrogenase 1 family member B1 [KO:K00128] [EC:]",
    "501": "ALDH7A1; aldehyde dehydrogenase 7 family member A1 [KO:K14085] [EC:]",
    "223": "ALDH9A1; aldehyde dehydrogenase 9 family member A1 [KO:K00149] [EC:]",
    "221": "ALDH3B1; aldehyde dehydrogenase 3 family member B1 [KO:K00129] [EC:]",
    "222": "ALDH3B2; aldehyde dehydrogenase 3 family member B2 [KO:K00129] [EC:]",
    "220": "ALDH1A3; aldehyde dehydrogenase 1 family member A3 [KO:K00129] [EC:]",
    "218": "ALDH3A1; aldehyde dehydrogenase 3 family member A1 [KO:K00129] [EC:]",
    "84532": "ACSS1; acyl-CoA synthetase short chain family member 1 [KO:K01895] [EC:]",
    "55902": "ACSS2; acyl-CoA synthetase short chain family member 2 [KO:K01895] [EC:]",
    "130589": "GALM; galactose mutarotase [KO:K01785] [EC:]",
    "5236": "PGM1; phosphoglucomutase 1 [KO:K01835] [EC:]",
    "55276": "PGM2; phosphoglucomutase 2 [KO:K15779] [EC:]",
    "2538": "G6PC; glucose-6-phosphatase catalytic subunit [KO:K01084] [EC:]",
    "57818": "G6PC2; glucose-6-phosphatase catalytic subunit 2 [KO:K01084] [EC:]",
    "92579": "G6PC3; glucose-6-phosphatase catalytic subunit 3 [KO:K01084] [EC:]",
    "83440": "ADPGK; ADP dependent glucokinase [KO:K08074] [EC:]",
    "669": "BPGM; bisphosphoglycerate mutase [KO:K01837] [EC:]",
    "9562": "MINPP1; multiple inositol-polyphosphate phosphatase 1 [KO:K03103] [EC:]",
    "5105": "PCK1; phosphoenolpyruvate carboxykinase 1 [KO:K01596] [EC:]",
    "5106": "PCK2; phosphoenolpyruvate carboxykinase 2, mitochondrial [KO:K01596] [EC:]"

Answers from Biostars:

GeneSCF 'prepare_database' module will extract all the pathways with corresponding genes as simple table format in plain text file. Check 'Two step process' (sub-heading) from the provided link (First step will do your job).

You can use KEGG REST API for extracting gene names from the pathway. Python request library can be used to make the REST calls to KEGG REST API and query information. Please follow this tutorial if you are a newbie to the Python programming and REST web services.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.