Skip to content

Python API Reference

Zachary King edited this page Apr 7, 2014 · 16 revisions

escher includes a Python package for building maps. Maps generated with the Python API can be viewed in a browser, shared as standalone HTML files, or displayed directly in an IPython Notebook.

Installation

The Python package for Escher can be installed using pip:

pip install escher

Alternatively, one can download the source files and install the package directly:

python setup.py install

Maps

When a Map object is created, the map data is automatically downloaded and cached locally. A list of map IDs that are available are kept up-to-date at http://zakandrewking.github.io/escher/.

API

escher.Map

Map(map_name="e-coli-core", flux={})

Generates a new Map object.

  • map_name: This is the map ID available from http://zakandrewking.github.io/escher/. The map data will be downloaded when Map() is called, if it is not already cached.

  • flux: A dictionary with reaction IDs as keys and flux values as keys.

create_standalone_html(outfilepath=None)

Outputs the maps as a standalone HTML file. Supply outfilepath to save the file to a particular location. If outfilepath is not supplied, then a temporary file is generated and displayed. Paste this file path into a web browser to view the map.

view_browser()

Generates a temporary HTML file and launches it with the default application. Note: If .html files are associated with an application other than your browser, then this function will not behave as advertised. The create_standalone_html() function is a safer bet.

_repr_html()

Generates the html map view. When a Map is generated in an IPython Notebook (and not assigned to a variable), then _repr_html() is called automatically and the map will appear.

Clone this wiki locally