phenotypes

compute_phenotype_diagram(phenotypes: dict, fname_json: Optional[str] = None, fname_image: Optional[str] = None)

Computes the phenotype diagram from the phenotypes object obtained from phenotypes_compute_json. save the diagram as json data with fname_json. useful for e.g. manually renaming nodes.

arguments:
  • phenotypes: result of compute_json(..)

  • fname_json: save diagram as json

  • fname_image: generate image for diagram

returns::
  • diagram: the phenotype diagram

example:

>>> phenos = compute_phenotypes(attrobj, markers)
>>> compute_phenotype_diagram(phenos, fname_image="phenos.pdf")
created phenos.pdf
compute_phenotypes(attractors: dict, markers: List[str], fname_json: Optional[str] = None) dict

Computes the phenotypes object for given markers.

structure:

primes: dict update: str markers: tuple phenotypes: (tuple)

name: str pattern: str activated_markers: list of markers inhibited_markers: list of markers stateformula: disjunction over all state props

states: (tuple)

str: state string dict: state dict prop: state proposition is_steady: bool is_cyclic: bool

mintrapspace:

str: subspace string dict: subspace dict prop: subspace proposition

arguments:
  • attractors: json attractor data, see attractors_compute_json

  • markers: list of names

  • fname_json: save phenotypes as json

returns::
  • phenotypes: the phenotypes data

example:

>>> attractors = compute_attractors(primes, update, "attractors.json")
>>> markers = ["raf", "mek"]
>>> compute_phenotypes(attractors, markers, "phenotypes.json")
create_phenotypes_piechart(diagram: DiGraph, fname_image: str, title: Optional[str] = None, color_map: Optional[dict] = None)

creates the abstract commitment pie.

arguments:
  • diagram: a phenotype diagram

  • fname_image: name of the output image

  • title: optional title of plot

  • color_map: assignment of diagram nodes to colors for custom colors

example:

>>> attractors = compute_attractors(primes, update)
>>> phenos = compute_phenotypes(attractors, markers)
>>> diagram = compute_phenotype_diagram(phenos)
>>> create_phenotypes_piechart(diagram, "piechart.pdf")
open_phenotype_diagram(fname_json: str) DiGraph

Opens a phenotype diagram.

arguments:
  • fname_json: json file name

returns:
  • phenotype_diagram: the phenotype diagram

example:

>>> open_phenotype_diagram("diagram.json")
phenotype_diagram2image(diagram: DiGraph, fname_image: Optional[str] = None)

Creates an image of the abstract commitment diagram.

arguments:
  • diagram: a phenotype diagram

  • fname_image: name of the diagram image

returns::
  • styled_diagram: the styled abstract commitment diagram

example:

>>> phenotype_diagram2image(primes, diagram, "diagram.pdf")
save_phenotype_diagram(diagram: DiGraph, fname_json: str)

Save the diagram as a json file.

arguments:
  • diagram: prime implicants

  • fname_json: json file name

example:

>>> save_phenotype_diagram(diagram, "diagram.json")