Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
# -*- coding: utf-8 -*-
""" Convenince functions for representing reaction systems as graphs. """
nodeparams='[label={} shape=diamond]'): """ Returns list of lines of DOT (graph description language) formated graph.
Parameters ========== rsys: ReactionSystem substances: sequence of Substance instances tex: bool (default False) If set True, output will be LaTeX formated (Substance need to have tex_name attribute set) rprefix: string Reaction enumeration prefix, default: r rref0: integer Reaction enumeration inital counter value, default: 1 nodeparams: string DOT formated param list, default: [label={} shape=diamond]
Returns ======= list of lines of DOT representation of the graph representation.
"""
*((name, rid, snum) if reac else (rid, name, snum)) ))
continue continue
**kwargs): """ Convenience function to call `rsys2dot` and write output to file and render the graph
Parameters ---------- rsys: ReactionSystem substances: sequence of Substance instances outpath: path to graph to be rendered prog: command to render DOT file (default: dot) **kwargs: parameters to pass along to `rsys2dot`
Exapmles --------
>>> rsys2graph(rsys, sbstncs, '/tmp/out.png') # doctest: +SKIP """ else: fmtstr = "{}\n returned with exit status {}" raise RuntimeError(fmtstr.format(' '.join(cmds), retcode)) finally: pass else: else: # interpret save as path to copy pdf to. shutil.copy(outpath, save) |