BNMPy.BMatrix

Resources for loading boolean networks from files (strings)

BNMPy.BMatrix.get_upstream_genes(equations)[source]

Returns a string of gene names, space-separated, for each of the equations.

BNMPy.BMatrix.load_network_from_file(filename, initial_state=None)[source]

Given a file representing a boolean network, this generates a BooleanNetwork object.

Formatting:

gene = equation
  • all genes must have their own equation in a line (sometimes the equation is just A = A)

  • each equation must have an equal sign and a space before and after it

  • If the equation is a constant value (0 or 1), meaning that the gene is set as mutated/perturbed

BNMPy.BMatrix.load_network_from_string(network_string, initial_state=None)[source]

Given a string representing a boolean network, this generates a BooleanNetwork object.

Formatting:

  • all genes must have their own equation (sometimes the equation is just A = A)

  • each equation must have an equal sign and a space before and after it

  • If the equation is a constant value (0 or 1), meaning that the gene is set as mutated/perturbed

BNMPy.BMatrix.load_pbn_from_file(filename, initial_state=None)[source]

Given a file representing a probabilistic boolean network, this generates a ProbabilisticBN object.

File format example:

x1 = (x1 | x2 | x3) & (!x1 | x2 | x3), 0.6
x1 = (x1 | x2 | x3) & (x1 | !x2 | !x3) & (!x1 | x2 | x3), 0.4
x2 = (x1 | x2 | x3) & (x1 | !x2 | !x3) & (!x1 | !x2 | x3)
x3 = (!x1 & x2 & x3) | (x1 & !x2 & x3) | (x1 & x2 & !x3) | (x1 & x2 & x3), 0.5
x3 = (x1 & x2 & x3), 0.5

Each line has format: node = boolean_function, probability The probability part can be omitted if there is only one function for that gene. The boolean_function can also be a constant value (0 or 1), meaning that the gene is set as mutated/perturbed

BNMPy.BMatrix.load_pbn_from_string(network_string, initial_state=None)[source]

Given a string representing a probabilistic boolean network, this generates a ProbabilisticBN object.

String format should match the file format expected by load_pbn_from_file.

BNMPy.BMatrix.rename_nodes(network, mapping, expand_complexes=False)[source]

Rename nodes in a boolean network based on a mapping.