Welcome to mpbn’s documentation!

This module provides a simple implementation of Most Permissive Boolean Networks (MPBNs) for computing reachability properties, attractors, reachable attractors. Attractors of MPBNs are the minimal trap spaces of the underlying Boolean maps. See http://dx.doi.org/10.1101/2020.03.22.998377 and https://arxiv.org/abs/1808.10240 for technical details.

It relies on clingo Answer-Set Programming solver (https://github.com/potassco/clingo).

Examples are available at https://nbviewer.jupyter.org/github/pauleve/mpbn/tree/master/examples/

Quick example:

>>> mbn = mpbn.MPBooleanNetwork({
        "a": "!b",
        "b": "!a",
        "c": "!a & b"})
>>> list(mbn.attractors()) # minimal trap spaces
[{'a': 0, 'b': 1, 'c': 1}, {'a': 1, 'b': 0, 'c': 0}]
>>> mbn.reachability({'a': 0, 'b': 1, 'c': 1}, {'a': 1, 'b': 0, 'c': 0})
False
>>> mbn.reachability({'a': 0, 'b': 0, 'c': 0}, {'a': 1, 'b': 1, 'c': 1})
True
>>> list(mbn.attractors(reachable_from={'a': 0, 'b': 1, 'c': 0}))
[{'a': 0, 'b': 1, 'c': 1}]
mpbn.load(filename, **opts)[source]

Create a MPBooleanNetwork object from filename in BoolNet format; filename can be a local file or an URL.

class mpbn.MPBooleanNetwork(bn={}, auto_dnf=True, simplify=False, try_unate_hard=False, encoding='mixed-dnf-bdd')[source]

Most Permissive Boolean Network

Extends colomoto.minibn.BooleanNetwork class by adding methods for computing reachable and attractor properties with the Most Permissive update mode.

Constructor for MPBoooleanNetwork.

Parameters:
  • bn (colomoto.minibn.BooleanNetwork or any type accepted by colomoto.minibn.BooleanNetwork constructor) – Boolean network to copy from
  • auto_dnf (bool) – if False, turns off automatic DNF transformation of local functions

Examples:

>>> mbn = MPBooleanNetwork("network.bnet")
>>> bn = BooleanNetwork()
>>> bn["a"] = ".."; ...
>>> mbn = MPBooleanNetwork(bn)
attractors(reachable_from=None, constraints={}, limit=0, star='*')[source]

Iterator over attractors of the MPBN (minimal trap spaces of the BN). An attractor is an hypercube, represented by a dictionnary mapping every component of the network to either 0, 1, or star.

Parameters:
  • reachable_from (dict[str,int]) – restrict to the attractors reachable from the given configuration. Whenever partial, restrict attractors to the one reachable by at least one matching configuration.
  • constraints (dict[str,int]) – consider only attractors matching with the given constraints.
  • limit (int) – maximum number of solutions, 0 for unlimited.
  • star (str) – value to use for components which are free in the attractor
dynamics(update_mode='mp', **kwargs)[source]

Returns a networkx.DiGraph object representing the transitions between the configurations using the Most Permissive update mode by default. See colomoto.minibn.BooleanNetwork.dynamics().

fixedpoints(reachable_from=None, constraints={}, limit=0)[source]

Iterator over fixed points of the MPBN (i.e., of f)

Parameters:
  • reachable_from (dict[str,int]) – restrict to the attractors reachable from the given configuration. Whenever partial, restrict attractors to the one reachable by at least one matching configuration.
  • constraints (dict[str,int]) – consider only attractors matching with the given constraints.
  • limit (int) – maximum number of solutions, 0 for unlimited.
minimal_trapspaces(reachable_from=None, constraints={}, limit=0, star='*')

Iterator over attractors of the MPBN (minimal trap spaces of the BN). An attractor is an hypercube, represented by a dictionnary mapping every component of the network to either 0, 1, or star.

Parameters:
  • reachable_from (dict[str,int]) – restrict to the attractors reachable from the given configuration. Whenever partial, restrict attractors to the one reachable by at least one matching configuration.
  • constraints (dict[str,int]) – consider only attractors matching with the given constraints.
  • limit (int) – maximum number of solutions, 0 for unlimited.
  • star (str) – value to use for components which are free in the attractor
reachability(x, y)[source]

Returns True whenever the configuration y is reachable from x with the Most Permissive update mode. Configurations can be partially defined. In that case, returns True whenever there exists a configuration matching with y which is reachable with at least one configuration matching with x

Parameters:
  • x (dict[str,int]) – initial configuration
  • y (dict[str,int]) – target configuration
reachable_from(x, reversed=False)[source]

Returns an iterator over the configurations reachable from x with the Most Permissive update mode. Configuration x can be partially defined: in that case a configuration is yielded whnever it is reachable from at least one configuration matching with x.

Whenever reversed is True, yields over the configurations that can reach x instead.

class mpbn.MostPermissiveDynamics(model, **opts)[source]

Indices and tables