Module Expr Str ImportFrom alias Import alias Import alias Import alias Import alias Import alias Import alias Import alias FunctionDef arguments args NameParam defaults body Expr Str Expr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad Assign NameStore Call AttributeLoad NameLoad attr keyword NameLoad keyword Str Assign NameStore ListComp NameLoad comprehension TupleStore NameStore NameStore AttributeLoad NameLoad attr For TupleStore NameStore NameStore Call NameLoad AttributeLoad NameLoad attr body Assign NameStore BinOpMod Str NameLoad Assign NameStore Call AttributeLoad NameLoad attr Str Str Call NameLoad NameLoad AugAssignAdd NameStore Str Assign NameStore Str If Call NameLoad ListComp NameLoad comprehension NameStore NameLoad Call AttributeLoad NameLoad attr NameLoad body Assign NameStore Str Expr Call AttributeLoad NameLoad attr NameLoad keyword NameLoad keyword Str keyword NameLoad keyword Str keyword Str keyword Str keyword Str For TupleStore NameStore NameStore Call NameLoad AttributeLoad NameLoad attr body Assign NameStore BinOpMod Str NameLoad Expr Call AttributeLoad NameLoad attr NameLoad keyword NameLoad keyword Str keyword Str keyword Str keyword Str keyword Str keyword Str keyword Str keyword Str Assign NameStore Call NameLoad SubscriptLoad NameLoad Index Str Assign NameStore Call NameLoad SubscriptLoad NameLoad Index Str Assign NameStore BinOpBitAnd NameLoad NameLoad Assign NameStore BinOpSub NameLoad NameLoad Assign NameStore BinOpSub NameLoad NameLoad Assign NameStore IfExp SubscriptLoad NameLoad Index Str Dict Str Str Str Str Dict For NameStore NameLoad body Expr Call NameLoad NameLoad NameLoad NameLoad NameLoad For NameStore NameLoad body Expr Call NameLoad NameLoad NameLoad NameLoad keyword NameLoad NameLoad For NameStore NameLoad body Expr Call NameLoad NameLoad NameLoad NameLoad keyword Str Return Call AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults kwarg body Assign NameStore TupleLoad BinOpMod Str NameLoad BinOpMod Str NameLoad If Call AttributeLoad NameLoad attr Str body Delete SubscriptDel NameLoad Index Str Assign NameStore Call NameLoad NameLoad Expr Call AttributeLoad NameLoad attr Str Str Expr Call AttributeLoad NameLoad attr NameLoad NameLoad decorator_list Assign NameStore NameLoad Assign NameStore SubscriptLoad NameLoad Slice Num If CompareEq NameLoad Str body If CompareLtE Call NameLoad AttributeLoad NameLoad attr Num body Expr Call NameLoad NameLoad keyword Str Expr Call NameLoad Assign NameStore SubscriptLoad AttributeLoad NameLoad attr Index Num If UnaryOpNot Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad body Raise Call NameLoad BinOpMod Str NameLoad If UnaryOpNot Call AttributeLoad NameLoad attr Str NameLoad body Raise Call NameLoad BinOpMod Str NameLoad Expr Call AttributeLoad AttributeLoad NameLoad attr attr Num Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad Assign NameStore Call AttributeLoad NameLoad attr Str Str Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad TryExcept body Assign NameStore Call NameLoad NameLoad handlers ExceptHandler type NameLoad name NameStore body Expr Call NameLoad Str Raise TryExcept body Assign NameStore SubscriptLoad AttributeLoad NameLoad attr Index Str handlers ExceptHandler type NameLoad body Raise Call NameLoad BinOpMod Str NameLoad Expr Call NameLoad Call NameLoad NameLoad
N/A N/A 
Usage
=====

Usage: ``python -m pysb.tools.render_reactions mymodel.py > mymodel.dot``

Renders the reactions produced by a model into the "dot" graph format which can
be visualized with Graphviz.

To create a PDF from the .dot file, use the "dot" command from Graphviz::

    dot mymodel.dot -T pdf -O

This will create mymodel.dot.pdf. You can also change the "dot" command to one
of the other Graphviz drawing tools for a different type of layout. Note that
you can pipe the output of render_reactions straight into Graphviz without
creating an intermediate .dot file, which is especially helpful if you are
making continuous changes to the model and need to visualize your changes
repeatedly::

    python -m pysb.tools.render_reactions mymodel.py | dot -T pdf -o mymodel.pdf

