I would like to retrieve the InChI representation for a given KEGG compound but I fail to find a direct solution for this (preferably doing it via bioservices).

One could do it via ChEBI like this:

from bioservices import *

kegg_con = KEGG()

kegg_entry = kegg_con.parse(kegg_con.get('C00047'))

chebi_con = ChEBI()

chebi_entry = chebi_con.getCompleteEntity('CHEBI:' + kegg_entry['DBLINKS']['ChEBI'])

print chebi_entry.smiles
print chebi_entry.inchi
print chebi_entry.inchiKey

which will print


Is there a direct way which does not require to go via ChEBI?

  • $\begingroup$ I had a look at the KEGG rest API but couldn't find anything; I think you might need to access the data in the KEGG FTP ($$$) $\endgroup$
    – mgalardini
    Sep 1, 2017 at 13:37
  • 1
    $\begingroup$ @mgalardini: I checked that, but seems it is not available at all, or I overlooked it. The way above is still feasible, just requires one additional step. $\endgroup$
    – Cleb
    Sep 1, 2017 at 13:39
  • 2
    $\begingroup$ It's not too bad, especially considering that you have a library to do it for you :) $\endgroup$
    – mgalardini
    Sep 1, 2017 at 15:43

1 Answer 1


I'm not aware of a functionality in the KEGG service that would allow you to do that directly. I believe your solution (using e.g. ChEBI) is the correct one.

You may have other useful service such as unichem, chemspider (you would need a login though for that one) could help as well.

Disclaimer: I'm the bioservices main author


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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