jcrozum / pystablemotifs

Python library for attractor identification and control in Boolean networks
MIT License
28 stars 7 forks source link

Setting initial values #70

Closed alekhyaa2 closed 2 years ago

alekhyaa2 commented 2 years ago

Hello,

I want to set the initial conditions for few of the nodes in my model. Some of which already have a boolean function defined. So, when I am trying to load the rules with initial values and boolean functions for all the nodes simultaneously, the error it gives is

b'' b'BNetToPrime encountered an exception and aborted.\r\nException message: "ins-18 already has a function."\r\n'

How can I set the initial values in this case?

Thank you!

jcrozum commented 2 years ago

The short answer is that you can't really specify initial conditions in this way because many of our algorithms are designed to be independent of initial conditions. The long answer depends on what you want to compute . . .

If you are just interested in simulating trajectories from specific initial conditions, then you don't actually need pystablemotifs for this. Take a look at the state_transition_graphs module in pyboolnet (which is a dependency of pystablemotifs) instead. Specifically, the primes2stg function in that module will construct a full or partial STG; it reads in initial conditions as a dictionary. If this is too slow or too memory-intensive for your application, then the successors_asynchronous and successors_synchronous functions in that module might be more useful.

If you are interested in questions of reachability and attractor basins, please see the basins_of_attraction module in pyboolnet. The succession diagram (AttractorRepertoire.succession_diagram) also contains information about how trap spaces are nested. This is more efficient than simulation-based methods, but only gives necessary (not sufficient) conditions for attractor reachability. (See fig. 3 in the paper describing our attractor identification method for how to interpret this digraph.)

If you are interested in network control, then the control interventions returned by the attractor control methods of pystablemotifs are valid for any initial condition. See the Control Tutorial for details.

I am happy to elaborate on any of these methods if you have questions. If none of these approaches seem relevant to you, then perhaps I could suggest alternatives if you could describe your investigative goals in a bit more detail.

alekhyaa2 commented 2 years ago

This is very helpful and thank you for suggesting these approaches. I will look into them and try to figure out which works best in my case.

I am mainly interested in identifying stable motifs and attractors in my system. My model is still evolving and I will reach out if I still need any help further.