booldog.io.bnet

Additional functions to parse bnet format

Attributes

logger

BNET_LINE_REGEX

BNET_REGULATORS_REGEX

BNET_HEADER

Classes

BnetParser

Functions

read_bnet(bnet[, node_names])

Generate a BoolDogModel object from a Boolean network in boolnet

write_bnet(model[, outfile, from_primes, header, minimize])

Write a BoolDogModel object to a Boolean network in boolnet (bnet) format.

Module Contents

booldog.io.bnet.logger
booldog.io.bnet.BNET_LINE_REGEX = '^[a-zA-Z]+[a-zA-Z0-9_]*,\\s*.+$'
booldog.io.bnet.BNET_REGULATORS_REGEX = '\\b[A-Za-z_][A-Za-z0-9_]*\\b'
booldog.io.bnet.BNET_HEADER = 'targets, factors'
class booldog.io.bnet.BnetParser(bnet)
bnet
rules
_get_rules(bnet_str)

Boolean rules per node.

booldog.io.bnet.read_bnet(bnet, node_names=None)

Generate a BoolDogModel object from a Boolean network in boolnet (bnet) format.

For complete documentation, see file_exchange.

Parameters:

file (str) – Path to the bnet file

Returns:

rn – An object of type py:class:BoolDogModel.

Return type:

BoolDog

Notes

The format of the output file is described at boolnet_format.

booldog.io.bnet.write_bnet(model, outfile=None, from_primes=False, header=True, minimize=False)

Write a BoolDogModel object to a Boolean network in boolnet (bnet) format.

Parameters:
  • model (BoolDogModel) – A BoolDog object representing a Boolean network.

  • outfile (str) – Path to the output file. If None, the output is returned as a string.

  • from_primes (bool, default False) – If True, rules are obtained by converting prime implicants to bnet format. Otherwise, node rules are written directly.

  • header (bool, default True) – If True, include a header line (“target, factors”).

  • minimize (bool, default False) – If True, minimize rules when converting from primes. Only relevant if from_primes is True.

Returns:

Returns the bnet string if outfile is None, otherwise None.

Return type:

str or None

Notes

The output file will be overwritten if it already exists.

The format of the output file is described at boolnet_format.