{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "## Regulatory graph visualization with GINsim\n", "\n", "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.\n", "\n", "In this notebook, we show how to use the `ginsim` Python module to visualize a network model, with optionnaly a state." ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "import ginsim" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "First, we load a model from the GINsim repository:" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "data": { "text/markdown": [ "Downloading http://ginsim.org/sites/default/files/SuppMat_Model_Master_Model.zginml" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "lrg = ginsim.load(\"http://ginsim.org/sites/default/files/SuppMat_Model_Master_Model.zginml\")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The regulatory graph can be visualized using the `ginsim.show` function:" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "" ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "ginsim.show(lrg)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "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).\n", "This state can also come from the result of a model analysis, for instance, a fixpoint analysis.\n", "\n", "Let us use biolqm to compute the fixpoints of the model with bioLQM:" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [], "source": [ "import biolqm" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "First, we convert the model to bioLQM:" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [], "source": [ "lqm = ginsim.to_biolqm(lrg)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Then, we use `biolqm.fixpoints` to compute the list of all the fixpoints of the network, and store it in the `fps` variable:" ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "9 fixpoints\n" ] } ], "source": [ "fps = biolqm.fixpoints(lqm)\n", "print(len(fps), \"fixpoints\")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The third fixpoint (`fps[2]`) can then be displayed as follows:" ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "" ] }, "execution_count": 7, "metadata": {}, "output_type": "execute_result" } ], "source": [ "ginsim.show(lrg, fps[2])" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.7.7" } }, "nbformat": 4, "nbformat_minor": 2 }