{ "metadata": { "name": "", "signature": "sha256:4be8861c8c7e13efa9009dd21740f270aec28b966cbeae049290d84bf39a056a" }, "nbformat": 3, "nbformat_minor": 0, "worksheets": [ { "cells": [ { "cell_type": "code", "collapsed": false, "input": [ "import cytoscape.viewer as cy, json\n", "import graphlab as gl\n", "\n", "sf = gl.SFrame({'id':['A','B','C','A','B','A'],'value':[1,10,20,30,40,50]})\n", "sf.show()" ], "language": "python", "metadata": {}, "outputs": [ { "javascript": [ "if (window['cytoscape'] === undefined) {\n", " var paths = {\n", " cytoscape: 'http://cytoscape.github.io/cytoscape.js/api/cytoscape.js-latest/cytoscape.min'\n", " };\n", "\n", " require.config({\n", " paths: paths\n", " });\n", "\n", " require(['cytoscape'], function(cytoscape) {\n", " window['cytoscape'] = cytoscape;\n", "\n", " var event = document.createEvent(\"HTMLEvents\");\n", " event.initEvent(\"load_cytoscape\", true, false);\n", " window.dispatchEvent(event);\n", " });\n", "}" ], "metadata": {}, "output_type": "display_data", "text": [ "" ] }, { "output_type": "stream", "stream": "stderr", "text": [ "A newer version of GraphLab Create (v0.9) is available! Your current version is v0.1.0.\n", "You can use pip to upgrade the graphlab-create package. For more information see http://graphlab.com/products/create/upgrade.[INFO] Start server at: ipc:///tmp/graphlab_server-3254 - Server binary: /Users/kono/anaconda/lib/python2.7/site-packages/graphlab/unity_server - Server log: /tmp/graphlab_server_1405984454.log\n" ] }, { "output_type": "stream", "stream": "stderr", "text": [ "[INFO] GraphLab Server Version: 0.1.0\n" ] }, { "ename": "AttributeError", "evalue": "'SFrame' object has no attribute 'show'", "output_type": "pyerr", "traceback": [ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m\n\u001b[0;31mAttributeError\u001b[0m Traceback (most recent call last)", "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m()\u001b[0m\n\u001b[1;32m 3\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 4\u001b[0m \u001b[0msf\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mgl\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mSFrame\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m{\u001b[0m\u001b[0;34m'id'\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m'A'\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m'B'\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m'C'\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m'A'\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m'B'\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m'A'\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m'value'\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;36m1\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;36m10\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;36m20\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;36m30\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;36m40\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;36m50\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m}\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 5\u001b[0;31m \u001b[0msf\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mshow\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", "\u001b[0;31mAttributeError\u001b[0m: 'SFrame' object has no attribute 'show'" ] }, { "output_type": "stream", "stream": "stderr", "text": [ "[INFO] Stopping the server connection.\n" ] }, { "output_type": "stream", "stream": "stderr", "text": [ "[INFO] GraphLab server shutdown\n" ] } ], "prompt_number": 1 }, { "cell_type": "code", "collapsed": false, "input": [ "# Load network file generated in Cytoscape 3.1.x\n", "yeast_network_file = open('yeast2.cyjs')\n", "yeast_network = json.load(yeast_network_file)" ], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 2 }, { "cell_type": "code", "collapsed": false, "input": [ "visual_style_file = open('style.json')\n", "vs_collection = json.load(visual_style_file)\n", "styles = {}\n", "for style in vs_collection:\n", " style_settings = style['style']\n", " title = style['title']\n", " styles[title] = style_settings\n" ], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 3 }, { "cell_type": "code", "collapsed": false, "input": [ "cy.render(yeast_network, styles['default'], 'preset', 500)" ], "language": "python", "metadata": {}, "outputs": [ { "html": [ "\n", "\n", "\n", "\n", " \n", " \n", "\n", " \n", "\n", "\n", "\n", "
\n", " \n", "
\n", "\n", "\n", "" ], "metadata": {}, "output_type": "display_data", "text": [ "" ] } ], "prompt_number": 4 }, { "cell_type": "code", "collapsed": false, "input": [ "cy.render(yeast_network, styles['Directed'])" ], "language": "python", "metadata": {}, "outputs": [ { "html": [ "\n", "\n", "\n", "\n", " \n", " \n", "\n", " \n", "\n", "\n", "\n", "
\n", " \n", "
\n", "\n", "\n", "" ], "metadata": {}, "output_type": "display_data", "text": [ "" ] } ], "prompt_number": 5 }, { "cell_type": "code", "collapsed": false, "input": [], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 5 } ], "metadata": {} } ] }