trap_spaces

compute_circuits(primes: dict, max_output: int = 1000, fname_asp: Optional[str] = None, representation: str = 'dict')

Computes minimal trap spaces but also distinguishes between nodes that are fixed due to being part of a circuit and nodes that are fix due to percolation effects.

arguments:
  • primes: prime implicants

  • max_output: maximum number of returned solutions

  • fname_asp: file name or None

  • representation: either “str” or “dict”, the representation of the trap spaces

returns:
  • circuits: of tuples consisting of circuit nodes and percolation nodes

example:

>>> compute_circuits(primes)
[({'Mek': 0, 'Erk': 0},{'Raf': 1}),..]
compute_smallest_trapspace(primes: dict, state: dict, representation: str = 'dict')

Returns the (unique) smallest trap space that contains state. Calls trapspaces_that_contain_state

arguments:
  • primes: prime implicants

  • state: a state in dict format

  • representation: either “str” or “dict”, the representation of the trap spaces

returns:
  • trap_space: the unique minimal trap space that contains state

example:

>>> compute_smallest_trapspace(primes, {"v1":1,"v2":0,"v3":0})
compute_steady_states(primes: dict, max_output: int = 1000, fname_asp: Optional[str] = None, representation: str = 'dict') Union[List[dict], List[str]]

Returns steady states.

arguments:
  • primes: prime implicants

  • max_output: maximal number of trap spaces to return

  • fname_asp: file name or None

  • representation: either “str” or “dict”, the representation of the trap spaces

returns:
  • states: the steady states

example:

>>> steady = compute_steady_states(primes)
>>> len(steady)
2
compute_steady_states_projected(primes: dict, project: List[str] = [], max_output: int = 1000, fname_asp: Optional[str] = None)

Returns a list of projected steady states using the Potassco_ ASP solver [Gebser2011].

arguments:
  • primes: prime implicants

  • project: list of names

  • max_output: maximal number of trap spaces to return

  • fname_asp: file name or None

returns:
  • Activities: projected steady states

example:

>>> steady_states = compute_steady_states_projected(primes, ["v1","v2"])
>>> len(steady_states)
2
>>> compute_steady_states
[{"v1":1,"v2":0},{"v1":0,"v2":0}]
compute_trap_spaces(primes: dict, type_: str = 'min', max_output: int = 10000, fname_asp: Optional[str] = None, representation: str = 'dict') Union[List[dict], List[str]]

Returns a list of trap spaces using the Potassco ASP solver, see Gebser2011. For a formal introcution to trap spaces and the ASP encoding that is used for their computation see Klarner2015(a).

The parameter type_ must be one of “max”, “min”, “all” or “percolated” and specifies whether subset minimal, subset maximal, all trap spaces or all percolated trap spaces should be returned.

Warning

The number of trap spaces is easily exponential in the number of components. Use the safety parameter max_output to control the number of returned solutions.

To create the asp file for inspection or manual editing, pass a file name to fname_asp.

arguments:
  • primes: prime implicants

  • type_: either “max”, “min”, “all” or “percolated”

  • max_output: maximal number of trap spaces to return

  • fname_asp: name of asp file to create, or None

  • representation: either “str” or “dict”, the representation of the trap spaces

returns:
  • subspaces: the trap spaces

example:

>>> bnet = ["x, !x | y | z",
...         "y, !x&z | y&!z",
...         "z, x&y | z"]
>>> bnet = "\n".join(bnet)
>>> primes = bnet2primes(bnet)
>>> tspaces = compute_trap_spaces(primes, "all", representation="str")
---, --1, 1-1, -00, 101
compute_trap_spaces_bounded(primes: dict, type_: str, bounds: tuple, max_output: int = 1000, fname_asp: Optional[str] = None)

Returns a list of bounded trap spaces using the Potassco_ ASP solver [Gebser2011]. See trap_spaces for details of the parameters type_, max_output and fname_asp. The parameter bounds is used to restrict the set of trap spaces from which maximal, minimal or all solutions are drawn to those whose number of fixed variables are within the given range. Example: bounds=(5,8) instructs Potassco_ to consider only trap spaces with 5 to 8 fixed variables as feasible. type_ selects minimal, maximal or all trap spaces from the restricted set. .. warning:

The *Bound* constraint is applied *before* selecting minimal or maximal trap spaces.
A trap space may therefore be minimal w.r.t. to certain bounds but not minimal in the unbounded sense.

Use "n" as a shortcut for “all variables”, i.e., instead of len(primes). Example: Use bounds=("n","n") to compute steady states. Note that the parameter type_ becomes irrelevant for bounds=(x,y) with x=y.

arguments:
  • primes: prime implicants

  • type_ in ["max","min","all"]: subset minimal, subset maximal or all solutions

  • bounds: the upper and lower bound for the number of fixed variables

  • max_output: maximal number of trap spaces to return

  • fname_asp: file name or None

returns:
  • list of trap spaces

example::
>>> tspaces = compute_trap_spaces_bounded(primes, "min", (2,4))
>>> len(tspaces)
12
>>> tspaces[0]
{'TGFR':0,'FGFR':0}
compute_trapspaces_that_contain_state(primes: dict, state: dict, type_: str, fname_asp: Optional[str] = None, representation: str = 'dict', max_output: int = 1000)

Computes trap spaces that contain state.

arguments:
  • primes: prime implicants

  • state: a state in dict format

  • type_: either “min”, “max”, “all” or “percolated”

  • fname_asp: file name or None

  • representation: either “str” or “dict”, the representation of the trap spaces

  • max_output: maximum number of returned solutions

returns:
  • trap_spaces: the trap spaces that contain state

example:

>>> compute_trapspaces_that_contain_state(primes, {"v1":1,"v2":0,"v3":0})
compute_trapspaces_that_intersect_subspace(primes: dict, subspace: dict, type_: str, fname_asp: Optional[str] = None, representation: str = 'dict', max_output: int = 1000) List[dict]

Computes trap spaces that have non-empty intersection with subspace

arguments:
  • primes: prime implicants

  • subspace: a subspace in dict format

  • type_: either “min”, “max”, “all” or “percolated”

  • fname_asp: file name or None

  • representation: either “str” or “dict”, the representation of the trap spaces

  • max_output: maximum number of returned solutions

returns:
  • trap_spaces: the trap spaces that have non-empty intersection with subspace

example:

>>> compute_trapspaces_that_intersect_subspace(primes, {"v1":1,"v2":0,"v3":0})
compute_trapspaces_within_subspace(primes: dict, subspace: dict, type_: str, fname_asp: Optional[str] = None, representation: str = 'dict', max_output: int = 1000) Union[List[dict], List[str]]

Computes trap spaces contained within subspace

arguments:
  • primes: prime implicants

  • subspace: a subspace in dict format

  • type_: either “min”, “max”, “all” or “percolated”

  • fname_asp: file name or None

  • representation: either “str” or “dict”, the representation of the trap spaces

  • max_output: maximum number of returned solutions

returns:
  • trap_spaces: the trap spaces contained within subspace

example:

>>> trapspaces_in_subspace(primes, {"v1":1,"v2":0,"v3":0})
is_trap_space(primes: dict, subspace: Dict[str, int]) bool

Tests whether subspace is a trap space in primes.

arguments:
  • primes: prime implicants

  • subspace: a subspace

returns:
  • result: whether *subspace is a trap space

example:

>>> is_trap_space(primes=primes, subspace={'RAF':1, 'ERK':0, 'MEK':1})
True