#!/usr/bin/env python # coding: utf-8 # ## Regulatory graph visualization with GINsim # # GINsim models in GINML format contains layout information for displaying the regulatory graph of a Boolean or multi-valued network. The regulatory graph shows the activation and inhibition relations between the nodes of the network. # # In this notebook, we show how to use the `ginsim` Python module to visualize a network model, with optionnaly a state. # In[1]: import ginsim # First, we load a model from the GINsim repository: # In[2]: lrg = ginsim.load("http://ginsim.org/sites/default/files/SuppMat_Model_Master_Model.zginml") # The regulatory graph can be visualized using the `ginsim.show` function: # In[3]: ginsim.show(lrg) # The `show` function also allows an additional parameters which specifies for each node a state value (0 or 1 in case of a Boolean node). # This state can also come from the result of a model analysis, for instance, a fixpoint analysis. # # Let us use biolqm to compute the fixpoints of the model with bioLQM: # In[4]: import biolqm # First, we convert the model to bioLQM: # In[5]: lqm = ginsim.to_biolqm(lrg) # Then, we use `biolqm.fixpoints` to compute the list of all the fixpoints of the network, and store it in the `fps` variable: # In[6]: fps = biolqm.fixpoints(lqm) print(len(fps), "fixpoints") # The third fixpoint (`fps[2]`) can then be displayed as follows: # In[7]: ginsim.show(lrg, fps[2]) # In[ ]: