API Reference

Version License Documentation

This page contains the API reference for the BooLEVARD package. Boolevard can be imported as follows:

import boolevard as blv

Loading an object of BooLEV class

BooLEVARD uses objects of BooLEV class, generated from Boolean models in .bnet format. A BooLEV object is generated using the Load function:

boolevard.core.Load(file_path: str, update: str = 'most_permissive')

Loads a model in b.net format and returns a BooLEV-class object.

This function loads a Boolean model from a .bnet file and returns a BooLEV object containing the model’s structure and associated data.

Parameters:

file_pathstr

Path to the .bnet file.

updatestr

Update method for the model. Options are “most_permissive”, “synchronous”, or “asynchronous”. By default, “most_permissive”.

Returns:

BooLEV: object

A BooLEV object containing the model with the following attributes:

  • Nodes (list): List containing the nodes of the model.

  • DNFs (dict): Dictionary with the canonical Disjunctive Normal Form (cDNF) of each node.

  • NDNFs (dict): Dictionary with the cDNF of the negated rule of each node.

  • SS (pd.DataFrame): DataFrame containing the stable states.

  • Info (pd.DataFrame): DataFrame containing the stable states, cDNFs, and cNDNFs.

Example:

>>> model = blv.Load("model.bnet")

Using BooLEV objects

BooLEVARD’s main feature is to count the number of paths leading to the activation or inactivation of a given node within a given stable state or across the stable states reached by a Boolean model stored in an object of BooLEV class. This can be achieved by calling CountPaths, one of the methods integrated in BooLEV objects, which together with Drivers and Pert methods, will be introduced in the following sections.

BooLEV.CountPaths(tNodes: list, ss_wise=False)

Calculates the signed path count leading to the local state of a node contained in a list. Positive if the local state is 1 and negative if 0.

Parameters:

tNodes: list

List of target nodes to evaluate.

ss_wise: bool

If True, returns a list with the corresponding path counts leading to a target’s local state for each stable state. Otherwise, it computes the average path count across all stable states contained in the Info attribute of the BooLEV object. By default: False.

Returns:

list

Signed number of paths leading to the local states of the target nodes. Negative if the local state is 0, positive if 1.

Example:

>>> model = blv.Load("model.bnet")
>>> model.CountPaths(["Node1", "Node2"], ss_wise = False)

The disjunctive normal function (cDNF) of a Boolean expression can be seen as the expression of the potential paths a node has get activated (cDNF) or inactivated (cNDNF). This is stable-state-specific and can be computed using the Drivers method.

BooLEV.Drivers(ss: int)

Extracts drivers from (N)DNFs based on the local state of the node within a given stable state.

Parameters:

ss: int

Stable State to evaluate.

Returns:

dict

Dictionary containing de drivers of each node within the stable state.

Example:

>>> model = blv.Load("model.bnet")
>>> model.Drivers(1) # Compute the drivers for each node within the stable state number 1

BooLEVARD also allows to perform node perturbations, in which node inhibitions or activations are simulated. Simulations can be either additive or non-additive. In additive perturbations, the regulatory effects of the perturbation are incorporated to the target’s Boolean equation. In non-additive perturbations, these regulatory effects substitute the Boolean equation of the target node. Perturbations must be writen with the following structure (case sensitive): "Node%INH" (inhibitions), "Node%ACT" (activations).

BooLEV.Pert(perturbation: str, additive=True)

Perturbs the model by creating a perturbation node that targets a specific node in the model, simulating a positive (ACT) or negative (INH) effect in the target.

Parameters:

tNodes: list

List of target nodes to evaluate.

perturbation: str

String containing the target node and the perturbation type separated by a percentage symbol. E.g. "Node%ACT", "Node%INH".

additive: bool

If True, the perturbation is additive (i.e. the regulation is incorporated to the target node’s rule). Otherwise, the perturbation is substitutive (i.e. the regulation replaces the target node’s rule). By default: True.

Returns:

BooLEV object

Model (BooLEV object) updated with the perturbation.

Example:

>>> model = blv.Load("model.bnet")
>>> model.Pert("Node%ACT", additive = True)
>>> model.Pert("Node%INH", additive = False)

Exporting BooLEV objects

BooLEV objects can be exported back to Boolean models calling the Export method.

BooLEV.Export(file_path: str)

Exports the model in .bnet format.

Parameters

file_path: str

Path to export the model.

Returns:

BooLEV: object

The BooLEV object.

Example:

>>> model = blv.Load("model.bnet")
>>> model.Export("model.bnet")