biomass / data /docs /tutorial /dynamic_nfkb_graph.html
introvoyz041's picture
Migrated from GitHub
2b677b0 verified
<html>
<head>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/vis-network@latest/styles/vis-network.css" type="text/css" />
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/vis-network@latest/dist/vis-network.min.js"> </script>
<center>
<h1></h1>
</center>
<!-- <link rel="stylesheet" href="../node_modules/vis/dist/vis.min.css" type="text/css" />
<script type="text/javascript" src="../node_modules/vis/dist/vis.js"> </script>-->
<style type="text/css">
#mynetwork {
width: 500px;
height: 500px;
background-color: #ffffff;
border: 1px solid lightgray;
position: relative;
float: left;
}
#config {
float: left;
width: 400px;
height: 600px;
}
</style>
</head>
<body>
<div id = "mynetwork"></div>
<div id = "config"></div>
<script type="text/javascript">
// initialize global variables.
var edges;
var nodes;
var network;
var container;
var options, data;
// This method is responsible for drawing the graph, returns the drawn network
function drawGraph() {
var container = document.getElementById('mynetwork');
// parsing and collecting nodes and edges from the python
nodes = new vis.DataSet([{"id": "TNF", "label": "TNF", "shape": "dot", "title": " Neighbors:\nTNFR", "value": 1}, {"id": "TNFR", "label": "TNFR", "shape": "dot", "title": " Neighbors:\npIkk", "value": 1}, {"id": "pIkk", "label": "pIkk", "shape": "dot", "title": " Neighbors:\npNfkpIkb\nNfkpIkb\nppIkk\npNfkIkb", "value": 4}, {"id": "ppIkk", "label": "ppIkk", "shape": "dot", "title": " Neighbors:\niIkk", "value": 1}, {"id": "NfkpIkb", "label": "NfkpIkb", "shape": "dot", "title": " Neighbors:\npNfkpIkb\npIkb\nNfk", "value": 3}, {"id": "pNfkIkb", "label": "pNfkIkb", "shape": "dot", "title": " Neighbors:\npNfkpIkb", "value": 1}, {"id": "pNfkpIkb", "label": "pNfkpIkb", "shape": "dot", "title": " Neighbors:\npIkb\npNfk", "value": 2}, {"id": "Ikk", "label": "Ikk", "shape": "dot", "title": " Neighbors:\npIkk", "value": 1}, {"id": "iIkk", "label": "iIkk", "shape": "dot", "title": " Neighbors:\nIkk", "value": 1}, {"id": "Nfk", "label": "Nfk", "shape": "dot", "title": " Neighbors:\nnNfk\nNfkIkb", "value": 2}, {"id": "pIkb", "label": "pIkb", "shape": "dot", "title": " Neighbors:\n", "value": 0}, {"id": "pNfk", "label": "pNfk", "shape": "dot", "title": " Neighbors:\npnNfk", "value": 1}, {"id": "NfkIkb", "label": "NfkIkb", "shape": "dot", "title": " Neighbors:\nNfkpIkb\npNfkIkb", "value": 2}, {"id": "nNfk", "label": "nNfk", "shape": "dot", "title": " Neighbors:\nRnaA20_1\nnNfkIkb\nmIkb", "value": 3}, {"id": "pnNfk", "label": "pnNfk", "shape": "dot", "title": " Neighbors:\nnNfk", "value": 1}, {"id": "mIkb", "label": "mIkb", "shape": "dot", "title": " Neighbors:\nIkb", "value": 1}, {"id": "nNfkIkb", "label": "nNfkIkb", "shape": "dot", "title": " Neighbors:\nNfkIkb", "value": 1}, {"id": "RnaA20_1", "label": "RnaA20_1", "shape": "dot", "title": " Neighbors:\nRnaA20", "value": 1}, {"id": "Ikb", "label": "Ikb", "shape": "dot", "title": " Neighbors:\nnIkb\nNfkIkb", "value": 2}, {"id": "nIkb", "label": "nIkb", "shape": "dot", "title": " Neighbors:\nnNfkIkb", "value": 1}, {"id": "RnaA20", "label": "RnaA20", "shape": "dot", "title": " Neighbors:\nA20", "value": 1}, {"id": "A20", "label": "A20", "shape": "dot", "title": " Neighbors:\n", "value": 0}]);
edges = new vis.DataSet([{"arrows": "to", "from": "TNF", "to": "TNFR"}, {"arrows": "to", "from": "TNFR", "to": "pIkk"}, {"arrows": "to", "from": "pIkk", "to": "ppIkk"}, {"arrows": "to", "from": "pIkk", "to": "NfkpIkb"}, {"arrows": "to", "from": "pIkk", "to": "pNfkIkb"}, {"arrows": "to", "from": "pIkk", "to": "pNfkpIkb"}, {"arrows": "to", "from": "ppIkk", "to": "iIkk"}, {"arrows": "to", "from": "NfkpIkb", "to": "pNfkpIkb"}, {"arrows": "to", "from": "NfkpIkb", "to": "Nfk"}, {"arrows": "to", "from": "NfkpIkb", "to": "pIkb"}, {"arrows": "to", "from": "pNfkIkb", "to": "pNfkpIkb"}, {"arrows": "to", "from": "pNfkpIkb", "to": "pIkb"}, {"arrows": "to", "from": "pNfkpIkb", "to": "pNfk"}, {"arrows": "to", "from": "Ikk", "to": "pIkk"}, {"arrows": "to", "from": "iIkk", "to": "Ikk"}, {"arrows": "to", "from": "Nfk", "to": "NfkIkb"}, {"arrows": "to", "from": "Nfk", "to": "nNfk"}, {"arrows": "to", "from": "pNfk", "to": "pnNfk"}, {"arrows": "to", "from": "NfkIkb", "to": "NfkpIkb"}, {"arrows": "to", "from": "NfkIkb", "to": "pNfkIkb"}, {"arrows": "to", "from": "nNfk", "to": "mIkb"}, {"arrows": "to", "from": "nNfk", "to": "nNfkIkb"}, {"arrows": "to", "from": "nNfk", "to": "RnaA20_1"}, {"arrows": "to", "from": "pnNfk", "to": "nNfk"}, {"arrows": "to", "from": "mIkb", "to": "Ikb"}, {"arrows": "to", "from": "nNfkIkb", "to": "NfkIkb"}, {"arrows": "to", "from": "RnaA20_1", "to": "RnaA20"}, {"arrows": "to", "from": "Ikb", "to": "NfkIkb"}, {"arrows": "to", "from": "Ikb", "to": "nIkb"}, {"arrows": "to", "from": "nIkb", "to": "nNfkIkb"}, {"arrows": "to", "from": "RnaA20", "to": "A20"}]);
// adding nodes and edges to the graph
data = {nodes: nodes, edges: edges};
var options = {
"configure": {
"enabled": true,
"filter": [
"physics",
"layout"
]
},
"edges": {
"color": {
"inherit": true
},
"smooth": {
"enabled": true,
"type": "dynamic"
}
},
"interaction": {
"dragNodes": true,
"hideEdgesOnDrag": false,
"hideNodesOnDrag": false
},
"physics": {
"enabled": true,
"stabilization": {
"enabled": true,
"fit": true,
"iterations": 1000,
"onlyDynamicEdges": false,
"updateInterval": 50
}
}
};
// if this network requires displaying the configure window,
// put it in its div
options.configure["container"] = document.getElementById("config");
network = new vis.Network(container, data, options);
return network;
}
drawGraph();
</script>
</body>
</html>