Answers.Body: <p>Pathway-tools has a unique identifier (called a Frame-ID) for each metabolite in its database.  You can get the list of all compounds with this api call:</p>
  
  <p><code>all_cpds = meta.get_class_all_instances('|Compounds|')</code></p>
  
  <p>for each compound, you can also get its common name, or all its synonyms:</p>
  
  <p><code>
  cpd_names = {}
  for cpd_frame_id in all_cpds:
        cpd_names[cpd_frame_id] = meta.get_name_string(cpd_frame_id)
  </code></p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-07-17T23:46:37.833Z
Answers.LastActivityDate: 2017-07-17T23:46:37.833Z
Answers.UserDisplayName: Djinnome
Answers.Body: <p><strong>UPD</strong>: As <a href="https://bioinformatics.stackexchange.com/questions/623/what-methods-should-i-use-from-pythoncyc-api-to-query-metabolites-in-biocyc-data/651?noredirect=1#comment3035_651">suggested</a> by Llopis, maybe the correct identifier is VAL?</p>
  
  <p>I think there is no metabolite with such name in the database. I tried <a href="https://biocyc.org/ECOLI/search-query?type=COMPOUND&amp;name=Valine" rel="nofollow noreferrer">their search</a>, the correct name seems to be <code>L-valine</code>. I expect that they use similar naming for other amino acids. If you cannot find something, you can use their compound search through the website. </p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-06-12T23:33:14.603Z
