biocrnpyler.utils.plotting
Functions
|
Generates a networkx DiGraph object that represents the CRN. |
|
Given a directed graph, plot it. |
|
Draw an arrow shape at the end of graph lines. |
|
Wrapper around CRNPlotter to make color coordinated constructs. |
|
|
|
|
|
Classes
|
- biocrnpyler.utils.plotting.generate_networkx_graph(CRN, useweights=False, use_pretty_print=False, pp_show_material=True, pp_show_rates=True, pp_show_attributes=True, pp_show_compartment=True, colordict=None, reactioncolordict=None, imagedict=None)[source]
Generates a networkx DiGraph object that represents the CRN.
- Parameters:
- CRNChemicalReactionNetwork
A CRN from mixture.get_model() for example.
- useweightsbool
This will attempt to represent the reaction rates by the length of edges. Short edges are fast rates. It doesn’t look very good usually.
- use_pretty_printbool
This uses the “pretty print” function to represent reactions and nodes a bit cleaner.
- pp_show_materialbool
Default false because this is listed in “type”.
- pp_show_ratesbool
Default true because this is useful information.
- pp_show_attributesbool
- colordictdict
A dictionary containing which node types are what color based upon the following keywords:
- Keywords are chosen to match species.material_type
{“complex”: “cyan”, “protein”: “green”, “dna”: “grey”, “rna”: “orange”, “ligand”: “pink”, “phosphate”: “yellow”, “nothing”:”purple”}
When using a custom colordict, the following attributes will be checked to find colors with the first keys taking precedence:
repr(species): “color” species.name: “color” (species.material_type, tuple(species.attributes)): “color” species.material_type: “color” tuple(species.attributes): “color”
- imagedictdict
A dictionary which contains species and their corresponding image representations. This is the output generated by CRNPlotter.renderMixture().
- Returns:
- CRNgraphDiGraph
The DiGraph object containing all nodes and edges.
- CRNspeciesonlyDiGraph
A DiGraph object with only species.
- CRNreactionsonlyDiGraph
A DiGraph object with only reactions.
- biocrnpyler.utils.plotting.graphPlot(DG, DGspecies, DGreactions, plot, layout='force', positions=None, plot_species=True, plot_reactions=True, plot_edges=True, plot_arrows=True, species_glyph_size=12, reaction_glyph_size=8, posscale=1.0, layoutfunc=None, iterations=2000, rseed=30, show_species_images=False)[source]
Given a directed graph, plot it.
- Parameters:
- DGDiGraph
A directed graph of type DiGraph.
- DGspeciesDiGraph
A directed graph which only contains the species nodes.
- DGreactionsDiGraph
A directed graph which only contains the reaction nodes.
- plotbokeh plot object
A bokeh plot object.
- layoutstr
Graph layout function. ‘force’ uses fa2 to push nodes apart. ‘circle’ plots the nodes and reactions in two overlapping circles, with the reactions on the inside of the circle. ‘custom’ allows user input ‘layoutfunc’. Internally, ‘layoutfunc’ is passed the three inputs (DG, DGspecies, DGreactions) and should output a position dictionary with node {<node number>:(x,y)}.
- positionsdict
A dictionary of node names and x,y positions. This gets passed into the layout function.
- posscalefloat
Multiply the scaling of the plot. This only affects the arrows because the arrows are a hack :(.