Created
May 6, 2016 09:35
-
-
Save kozo2/4a6d4369f8cf904255f6e082a93d5524 to your computer and use it in GitHub Desktop.
This file contains 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
{ | |
"cells": [ | |
{ | |
"cell_type": "code", | |
"execution_count": 1, | |
"metadata": { | |
"collapsed": true | |
}, | |
"outputs": [], | |
"source": [ | |
"from see import see" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 2, | |
"metadata": { | |
"collapsed": true | |
}, | |
"outputs": [], | |
"source": [ | |
"from Bio.KEGG.REST import *\n", | |
"from Bio.KEGG.KGML import KGML_parser" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 3, | |
"metadata": { | |
"collapsed": true | |
}, | |
"outputs": [], | |
"source": [ | |
"pathway = KGML_parser.read(kegg_get(\"ko00061\", \"kgml\"))" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 4, | |
"metadata": { | |
"collapsed": false | |
}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"<Bio.KEGG.KGML.KGML_pathway.Pathway at 0x103961e10>" | |
] | |
}, | |
"execution_count": 4, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"pathway" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 5, | |
"metadata": { | |
"collapsed": false | |
}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
" hash() help() repr() str()\n", | |
" .add_entry() .add_reaction() .add_relation() .bounds\n", | |
" .compounds .element .entries .genes\n", | |
" .get_KGML() .image .link .maps\n", | |
" .name .number .org .orthologs\n", | |
" .reaction_entries .reactions .relations\n", | |
" .remove_entry() .remove_reaction() .remove_relation() .title" | |
] | |
}, | |
"execution_count": 5, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"see(pathway)" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 6, | |
"metadata": { | |
"collapsed": false | |
}, | |
"outputs": [ | |
{ | |
"name": "stdout", | |
"output_type": "stream", | |
"text": [ | |
"Help on Pathway in module Bio.KEGG.KGML.KGML_pathway object:\n", | |
"\n", | |
"class Pathway(__builtin__.object)\n", | |
" | Represents a KGML pathway from KEGG.\n", | |
" | \n", | |
" | Specifies graph information for the pathway map, as described in\n", | |
" | release KGML v0.7.1 (http://www.kegg.jp/kegg/xml/docs/)\n", | |
" | \n", | |
" | Attributes:\n", | |
" | name KEGGID of the pathway map\n", | |
" | org ko/ec/[org prefix]\n", | |
" | number map number (integer)\n", | |
" | title the map title\n", | |
" | image URL of the image map for the pathway\n", | |
" | link URL of information about the pathway\n", | |
" | entries Dictionary of entries in the pathway, keyed by node ID\n", | |
" | reactions Set of reactions in the pathway\n", | |
" | \n", | |
" | The name attribute has a restricted format, so we make it a property and\n", | |
" | enforce the formatting.\n", | |
" | \n", | |
" | The Pathway object is the only allowed route for adding/removing\n", | |
" | Entry, Reaction, or Relation elements.\n", | |
" | \n", | |
" | Entries are held in a dictionary and keyed by the node ID for the\n", | |
" | pathway graph - this allows for ready access via the Reaction/Relation\n", | |
" | etc. elements. Entries must be added before reference by any other\n", | |
" | element.\n", | |
" | \n", | |
" | Reactions are held in a dictionary, keyed by node ID for the path.\n", | |
" | The elements referred to in the reaction must be added before the\n", | |
" | reaction itself.\n", | |
" | \n", | |
" | Methods defined here:\n", | |
" | \n", | |
" | __init__(self)\n", | |
" | \n", | |
" | __str__(self)\n", | |
" | Returns a readable summary description string.\n", | |
" | \n", | |
" | add_entry(self, entry)\n", | |
" | Add an Entry element to the pathway.\n", | |
" | \n", | |
" | add_reaction(self, reaction)\n", | |
" | Add a Reaction element to the pathway.\n", | |
" | \n", | |
" | add_relation(self, relation)\n", | |
" | Add a Relation element to the pathway.\n", | |
" | \n", | |
" | get_KGML(self)\n", | |
" | Return the pathway as a string in prettified KGML format.\n", | |
" | \n", | |
" | remove_entry(self, entry)\n", | |
" | Remove an Entry element from the pathway.\n", | |
" | \n", | |
" | remove_reaction(self, reaction)\n", | |
" | Remove a Reaction element from the pathway.\n", | |
" | \n", | |
" | remove_relation(self, relation)\n", | |
" | Remove a Relation element from the pathway.\n", | |
" | \n", | |
" | ----------------------------------------------------------------------\n", | |
" | Data descriptors defined here:\n", | |
" | \n", | |
" | __dict__\n", | |
" | dictionary for instance variables (if defined)\n", | |
" | \n", | |
" | __weakref__\n", | |
" | list of weak references to the object (if defined)\n", | |
" | \n", | |
" | bounds\n", | |
" | Coordinate bounds for all Graphics elements in the Pathway.\n", | |
" | \n", | |
" | Returns the [(xmin, ymin), (xmax, ymax)] coordinates for all\n", | |
" | Graphics elements in the Pathway\n", | |
" | \n", | |
" | compounds\n", | |
" | Get a list of entries of type compound.\n", | |
" | \n", | |
" | element\n", | |
" | Return the Pathway as a valid KGML element.\n", | |
" | \n", | |
" | genes\n", | |
" | Get a list of entries of type gene.\n", | |
" | \n", | |
" | maps\n", | |
" | Get a list of entries of type map.\n", | |
" | \n", | |
" | name\n", | |
" | The KEGGID for the pathway map.\n", | |
" | \n", | |
" | number\n", | |
" | The KEGG map number.\n", | |
" | \n", | |
" | orthologs\n", | |
" | Get a list of entries of type ortholog.\n", | |
" | \n", | |
" | reaction_entries\n", | |
" | Get a list of entries corresponding to each reaction\n", | |
" | in the pathway.\n", | |
" | \n", | |
" | reactions\n", | |
" | Get a list of reactions in the pathway.\n", | |
" | \n", | |
" | relations\n", | |
" | Get a list of relations in the pathway.\n", | |
"\n" | |
] | |
} | |
], | |
"source": [ | |
"help(pathway)" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 12, | |
"metadata": { | |
"collapsed": false | |
}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
" hash() help() repr() str()\n", | |
" .add_component() .add_graphics() .alt .bounds\n", | |
" .components .element .graphics .id\n", | |
" .image .is_reactant .link .name\n", | |
" .reaction .remove_component() .remove_graphics() .type" | |
] | |
}, | |
"execution_count": 12, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"see(pathway.compounds[0])" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 15, | |
"metadata": { | |
"collapsed": false | |
}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
" hash() help() repr() str() .bgcolor .bounds\n", | |
" .centre .coords .element .fgcolor .height .name\n", | |
" .type .width .x .y" | |
] | |
}, | |
"execution_count": 15, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"see(pathway.compounds[0].graphics[0])" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 17, | |
"metadata": { | |
"collapsed": false | |
}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"671.0" | |
] | |
}, | |
"execution_count": 17, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"pathway.compounds[0].graphics[0].y" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": null, | |
"metadata": { | |
"collapsed": true | |
}, | |
"outputs": [], | |
"source": [ | |
"" | |
] | |
} | |
], | |
"metadata": { | |
"kernelspec": { | |
"display_name": "Python 2", | |
"language": "python", | |
"name": "python2" | |
}, | |
"language_info": { | |
"codemirror_mode": { | |
"name": "ipython", | |
"version": 2.0 | |
}, | |
"file_extension": ".py", | |
"mimetype": "text/x-python", | |
"name": "python", | |
"nbconvert_exporter": "python", | |
"pygments_lexer": "ipython2", | |
"version": "2.7.10" | |
} | |
}, | |
"nbformat": 4, | |
"nbformat_minor": 0 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment