{"id":495,"date":"2019-02-19T23:45:43","date_gmt":"2019-02-19T23:45:43","guid":{"rendered":"http:\/\/miriamposner.com\/classes\/dh201w23\/?page_id=495"},"modified":"2019-02-19T23:45:44","modified_gmt":"2019-02-19T23:45:44","slug":"publish-your-cytoscape-graph","status":"publish","type":"page","link":"https:\/\/miriamposner.com\/classes\/dh201w23\/tutorials-guides\/network-analysis\/publish-your-cytoscape-graph\/","title":{"rendered":"Publish your Cytoscape graph"},"content":{"rendered":"\n<p>So far we&#8217;ve&nbsp;<a href=\"http:\/\/miriamposner.com\/classes\/dh201w23\/tutorials-guides\/network-analysis\/create-a-network-graph-with-cytoscape\/\">created a basic Cytoscape network<\/a>,&nbsp;<a href=\"http:\/\/miriamposner.com\/classes\/dh201w23\/tutorials-guides\/network-analysis\/cytoscape-working-with-attributes\/\">learned to work with node attributes<\/a>,&nbsp;<a href=\"http:\/\/miriamposner.com\/classes\/dh201w23\/tutorials-guides\/network-analysis\/cytoscape-working-with-selections\/\">learned to select parts of a network<\/a>, and&nbsp;<a href=\"http:\/\/miriamposner.com\/classes\/dh201w23\/tutorials-guides\/network-analysis\/get-a-unimodal-network-from-a-bimodal-network\/\">learned how to convert a bimodal edge list into a unimodal edge list<\/a>. Now we&#8217;ll learn about the ways we can export a network diagram in order to share it with the world.<\/p>\n\n\n\n<p>There are a few different ways to do this, depending on how fancy you want to get. The easiest way is to create a static image of the network. We&#8217;ll start with that, in Step 1. Creating an&nbsp;<a href=\"http:\/\/goo.gl\/j9pgdq\">interactive, web-based version<\/a>&nbsp;is more fiddly, but not super-complicated. We&#8217;ll do that second, beginning in Step 2.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><a href=\"https:\/\/github.com\/miriamposner\/cytoscape_tutorials\/blob\/master\/publishing-your-network-diagram.md#1-option-1-export-a-static-image\"><\/a>1. Option 1: Export a static image<\/h2>\n\n\n\n<p>You&#8217;ll be relieved to hear that this is pretty easy. Just click the&nbsp;<strong>Export Network Image to File<\/strong>&nbsp;button (labeled&nbsp;<strong>1<\/strong>&nbsp;in the image below). Then &#8212; this is the only confusing part &#8212; press the&nbsp;<strong>Browse<\/strong>&nbsp;button (labeled&nbsp;<strong>2<\/strong>) to choose where to save your image. Give your image a name (<strong>3<\/strong>), then click&nbsp;<strong>OK<\/strong>&nbsp;(<strong>4<\/strong>). You can then set the size of the image and a few other parameters, and you&#8217;ll be able to save the static image to wherever you&#8217;d like.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/github.com\/miriamposner\/cytoscape_tutorials\/blob\/master\/images\/publishing-your-network-diagram\/option-1--export-a-static-image.png\" target=\"_blank\" rel=\"noreferrer noopener\"><img decoding=\"async\" src=\"https:\/\/github.com\/miriamposner\/cytoscape_tutorials\/raw\/master\/images\/publishing-your-network-diagram\/option-1--export-a-static-image.png\" alt=\"\"\/><\/a><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\"><a href=\"https:\/\/github.com\/miriamposner\/cytoscape_tutorials\/blob\/master\/publishing-your-network-diagram.md#2-option-2-exporting-an-interactive-version-for-the-web\"><\/a>2. Option 2: Exporting an interactive version for the web<\/h2>\n\n\n\n<p>This option, alas, has a few more steps, but the result is interactive, zoomable, clickable, and has some other nice features.&nbsp;<a href=\"http:\/\/goo.gl\/s4BnEu\">Here&#8217;s an example of one of these interactive network graphs<\/a>. In broad strokes, you&#8217;ll:<\/p>\n\n\n\n<ol class=\"wp-block-list\"><li>Export your network data from Cytoscape (in a special format called .cyjs);<\/li><li>Export the styling you&#8217;ve done to your network (in a special format called .json);<\/li><li>Upload the network data to the web;<\/li><li>Upload the style information to the web;<\/li><li>Enter the URLs to the network and style data to the CyNetShare service;<\/li><li>Click visualize!<\/li><\/ol>\n\n\n\n<p>Here&#8217;s a hitch: We have to put our files on a server in order to hook them up to CyNetShare. There are a few different ways to do this. If you have access to a server that can host files, that&#8217;s probably easiest. For the purposes of this tutorial, though, I&#8217;m assuming you&nbsp;<em>don&#8217;t<\/em>&nbsp;have access to a server, so I&#8217;ll show you how to use Github&#8217;s&nbsp;<a href=\"https:\/\/gist.github.com\/\">Gist<\/a>&nbsp;service to host your style file.<\/p>\n\n\n\n<p>Hang in there. There are a lot of steps, but none of them is actually that complicated.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/github.com\/miriamposner\/cytoscape_tutorials\/blob\/master\/images\/publishing-your-network-diagram\/option-2--exporting-an-interactive-version-for-the-web.png\" target=\"_blank\" rel=\"noreferrer noopener\"><img decoding=\"async\" src=\"https:\/\/github.com\/miriamposner\/cytoscape_tutorials\/raw\/master\/images\/publishing-your-network-diagram\/option-2--exporting-an-interactive-version-for-the-web.png\" alt=\"\"\/><\/a><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\"><a href=\"https:\/\/github.com\/miriamposner\/cytoscape_tutorials\/blob\/master\/publishing-your-network-diagram.md#3-export-your-network-data\"><\/a>3. Export your network data<\/h2>\n\n\n\n<p>Let&#8217;s export our network data from Cytoscape. To do that, click on&nbsp;<strong>File<\/strong>, then&nbsp;<strong>Export<\/strong>, then&nbsp;<strong>Export Network and View<\/strong>. (Be sure you choose&nbsp;<strong>Network and View<\/strong>; exporting the network alone won&#8217;t work.)<\/p>\n\n\n\n<p>For the export file format (<strong>1<\/strong>), select&nbsp;<strong>Cytoscape.js JSON (*.cyjs)<\/strong>. In the field labeled&nbsp;<strong>Save Network as<\/strong>&nbsp;(<strong>2<\/strong>), click&nbsp;<strong>Browse<\/strong>&nbsp;(<strong>3<\/strong>), give your file a name (<strong>4<\/strong>), and save it somewhere you&#8217;ll find it again later. Finally, click&nbsp;<strong>OK<\/strong>.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/github.com\/miriamposner\/cytoscape_tutorials\/blob\/master\/images\/publishing-your-network-diagram\/export-your-network-data.png\" target=\"_blank\" rel=\"noreferrer noopener\"><img decoding=\"async\" src=\"https:\/\/github.com\/miriamposner\/cytoscape_tutorials\/raw\/master\/images\/publishing-your-network-diagram\/export-your-network-data.png\" alt=\"\"\/><\/a><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\"><a href=\"https:\/\/github.com\/miriamposner\/cytoscape_tutorials\/blob\/master\/publishing-your-network-diagram.md#4-export-your-style-1\"><\/a>4. Export your style (1)<\/h2>\n\n\n\n<p>In the previous step, you exported information about your nodes and edges, but you didn&#8217;t export any information about the color, size, or layout of your network &#8212; which is to say, you&#8217;re missing style information.<\/p>\n\n\n\n<p>Luckily, you can export that, too. There are a couple steps involved in this. First, assuming you&#8217;ve been modifying one of Cytoscape&#8217;s existing styles (that&#8217;s what we did in previous tutorials in this series), click on the downward-pointing arrow next to the name of the style, and then click&nbsp;<strong>Copy style<\/strong>. Give your new style a name (it&#8217;s easiest if you don&#8217;t use spaces). Then click&nbsp;<strong>OK<\/strong>.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/github.com\/miriamposner\/cytoscape_tutorials\/blob\/master\/images\/publishing-your-network-diagram\/export-your-style--1-.png\" target=\"_blank\" rel=\"noreferrer noopener\"><img decoding=\"async\" src=\"https:\/\/github.com\/miriamposner\/cytoscape_tutorials\/raw\/master\/images\/publishing-your-network-diagram\/export-your-style--1-.png\" alt=\"\"\/><\/a><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\"><a href=\"https:\/\/github.com\/miriamposner\/cytoscape_tutorials\/blob\/master\/publishing-your-network-diagram.md#5-export-your-style-2\"><\/a>5. Export your style (2)<\/h2>\n\n\n\n<p>Now we can export the style information we just copied. Click on&nbsp;<strong>File<\/strong>, then&nbsp;<strong>Export<\/strong>, and then&nbsp;<strong>Styles<\/strong>. Select the name of the style you created in the previous step. Now &#8212; this is important &#8212; for the export file format, select&nbsp;<strong>Style for cytoscape.js (*.json)<\/strong>.<\/p>\n\n\n\n<p>Now, just as you did in Step 3, select&nbsp;<strong>Browse<\/strong>, give your style a name, and save it somewhere you&#8217;ll remember. Finally, click&nbsp;<strong>Save<\/strong>, and then&nbsp;<strong>OK<\/strong>.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/github.com\/miriamposner\/cytoscape_tutorials\/blob\/master\/images\/publishing-your-network-diagram\/export-your-style--2-.png\" target=\"_blank\" rel=\"noreferrer noopener\"><img decoding=\"async\" src=\"https:\/\/github.com\/miriamposner\/cytoscape_tutorials\/raw\/master\/images\/publishing-your-network-diagram\/export-your-style--2-.png\" alt=\"\"\/><\/a><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\"><a href=\"https:\/\/github.com\/miriamposner\/cytoscape_tutorials\/blob\/master\/publishing-your-network-diagram.md#6-create-a-gist-for-your-network-data\"><\/a>6. Create a Gist for your network data<\/h2>\n\n\n\n<p>Now we have one file that contains our network data and one file that contains style information. We have to put both of these files on the internet somewhere so that the CyNetShare application, which will host our visualization, can access them. We&#8217;ll use&nbsp;<a href=\"https:\/\/gist.github.com\/\">Gist<\/a>, a service designed to allow people to share code quickly and easily.<\/p>\n\n\n\n<p>In a web browser, go to&nbsp;<a href=\"https:\/\/gist.github.com\/\">gist.github.com<\/a>. Now just drag and drop the network file you saved in Step 4 onto the&nbsp;<strong>Add File<\/strong>&nbsp;box. It will automatically load. Now click on the&nbsp;<strong>Create public gist<\/strong>&nbsp;button.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/github.com\/miriamposner\/cytoscape_tutorials\/blob\/master\/images\/publishing-your-network-diagram\/create-a-gist-for-your-network-data.png\" target=\"_blank\" rel=\"noreferrer noopener\"><img decoding=\"async\" src=\"https:\/\/github.com\/miriamposner\/cytoscape_tutorials\/raw\/master\/images\/publishing-your-network-diagram\/create-a-gist-for-your-network-data.png\" alt=\"\"\/><\/a><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\"><a href=\"https:\/\/github.com\/miriamposner\/cytoscape_tutorials\/blob\/master\/publishing-your-network-diagram.md#7-get-the-url-for-your-network-data\"><\/a>7. Get the URL for your network data<\/h2>\n\n\n\n<p>We want the URL for the raw version of the network data &#8212; meaning the version that doesn&#8217;t contain all of the Github menus and toolbars &#8212; so click on the&nbsp;<strong>Raw<\/strong>&nbsp;button.<\/p>\n\n\n\n<p>Now copy the URL for the raw version of your network data. Paste it in a blank document somewhere (or just leave the window open) so you&#8217;ll be able to find the URL again later.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/github.com\/miriamposner\/cytoscape_tutorials\/blob\/master\/images\/publishing-your-network-diagram\/get-the-url-for-your-network-data.png\" target=\"_blank\" rel=\"noreferrer noopener\"><img decoding=\"async\" src=\"https:\/\/github.com\/miriamposner\/cytoscape_tutorials\/raw\/master\/images\/publishing-your-network-diagram\/get-the-url-for-your-network-data.png\" alt=\"\"\/><\/a><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\"><a href=\"https:\/\/github.com\/miriamposner\/cytoscape_tutorials\/blob\/master\/publishing-your-network-diagram.md#8-create-a-gist-for-your-style-information\"><\/a>8. Create a Gist for your style information<\/h2>\n\n\n\n<p>Now repeat Steps 6 and 7 with the style file you generated in Step 5. Be sure to click on the&nbsp;<strong>Raw<\/strong>&nbsp;button before you copy the URL.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/github.com\/miriamposner\/cytoscape_tutorials\/blob\/master\/images\/publishing-your-network-diagram\/create-a-gist-for-your-style-information.png\" target=\"_blank\" rel=\"noreferrer noopener\"><img decoding=\"async\" src=\"https:\/\/github.com\/miriamposner\/cytoscape_tutorials\/raw\/master\/images\/publishing-your-network-diagram\/create-a-gist-for-your-style-information.png\" alt=\"\"\/><\/a><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\"><a href=\"https:\/\/github.com\/miriamposner\/cytoscape_tutorials\/blob\/master\/publishing-your-network-diagram.md#9-enter-the-urls-on-cynetshare\"><\/a>9. Enter the URLs on CyNetShare<\/h2>\n\n\n\n<p>CyNetShare is a website that allows you to publish an interactive version of your network graph. Go to <a href=\"http:\/\/cynetshare.ucsd.edu\/#\/\">cynetshare.ucsd.edu.<\/a><\/p>\n\n\n\n<p>In the&nbsp;<strong>Network Data URL<\/strong>&nbsp;box, copy and paste the URL to the raw version of the Gist you created to contain your network data.<\/p>\n\n\n\n<p>In the&nbsp;<strong>Visual Style URL<\/strong>&nbsp;box, copy and paste the URL to the raw version of the Gist you created to contain your style information.<\/p>\n\n\n\n<p>Now click&nbsp;<strong>Visualize!<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/github.com\/miriamposner\/cytoscape_tutorials\/blob\/master\/images\/publishing-your-network-diagram\/enter-the-urls-on-cynetshare.png\" target=\"_blank\" rel=\"noreferrer noopener\"><img decoding=\"async\" src=\"https:\/\/github.com\/miriamposner\/cytoscape_tutorials\/raw\/master\/images\/publishing-your-network-diagram\/enter-the-urls-on-cynetshare.png\" alt=\"\"\/><\/a><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\"><a href=\"https:\/\/github.com\/miriamposner\/cytoscape_tutorials\/blob\/master\/publishing-your-network-diagram.md#10-hopefully-you-have-a-network\"><\/a>10. Hopefully you have a network!<\/h2>\n\n\n\n<p>Hopefully that worked! Ideally, you&#8217;ll be able to zoom into the network using the scroll wheel (or two fingers) and move the canvas around by clicking, holding for a moment, and dragging.<\/p>\n\n\n\n<p>In practice, I&#8217;ve found that CyNetShare can be a bit buggy. Some things I&#8217;ve encountered:<\/p>\n\n\n\n<ol class=\"wp-block-list\"><li>You may have to select your style from the dropdown menu on the top left.<\/li><li>If you get a large &#8220;loading&#8221; image in the middle of your window that won&#8217;t go away, try clicking on the&nbsp;<strong>Share<\/strong>&nbsp;button on the right side of the browser window. (It looks like a white arrow on a red background.) Copy the URL that pops up, paste it in a new browser window, and load it. Often that makes the &#8220;loading&#8221; image go away. (Why? No idea.)<\/li><\/ol>\n\n\n\n<p>Congrats, you&#8217;ve published your interactive network graph!<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/github.com\/miriamposner\/cytoscape_tutorials\/blob\/master\/images\/publishing-your-network-diagram\/hopefully-you-have-a-network-.png\" target=\"_blank\" rel=\"noreferrer noopener\"><img decoding=\"async\" src=\"https:\/\/github.com\/miriamposner\/cytoscape_tutorials\/raw\/master\/images\/publishing-your-network-diagram\/hopefully-you-have-a-network-.png\" alt=\"\"\/><\/a><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>So far we&#8217;ve&nbsp;created a basic Cytoscape network,&nbsp;learned to work with node attributes,&nbsp;learned to select parts of a network, and&nbsp;learned how to convert a bimodal edge list into a unimodal edge&hellip; <a class=\"more-link\" href=\"https:\/\/miriamposner.com\/classes\/dh201w23\/tutorials-guides\/network-analysis\/publish-your-cytoscape-graph\/\">Continue reading <span class=\"screen-reader-text\">Publish your Cytoscape graph<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"parent":482,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_eb_attr":"","footnotes":""},"class_list":["post-495","page","type-page","status-publish","hentry","entry"],"_links":{"self":[{"href":"https:\/\/miriamposner.com\/classes\/dh201w23\/wp-json\/wp\/v2\/pages\/495","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/miriamposner.com\/classes\/dh201w23\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/miriamposner.com\/classes\/dh201w23\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/miriamposner.com\/classes\/dh201w23\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/miriamposner.com\/classes\/dh201w23\/wp-json\/wp\/v2\/comments?post=495"}],"version-history":[{"count":0,"href":"https:\/\/miriamposner.com\/classes\/dh201w23\/wp-json\/wp\/v2\/pages\/495\/revisions"}],"up":[{"embeddable":true,"href":"https:\/\/miriamposner.com\/classes\/dh201w23\/wp-json\/wp\/v2\/pages\/482"}],"wp:attachment":[{"href":"https:\/\/miriamposner.com\/classes\/dh201w23\/wp-json\/wp\/v2\/media?parent=495"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}