Note that some PDF viewers will auto-reload a changed PDF, so you may not even
need to manually reopen it every time you rerun the tool.

Output for Robertson example model
==================================

The Robertson example model (in ``pysb.examples.robertson``) contains
the following three reactions:

* A -> B
* B + B -> B + C
* C + B -> C + A

The reaction network diagram for this system as generated by this module and
rendered using ``dot`` is shown below:

.. image:: robertson_reactions.png
   :align: center
   :alt: Reaction network for pysb.examples.robertson

Circular nodes (``r0``, ``r1`` and ``r2``) indicate reactions; square nodes
(``A()``, ``B()`` and ``C()``) indicate species. Incoming arrows from a species
node to a reaction node indicate that the species is a reactant; outgoing
arrows from a reaction node to a species node indicate that the species is a
product. A hollow diamond-tipped arrow from a species to a reaction indicates
that the species is involved as both a reactant and a product, i.e., it serves
as a "modifier" (enzyme or catalyst).

 __future__ print_function N/A pysb N/A pysb.bng N/A sympy N/A re N/A sys N/A os N/A pygraphviz run N/A N/A model N/A N/A N/A 
    Render the reactions produced by a model into the "dot" graph format.

    Parameters
    ----------
    model : pysb.core.Model
        The model to render.

    Returns
    -------
    string
        The dot format output.
     N/A N/A N/A N/A pysb bng generate_equations model N/A graph N/A N/A pygraphviz AGraph directed True rankdir LR N/A ic_species N/A cp N/A N/A cp parameter N/A model initial_conditions N/A N/A i cp N/A enumerate N/A model species N/A N/A species_node N/A s%d i N/A slabel N/A N/A re sub %  %\\l N/A str cp N/A slabel \l N/A color #ccffcc N/A N/A len N/A s N/A s ic_species N/A N/A s is_equivalent_to cp N/A N/A color #aaffff N/A N/A N/A graph add_node species_node label slabel shape Mrecord fillcolor color style filled color transparent fontsize 12 margin 0.06,0 N/A N/A i reaction N/A enumerate N/A model reactions_bidirectional N/A N/A reaction_node N/A r%d i N/A N/A N/A graph add_node reaction_node label reaction_node shape circle fillcolor lightgray style filled color transparent fontsize 12 width .3 height .3 margin 0.06,0 N/A reactants N/A set N/A reaction N/A reactants N/A products N/A set N/A reaction N/A products N/A modifiers N/A reactants products N/A reactants N/A reactants modifiers N/A products N/A products modifiers N/A attr_reversible N/A N/A reaction N/A reversible N/A dir arrowtail both empty N/A N/A s reactants N/A N/A N/A r_link graph s i attr_reversible N/A s products N/A N/A N/A r_link graph s i _flip True attr_reversible N/A s modifiers N/A N/A N/A r_link graph s i arrowhead odiamond N/A N/A N/A graph string N/A r_link N/A N/A graph s r N/A attrs N/A N/A nodes N/A N/A s%d s N/A r%d r N/A N/A N/A attrs get _flip N/A N/A N/A attrs N/A _flip N/A nodes N/A reversed nodes N/A N/A N/A attrs setdefault arrowhead normal N/A N/A N/A graph add_edge nodes attrs N/A N/A usage __doc__ N/A usage N/A usage N/A 1 N/A N/A __name__ __main__ N/A N/A N/A N/A len N/A sys argv 1 N/A N/A N/A print usage end N/A N/A exit N/A model_filename N/A N/A sys argv N/A 1 N/A N/A N/A N/A N/A os path exists model_filename N/A N/A N/A Exception N/A File '%s' doesn't exist model_filename N/A N/A N/A N/A re search \.py$ model_filename N/A N/A N/A Exception N/A File '%s' is not a .py file model_filename N/A N/A N/A N/A sys path insert 0 N/A N/A N/A os path dirname model_filename N/A model_name N/A N/A re sub \.py$ N/A N/A N/A os path basename model_filename N/A N/A N/A model_module N/A __import__ model_name N/A N/A N/A Exception N/A e N/A N/A N/A print Error in model script:
 N/A N/A N/A N/A model N/A N/A model_module __dict__ N/A model N/A N/A N/A KeyError N/A N/A N/A Exception N/A File '%s' isn't a model file model_filename N/A N/A print N/A run model