pub struct BooleanNetwork {
    pub(crate) graph: RegulatoryGraph,
    pub(crate) parameters: Vec<Parameter>,
    pub(crate) update_functions: Vec<Option<FnUpdate>>,
    pub(crate) parameter_to_index: HashMap<String, ParameterId>,
}
Expand description

A Boolean network, possibly parametrised with uninterpreted Boolean functions.

The structure of the network is based on an underlying RegulatoryGraph. However, compared to a RegulatoryGraph, BooleanNetwork can have a specific update function given for each variable.

If the function is not specified (so called implicit parametrisation), all admissible Boolean functions are considered in its place. A function can be also only partially specified by using declared explicit parameters. These are uninterpreted but named Boolean functions, such that, again, all admissible instantiations of these functions are considered. See crate tutorial to learn more.

Boolean network equivalence

Please keep in mind that we consider two networks to be equivalent when they share a regulatory graph, and when they have (syntactically) the same update functions and parameters. We do not perform any semantic checks for whether the update functions are functionally equivalent.

Also keep in mind that the ordering of variables and parameters must be shared by equivalent networks. This is because we want to preserve the property that VariableId and ParameterId objects are interchangeable as log as networks are equivalent.

Fields

graph: RegulatoryGraphparameters: Vec<Parameter>update_functions: Vec<Option<FnUpdate>>parameter_to_index: HashMap<String, ParameterId>

Implementations

Legacy function for creating a fully instantiated BooleanNetwork using parameters.

In later revisions, this should be part of BddParameterEncoder.

Legacy function for creating a fully instantiated BooleanNetwork using parameters.

In later revisions, this should be part of BddParameterEncoder.

Try to read a BooleanNetwork from an SBML string.

Also reads Layout information from the file. If there is no layout, an empty map is returned.

The same as try_from_sbml, but provides access to all warnings generated during parsing.

These can be for example due to incompatibility in variable names (which the parser resolves automatically).

Convert this network to an SBML string with an optional Layout.

Write an SBML string representation (with an optional Layout) of this network to the given out writer.

Methods for parsing BooleanNetworks from string representation.

Add a new UpdateFunction to the BooleanNetwork. All variables and parameters must be already present in the network. Furthermore, all parameters must be used with their correct cardinality.

(internal) Utility method used in other parts of the parser.

(internal) Utility method to safely obtain variable for the update function with appropriate error message.

Basic methods for safely building BooleanNetworks.

Construct a new BooleanNetwork from a RegulatoryGraph without any parameters.

Add a new Parameter to the BooleanNetwork.

The parameter name must be different from other parameters and variables.

Add a new UpdateFunction to the BooleanNetwork.

The variable must not already have an update function. We assume all the variables and parameters in the function are used correctly. If you are not sure how to safely build an instance of a FnUpdate, look at the variants of this method which parse the function safely from a string.

Allows to directly replace (or remove) the update function.

The function will replace existing function (if any), but it still needs to satisfy the declared regulations.

(internal) Utility method to ensure that a parameter is also not a variable.

(internal) Utility method to ensure that a parameter is not a duplicate.

(internal) Utility method to ensure that an update function is not set yet.

(internal) Utility method to check that the arguments of a function are a subset of the actual regulators.

Some utility methods for accessing the structure of a BooleanNetwork. Some of them are just delegating to the internal RegulatoryGraph, but we have a copy here as well because they are used very often.

Obtain a reference to the underlying RegulatoryGraph of the BooleanNetwork.

Obtain a mutable reference to the underlying RegulatoryGraph.

However, note that at the moment, you can’t really do much with this reference, only add new regulations.

The number of variables in this BooleanNetwork.

The number of explicit parameters in this BooleanNetwork (there can be network variables using erased functions–implicit parameters–that are not counted here).

The number of variables with erased update functions in this BooleanNetwork.

Return an iterator over all variable ids of this network.

Return the variable object based on the given VariableId.

Shorthand for self.as_graph().get_variable(id).get_name().

Return a sorted list of variables that regulate the given target variable.

Return a sorted list of variables that are regulated by the given regulator variable.

Find a ParameterId corresponding to the given parameter name.

Get a Parameter corresponding to the given ParameterId.

Get a FnUpdate corresponding to the given VariableId.

Return an iterator over all parameter ids of this network.

Iterate over all variables of this network that do not have update functions assigned for them.

A static check that allows to verify validity of a parameter or variable name.

Infer a regulatory graph based on the update functions of this BooleanNetwork.

The resulting graph is solely based on the information that can be inferred from the update functions. In particular, if the BN contains uninterpreted functions, the monotonicity of variables appearing within these functions is unknown. Overall, this method is typically only useful for fully specified networks with minor errors in the regulatory graph.

The BN still has to satisfy basic integrity constraints. In particular, every uninterpreted function must be used, and must be used consistently (i.e. correct arity). Also, every update function may only used variables declared as regulators. Otherwise, an error is returned.

Try to load a Boolean network from a .bnet model.

Note that this is currently only a “best effort” implementation and you may encounter unsupported bnet models.

We also support some features that bnet does not, in particular, you can use Boolean constants. However, there are also other things that we do not support, since bnet can essentially use R syntax to define more complex functions, but in practice this is not used anywhere as far as I know.

Produce a .bnet string representation of this model.

Returns an error if the network is parametrised and thus cannot be converted to .bnet. Also returns an error if the network contains names which are not supported in .bnet, such as starting with numbers.

However, you can override this behaviour using rename_if_necessary. If this flag is set, all invalid names will be prefixed with _.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Formats the value using the given formatter. Read more

Allow indexing BooleanNetwork using ParameterId objects.

The returned type after indexing.

Performs the indexing (container[index]) operation. Read more

Allow indexing BooleanNetwork using VariableId objects.

The returned type after indexing.

Performs the indexing (container[index]) operation. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

The type returned in the event of a conversion error.

Performs the conversion.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.