Welcome to mpbn’s documentation!¶
This module provides a simple implementation of Most Permissive Boolean Networks (MPBNs) for computing reachability properties, attractors, and reachable attractors in locallymonotonic Boolean networks. 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 AnswerSet 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())
[{'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 fromfilename
in BoolNet format;filename
can be a local file or an URL.

class
mpbn.
MPBooleanNetwork
(bn={}, auto_dnf=True)[source]¶ Most Permissive Boolean Network
Extends
colomoto.minibn.BooleanNetwork
class by adding methods for computing reachable and attractor properties with the Most Permissive semantics. It requires that the Boolean network is locally monotonic.Ensures that the Boolean functions are monotonic and in disjunctive normal form (DNF). The localmonotonic checking requires that a literal never appears with both signs in a same Boolean function.
Constructor for
MPBoooleanNetwork
.Parameters:  bn (
colomoto.minibn.BooleanNetwork
or any type accepted bycolomoto.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. An attractor is an hypercube, represented by a dictionnary mapping every component of the network to either
0
,1
, orstar
.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 semantics by default. Seecolomoto.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.

reachability
(x, y)[source]¶ Returns
True
whenever the configuration y is reachable from x with the Most Permissive semantics. Configurations can be partially defined. In that case, returnsTrue
whenever there exists a configuration matching with y which is reachable with at least one configuration matching with xParameters:  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 semantics. Configurationx
can be partially defined: in that case a configuration is yielded whnever it is reachable from at least one configuration matching withx
.Whenever
reversed
isTrue
, yields over the configurations that can reach x instead.
 bn (