{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "import ipycytoscape" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "import json\n", "with open(\"concentricData.json\") as fi:\n", " json_file = json.load(fi)" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [], "source": [ "cytoscapeobj = ipycytoscape.CytoscapeWidget()\n", "cytoscapeobj.graph.add_graph_from_json(json_file)" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "664dc22624894056afd65861cbda44b6", "version_major": 2, "version_minor": 0 }, "text/plain": [ "CytoscapeWidget(cytoscape_layout={'name': 'concentric'}, cytoscape_style=[{'selector': 'node', 'style': {'heig…" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "cytoscapeobj.set_layout(name='concentric')\n", "cytoscapeobj.set_style([{\n", " \"selector\":\"node\",\n", " \"style\":{\n", " \"height\":20,\n", " \"width\":20,\n", " \"background-color\":\"#30c9bc\"\n", " }\n", " },\n", " {\n", " \"selector\":\"edge\",\n", " \"style\":{\n", " \"curve-style\":\"haystack\",\n", " \"haystack-radius\":0,\n", " \"width\":5,\n", " \"opacity\":0.5,\n", " \"line-color\":\"#a8eae5\"\n", " }\n", " }])\n", "cytoscapeobj" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "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.9.2" } }, "nbformat": 4, "nbformat_minor": 4 }