netplotlib API¶
Single Network¶
-
netplotlib.
Network
(model)¶ Creates a new Network object.
Parameters: model – SBML or Antimony string of a model An instance of Network object accepts following properties:
- scale: scaling factor for layout algorithm
- fontsize: fontsize for labels
- edgelw: linewidth of edges
- nodeColor: node color
- reactionNodeColor: reaction node color
- labelColor: label color
- labelReactionIds: boolean flag for labeling reaction ids
- reactionColor: edge color
- modifierColor: modifier edge color
- boundaryColor: boundary node color
- nodeEdgeColor: node edge color
- nodeEdgelw: linewidth of node edges
- highlight: list of species ids or reaction ids to highlight
- hlNodeColor: node color of highlighted nodes
- hlNodeEdgeColor: node edge color of highlighted nodes
- drawReactionNode: boolean flag for drawing reaction nodes
- breakBoundary: boolean flag for breaking all boundary species into separate nodes
- tightLayout: boolean flag for tighter node layout
- analyzeFlux: boolean flag for visualizing flux
- analyzeRates: boolean flag for visualizing species rate of changes
- analyzeColorHigh: color to use for higher values during analysis
- analyzeColorLow: color to use for lower values during analysis
- analyzeColorMap: colormap to use for analysis.
- analyzeColorScale: boolean flag for using colormaps. Setting this true ignore analyzeColorHigh and analyzeColorLow
- drawInlineTimeCourse: boolean flag for plotting inline time-cource simulation
- simTime: value for simulation duration
- forceAnalysisAtSimTime: boolean flag for running analysis at the end of simTime
- plotColorbar: boolean flag for visualizing color bar
- inlineTimeCourseSelections: list of species to plot for time-course simulation
- customAxis: use custom matplotlib.pyplot.axis object for the diagram
- layoutAlgorithm: specify layout algorithm
-
Network.
draw
(show=True, savePath=None, dpi=150)¶ Draw network diagram
Parameters: - show – flag to show the diagram
- savePath – path to save the diagram
- dpi – dpi settings for the diagram
-
Network.
getLayout
(returnState=False)¶ Return the layout of the model
Parameters: returnState – boolean flag for returning the networkx.Graph object Returns pos: Dictionary of all nodes and corresponding coordinates
-
Network.
reset
()¶ Resets all properties
-
Network.
savefig
(path, dpi=150)¶ Save network diagram to specified location
Parameters: - path – path to save the diagram
- dpi – dpi settings for the diagram
-
Network.
setLayout
(pos)¶ Set custom layout and bypass whe is generated by the layout algorothm
Parameters: pos – Dictionary of all nodes and corresponding coordinates
Network Ensemble¶
-
netplotlib.
NetworkEnsemble
(models)¶ Creates a new NetworkEnsemble object.
Parameters: models – list of SBML or Antimony strings of models An instance of NetworkEnsemble object accepts following properties:
- scale: scaling factor for layout algorithm
- fontsize: fontsize for labels
- edgelw: linewidth of edges
- nodeColor: node color
- reactionNodeColor: reaction node color
- labelColor: label color
- labelReactionIds: boolean flag for labeling reaction ids
- reactionColor: edge color
- modifierColor: modifier edge color
- boundaryColor: boundary node color
- nodeEdgeColor: node edge color
- nodeEdgelw: linewidth of node edges
- highlight: list of species ids or reaction ids to highlight
- hlNodeColor: node color of highlighted nodes
- hlNodeEdgeColor: node edge color of highlighted nodes
- edgeLabel: boolean flag for displaying edge weights
- edgeLabelFontSize: fontsize of edge weight labels
- drawReactionNode: flag for drawing reaction nodes
- breakBoundary: boolean flag for breaking all boundary species into separate nodes
- weights: list of custom weights to override
- edgeTransparency: boolean flag for changing the transparency of the edges accordin to edge weights
- plottingThreshold: value of threshold to prevent from displaying weighted edges
- removeBelowThreshold: boolean flag for preventing weighted edges below plottingThreshold from displaying
- analyzeFlux: boolean flag for visualizing flux
- customAxis: use custom matplotlib.pyplot.axis object for the diagram
- layoutAlgorithm: specify layout algorithm
-
Network.
drawWeightedDiagram
(show=True, savePath=None, dpi=150)¶ Draw weighted reaction network based on frequency of reactions
Parameters: - show – flag to show the diagram
- savePath – path to save the diagram
- dpi – dpi settings for the diagram
Returns allRxn: list of all reactions in the list of models presented as a pair of reactants and products
Returns count: normalized count of reactions in allRxn throughout the list of models
-
Network.
drawNetworkGrid
(nrows, ncols, auto=False, show=True, savePath=None, dpi=150)¶ Plot a grid of network diagrams
Parameters: - nrows – number of rows
- ncols – number of columns
- auto – Automatically configure nrows and ncols based on the number of models. Overrides nrows and ncols.
- show – flag to show the diagram
- savePath – path to save the diagram
- dpi – dpi settings for the diagram
-
Network.
getLayout
(returnState=False) Return the layout of the model
-
Network.
reset
() Resets all properties
-
Network.
savefig
(path, dpi=150) Save weighted network diagram to specified location
Parameters: - path – path to save the diagram
- dpi – dpi settings for the diagram
-
Network.
setLayout
(pos) Set custom layout and bypass whe is generated by the layout algorothm
Parameters: pos – Dictionary of all nodes and corresponding coordinates