Answers.Text: I have tried 'L-valine' in the script above and it has also gave me the same error. I am aware it is possible to search in the site, however for my purpose I must write a query. My purpose is to obtain possible pathway networks for a given metabolics dataset
Answers.UserDisplayName: astridmarilyn
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-07-13T07:31:01.497Z
Answers.Text: @astrika maybe the name is [Protein-L-valine](https://biocyc.org/compound?orgid=ECOLI&id=Protein-L-valine), or [VAL](https://biocyc.org/compound?orgid=ECOLI&id=VAL). One thing is how they store things an another is how they show them. Sorry I didn't test how to search using python
Answers.UserDisplayName: llrs
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-06-11T21:57:03.280Z
Answers.LastActivityDate: 2017-07-13T11:02:02.967Z
Answers.LastEditDate: 2017-07-13T11:02:02.967Z
Answers.UserDisplayName: Iakov Davydov
Body: <p>I am using <strong>PythonCyc</strong> API in order to write a query for metabolites in <strong>BioCyc</strong>. The purpose of this API is to communicate with the database software of BioCyc- Pathway Tools. Pathway Tools is in lisp therefore, PythonCyc creates a bridge between python and common lisp. To use this this API one must first create a PGDB object with a specified organism ID (orgid). In the example below I create a PGDB with orgid "meta". After this, I am able to call methods from PythonCyc with this object:</p>
  
  <pre><code>import sys
  import pythoncyc
  #this creates PGDB object associated with meta(MetaCyc)
  meta = pythoncyc.select_organism('meta')
  #lists pathways of specified compound
  pathways = meta.pathways_of_compound('sucrose')
  print pathways
  </code></pre>
  
  <p>The query for the metabolite above, 'sucrose', provides a list a pathways:</p>
  
  <pre><code>[u'|PWY-7347|', u'|SUCSYN-PWY|', u'|PWY-7238|', u'|PWY-6527|', u'|PWY-5343|', u'|PWY-3801|', u'|PWY-7345|', u'|PWY-862|', u'|SUCUTIL-PWY|', u'|PWY66-373|', u'|PWY-621|', u'|PWY-822|', u'|SUCROSEUTIL2-PWY|', u'|PWY-6525|', u'|PWY-6524|', u'|PWY-5337|', u'|PWY-5384|']
  </code></pre>
  
  <p>However if I switch this metabolite name to a common amino acid name, such as 'valine':</p>
  
  <pre><code>import sys
  import pythoncyc
  #this creates PGDB object associated with meta(MetaCyc)
  meta = pythoncyc.select_organism('meta')
  #lists pathways of specified compound
  pathways = meta.pathways_of_compound('valine')
  print pathways
  </code></pre>
  
  <p>The query provides an error message that states "non coercible frame", which means it cannot find this ID. This is a common metabolite, just as sucrose, which should very well have pathway entries in database, however there are none found with this method. I have also tried synonyms of valine and other methods such as "all_pathways(cpds)" stated in API, which give me the same error message.
  What is the reason for this? Does BioCyc not list any pathways for amino acids? Or am I using an incorrect method to access amino acid information?</p>
  
  <p><a href="http://pythoncyc.readthedocs.io/en/latest/" rel="noreferrer">Link to PythonCyc API</a></p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-06-09T21:23:30.660Z
Comments.Text: Hi astrika, thanks for your question and welcome to Bioinformatics Stack Exchange. I've had a glance over this question, and it looks like it has the potential to get good answers: it is well-researched, with a good story, and a specific question. I look forward to seeing more questions from you in the future.
Comments.UserDisplayName: gringer
Tags: <python><api>
Title: What methods should I use from PythonCyc API to query metabolites in BioCyc database?
ThreadText: # What methods should I use from PythonCyc API to query metabolites in BioCyc database?
  
  (Asked by: username_0 on 2017-06-09)
  
  I am using **PythonCyc** API in order to write a query for metabolites in **BioCyc**. The purpose of this API is to communicate with the database software of BioCyc- Pathway Tools. Pathway Tools is in lisp therefore, PythonCyc creates a bridge between python and common lisp. To use this this API one must first create a PGDB object with a specified organism ID (orgid). In the example below I create a PGDB with orgid "meta". After this, I am able to call methods from PythonCyc with this object:
  
  ```
  import sys
  import pythoncyc
  #this creates PGDB object associated with meta(MetaCyc)
  meta = pythoncyc.select_organism('meta')
  #lists pathways of specified compound
  pathways = meta.pathways_of_compound('sucrose')
  print pathways
  
  ```
  
  The query for the metabolite above, 'sucrose', provides a list a pathways:
  
  ```
  [u'|PWY-7347|', u'|SUCSYN-PWY|', u'|PWY-7238|', u'|PWY-6527|', u'|PWY-5343|', u'|PWY-3801|', u'|PWY-7345|', u'|PWY-862|', u'|SUCUTIL-PWY|', u'|PWY66-373|', u'|PWY-621|', u'|PWY-822|', u'|SUCROSEUTIL2-PWY|', u'|PWY-6525|', u'|PWY-6524|', u'|PWY-5337|', u'|PWY-5384|']
  
  ```
  
  However if I switch this metabolite name to a common amino acid name, such as 'valine':
  
  ```
  import sys
  import pythoncyc
  #this creates PGDB object associated with meta(MetaCyc)
  meta = pythoncyc.select_organism('meta')
  #lists pathways of specified compound
  pathways = meta.pathways_of_compound('valine')
  print pathways
  
  ```
  
  The query provides an error message that states "non coercible frame", which means it cannot find this ID. This is a common metabolite, just as sucrose, which should very well have pathway entries in database, however there are none found with this method. I have also tried synonyms of valine and other methods such as "all\_pathways(cpds)" stated in API, which give me the same error message.
  What is the reason for this? Does BioCyc not list any pathways for amino acids? Or am I using an incorrect method to access amino acid information?
  
  [Link to PythonCyc API](http://pythoncyc.readthedocs.io/en/latest/)
  
  **Tags:** python, api
  
  > **Comments:**
  > **username_1**: Hi astrika, thanks for your question and welcome to Bioinformatics Stack Exchange. I've had a glance over this question, and it looks like it has the potential to get good answers: it is well-researched, with a good story, and a specific question. I look forward to seeing more questions from you in the future.  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_2 on 2017-07-17. Score: 3
  
  Pathway-tools has a unique identifier (called a Frame-ID) for each metabolite in its database. You can get the list of all compounds with this api call:
  
  `all_cpds = meta.get_class_all_instances('|Compounds|')`
  
  for each compound, you can also get its common name, or all its synonyms:
  
  `cpd_names = {}
  for cpd_frame_id in all_cpds:
  cpd_names[cpd_frame_id] = meta.get_name_string(cpd_frame_id)`
  
  
  ---
  
  ### Answer by username_3 on 2017-06-11. Score: 3
  
  **UPD**: As [suggested](https://bioinformatics.stackexchange.com/questions/623/what-methods-should-i-use-from-pythoncyc-api-to-query-metabolites-in-biocyc-data/651?noredirect=1#comment3035_651) by Llopis, maybe the correct identifier is VAL?
  
  I think there is no metabolite with such name in the database. I tried [their search](https://biocyc.org/ECOLI/search-query?type=COMPOUND&name=Valine), the correct name seems to be `L-valine`. I expect that they use similar naming for other amino acids. If you cannot find something, you can use their compound search through the website.
  
  > **Comments:**
  > **username_0**: I have tried 'L-valine' in the script above and it has also gave me the same error. I am aware it is possible to search in the site, however for my purpose I must write a query. My purpose is to obtain possible pathway networks for a given metabolics dataset  
  > **username_4**: @astrika maybe the name is [Protein-L-valine](https://biocyc.org/compound?orgid=ECOLI&id=Protein-L-valine), or [VAL](https://biocyc.org/compound?orgid=ECOLI&id=VAL). One thing is how they store things an another is how they show them. Sorry I didn't test how to search using python  
  
  ---
  
  