jcrozum / biobalm

The biologist's Boolean attractor landscape mapper, building Waddington landscapes from Boolean networks.
https://jcrozum.github.io/biobalm/
MIT License
2 stars 0 forks source link

User friendliness improvements #81

Closed jcrozum closed 11 months ago

jcrozum commented 12 months ago

A few ideas for how to improve UX:

  1. There should be a function (or several) that summarize the SuccessionDiagram object. We want to know a. size and depth b. a list of attractor seed states and the trap spaces they are in (if not fixed points), as well as which (if any) are motif-avoidant c. whether the SD is complete or, e.g., just an SCC expansion or hasn't been checked for faithfulness/univocality
  2. It should be possible to have a workflow that just uses this library. Currently, it looks like we need to import biodivine_aeon to import rules.
  3. A subspace class would be really nice, especially since we can implement a hasher for it by sorting the dictionary items by their keys.
  4. We should write some basic usage examples and install instructions.
jcrozum commented 11 months ago

I'm working on this in the usability-improvements branch.

jcrozum commented 11 months ago

I have implemented a summary function that reports the size and the info in 1b. I also added some import functions that wrap biodivine_aeon imports. I also incorporated the SCC expansion into the SuccessionDiagram class.

jcrozum commented 11 months ago

I have added pickle support to the SuccessionDiagram class, and I have added the succession diagram depth to the summary function.

jcrozum commented 11 months ago

Note: I have renamed SuccessionDiagram.G to SuccessionDiagram.dag to conform to PEP standards (well, okay, it's mostly to get my linter to shut up about modifying "constants" that aren't really constant). In making this change, I realized that we still have some code that touches internals of the SuccessionDiagram class that should probably only be accessed indirectly. Not a big deal, but if we do a code cleanup before full release, we might want to look into these cases.

jcrozum commented 11 months ago

I have partly addressed point 3, but instead of a class, I went with a type alias. I considered implementing a separate class, but I realized that we use these dictionaries all over the place, and I was concerned about the performance hit of wrapping the dictionary. The type alias now enforces that spaces are represented as balm.typing.space_type = dict[str, Literal[0,1]] (previously it was dict[str, int]. Note that pyeda has a Literal class that clashes with the Python's typing.Literal (this is in the standard library). I have therefore imported the pyeda version as PyedaLiteral when we need it. In the code, at least as far as type hints are concerned, Boolean states are just a special case of Boolean spaces that have only one element.

Edit: I have changed the type alias names to be more conventional; the space type is now balm.typing.BooleanSpace