Answers.Body: <p>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. </p>
  
  <p>You may have other useful service such as unichem, chemspider (you would need a login though for that one) could help as well. </p>
  
  <p><strong>Disclaimer</strong>: I'm the bioservices main author</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-10-25T09:14:41.480Z
Answers.LastActivityDate: 2017-10-25T19:40:31.017Z
Answers.LastEditDate: 2017-10-25T19:40:31.017Z
Answers.UserDisplayName: user1678
Body: <p>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 <a href="https://pythonhosted.org/bioservices/" rel="nofollow noreferrer">bioservices</a>). </p>
  
  <p>One could do it via ChEBI like this:</p>
  
  <pre><code>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
  </code></pre>
  
  <p>which will print</p>
  
  <pre><code>NCCCC[C@H](N)C(O)=O
  InChI=1S/C6H14N2O2/c7-4-2-1-3-5(8)6(9)10/h5H,1-4,7-8H2,(H,9,10)/t5-/m0/s1
  KDXKERNSBIXSRK-YFKPBYRVSA-N
  </code></pre>
  
  <p>Is there a direct way which does not require to go via <code>ChEBI</code>?</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-09-01T13:37:06.460Z
Comments.Text: 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 ($$$)
Comments.UserDisplayName: mgalardini
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-09-01T13:39:58.733Z
Comments.Text: @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.
Comments.UserDisplayName: Cleb
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-09-01T15:43:54.537Z
Comments.Text: It's not too bad, especially considering that you have a library to do it for you :)
Comments.UserDisplayName: mgalardini
Tags: <database><python><kegg><data-retrieval>
Title: How to retrieve InChI key for KEGG compound?
ThreadText: # How to retrieve InChI key for KEGG compound?
  
  (Asked by: username_0 on 2017-09-01)
  
  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](https://pythonhosted.org/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
  
  ```
  NCCCC[C@H](N)C(O)=O
  InChI=1S/C6H14N2O2/c7-4-2-1-3-5(8)6(9)10/h5H,1-4,7-8H2,(H,9,10)/t5-/m0/s1
  KDXKERNSBIXSRK-YFKPBYRVSA-N
  
  ```
  
  Is there a direct way which does not require to go via `ChEBI`?
  
  **Tags:** database, python, kegg, data-retrieval
  
  > **Comments:**
  > **username_1**: 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 ($$$)  
  > **username_0**: @username_1: 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.  
  > **username_1**: It's not too bad, especially considering that you have a library to do it for you :)  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2017-10-25. Score: 2 | Accepted answer
  
  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
  
  
  ---
  
  