#NEWLINE# def run( model ) : #NEWLINE# #INDENT# '\n    Render the reactions produced by a model into the "dot" graph format.\n\n    Parameters\n    ----------\n    model : pysb.core.Model\n        The model to render.\n\n    Returns\n    -------\n    string\n        The dot format output.\n    ' #NEWLINE# pysb . bng . generate_equations ( model ) #NEWLINE# graph = pygraphviz . AGraph ( directed = True , rankdir = 'LR' ) #NEWLINE# ic_species = [ cp for ( cp , parameter ) in model . initial_conditions ] #NEWLINE# for ( i , cp ) in enumerate ( model . species ) : #NEWLINE# #INDENT# species_node = ( 's%d' % i ) #NEWLINE# slabel = re . sub ( '% ' , '%\\\\l' , str ( cp ) ) #NEWLINE# slabel += '\\l' #NEWLINE# color = '#ccffcc' #NEWLINE# if len ( [ s for s in ic_species if s . is_equivalent_to ( cp ) ] ) : #NEWLINE# #INDENT# color = '#aaffff' #NEWLINE# #UNINDENT# graph . add_node ( species_node , label = species_node , shape = 'Mrecord' , fillcolor = color , style = 'filled' , color = 'transparent' , fontsize = '12' , margin = '0.06,0' ) #NEWLINE# #UNINDENT# for ( i , reaction ) in enumerate ( model . reactions ) : #NEWLINE# #INDENT# reactants = set ( reaction [ 'reactants' ] ) #NEWLINE# products = set ( reaction [ 'products' ] ) #NEWLINE# attr_reversible = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# for s in reactants : #NEWLINE# #INDENT# for p in products : #NEWLINE# #INDENT# r_link ( graph , s , p , ** attr_reversible ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# return graph . string ( )