commitment_diagrams¶
- commitment_diagram2image(diagram: DiGraph, fname_image: str, style_inputs: bool = True, style_edges: bool = False, style_ranks: bool = True, first_index: int = 1) DiGraph ¶
Creates the image file fname_image for the basin diagram given by diagram. The flag StyleInputs can be used to highlight which basins belong to which input combination. style_edges adds edge labels that indicate the size of the “border” (if compute_border was enabled in commitment_compute_diagram) and the size of the states of the source basin that can reach the target basin.
- arguments:
diagram: a commitment diagram
fname_image: file name of image
style_inputs: whether basins should be grouped by input combinations
style_edges: whether edges should be size of border / reachable states
style_ranks: style that places nodes with the same number of reachable attractors on the same rank (level)
first_index: first index of attractor names
- returns::
styled_diagram: the styled commitment diagram
example:
>>> attractors = compute_attractors(primes, update) >>> compute_phenotype_diagram(attractors) >>> commitment_diagram2image(diagram, "diagram.pdf")
- commitment_diagrams_are_equivalent(this: DiGraph, other: DiGraph) bool ¶
Checks whether diagrams this and other are equivalent.
- compute_commitment_diagram(attractors: dict, fname_image: Optional[str] = None, fname_json=None, edge_data=False) DiGraph ¶
Computes the commitment diagram for the AttrJson and STG defined in attractors, a json object computed by AttrJson_compute_json The nodes of the diagram represent states that can reach the exact same subset of attractors. Edges indicate the existence of a transition between two nodes in the respective commitment sets. Edges are labeled by the number of states of the source set that can reach the target set and, if EdgeData is true, additionally by the size of the border.
- arguments:
attractors: json attractor data, see compute_attractors
fname_image: generate image for diagram
fname_json: save diagram as json
edge_data: toggles computation of additional edge data
- returns::
diagram: the commitment diagram
example:
>>> attractors = compute_attractors(primes, update) >>> diagram = compute_phenotype_diagram(attractors)
- create_commitment_piechart(diagram: DiGraph, fname_image: str, color_map: Optional[dict] = None, title: Optional[str] = None)¶
Creates the commitment pie chart for the commitment diagram using matplotlib. The pieces of the chart represent states that can reach the exact same subset of Attractors.
- arguments:
diagram: commitment diagram, see commitment_compute_diagram
fname_image: name of the output image
color_map: assignment of diagram nodes to colors for custom colors
title: optional title of plot
example:
>>> primes = get_primes("xiao_wnt5a") >>> attractors = compute_attractors(primes, update) >>> diagram = compute_commitment_diagram(attractors) >>> create_commitment_piechart(diagram, "commitment_piechart.pdf")
- open_commitment_diagram(fname_json: str) DiGraph ¶
Opens a commitment diagram json file. See also commitment_compute_diagram, commitment_save_diagram.
- arguments:
fname_json: a json file name
- returns:
diagram: the commitment diagram
example:
>>> diagram = open_commitment_diagram("commitment_diagram.json")
- save_commitment_diagram(diagram: DiGraph, fname_json: str)¶
Saves a commitment diagram as a json file.
- arguments:
diagram: a commitment diagram
fname_json: json file name
example:
>>> save_commitment_diagram(diagram, "commitment_diagram.json")