sybila / biodivine-lib-param-bn

Rust library for working with parametrised Boolean networks.
MIT License
2 stars 3 forks source link

Redesign `BooleanNetwork`/`RegulatoryGraph` API with better integrity checks #21

Open daemontus opened 3 years ago

daemontus commented 3 years ago

Public methods for manipulation of Boolean networks were originally designed just for the .aeon format parser. As such, they are missing some safety checks (like verifying that an update function actually uses parameters which are present in the network).

At least, we should fix those safety issues (every change to the network should probably trigger some kind of full consistency check). Additionally, it would be good to design the API so that a BN can be modified more easily. For example, getting a mutable reference of the inner regulatory graph would help a lot (since then we can add regulations even after a BN is constructed from the graph).

daemontus commented 2 years ago

This is a much bigger issue than it may initially seem. The problem is largely a bad design in the original API, where a lot of operations that can fail have no way to return an error. So the only option at the moment is to panic. Also, a lot of checks which are performed by the parser should in fact be performed by BooleanNetwork and RegulatoryGraph instead, otherwise one can easily create a malformed network using our current API.

An (incomplete) list of problems that need to be addressed: