Created
March 29, 2012 02:30
-
-
Save pckujawa/2232604 to your computer and use it in GitHub Desktop.
telling python how to create a dict out of your object (via interpreter on KEGG web API data)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| >>> from SOAPpy import WSDL | |
| >>> wsdl = 'http://soap.genome.jp/KEGG.wsdl' | |
| >>> serv = WSDL.Proxy(wsdl) | |
| >>> pathways = serv.list_pathways('map') | |
| >>> ps=pathways | |
| >>> ps[0] | |
| <SOAPpy.Types.structType item at 37525944>: {'definition': 'Glycolysis / Gluconeogenesis - Reference pathway', 'entry_id': 'path:map00010'} | |
| >>> ps[0].__dict__ | |
| {'_attrs': {}, | |
| '_cache': None, | |
| '_data': None, | |
| '_keyord': [u'entry_id', u'definition'], | |
| '_name': u'item', | |
| '_ns': u'SOAP/KEGG', | |
| '_type': 'struct', | |
| '_typed': 1, | |
| u'definition': 'Glycolysis / Gluconeogenesis - Reference pathway', | |
| u'entry_id': 'path:map00010'} | |
| >>> dict(ps[0]) | |
| Traceback (most recent call last): | |
| File "<interactive input>", line 1, in <module> | |
| ValueError: dictionary update sequence element #0 has length 13; 2 is required | |
| >>> dict([ps[0]]) | |
| {'path:map00010': 'Glycolysis / Gluconeogenesis - Reference pathway'} |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The gist is, I assume, the
keyordmember in the class - I assume it tells python how to create a dict (i.e. useentry_idas the key anddefinitionas the value).For KEGG info, see http://www.kegg.jp/kegg/soap/doc/keggapi_manual.html