<commit_before>{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": true
   },
   "source": [
    "# Style\n",
    "\n",
    "- Default\n",
    "  - Get\n",
    "    - There are so many options, so I will pick some of them up and I will write a typical workflow.\n",
    "    For users, it will be useful and if they want to know more about it or more complex one, \n",
    "    they can use if as example.\n",
    "  \n",
    "  - Set\n",
    "    - Same as above\n",
    "\n",
    "- Direct\n",
    "  - Get\n",
    "    - same as above\n",
    "  - Set\n",
    "    - same as above\n",
    "\n",
    "- Rule\n",
    "  - Get\n",
    "    - same as above\n",
    "    \n",
    "  - Set\n",
    "    - same as above\n",
    "\n",
    "- Change style by attribute\n",
    "  - Nodes\n",
    "  - Edges"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "R",
   "language": "R",
   "name": "ir"
  },
  "language_info": {
   "codemirror_mode": "r",
   "file_extension": ".r",
   "mimetype": "text/x-r-source",
   "name": "R",
   "pygments_lexer": "r",
   "version": "3.2.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}
<commit_msg>[modify] add examples<commit_after>{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": true
   },
   "source": [
    "# Style\n",
    "\n",
    "- Default\n",
    "  - Get\n",
    "    - There are so many options, so I will pick some of them up and I will write a typical workflow.\n",
    "    For users, it will be useful and if they want to know more about it or more complex one, \n",
    "    they can use if as example.\n",
    "  \n",
    "  - Set\n",
    "    - Same as above\n",
    "\n",
    "- Direct\n",
    "  - Get\n",
    "    - same as above\n",
    "  - Set\n",
    "    - same as above\n",
    "\n",
    "- Rule\n",
    "  - Get\n",
    "    - same as above\n",
    "    \n",
    "  - Set\n",
    "    - same as above\n",
    "\n",
    "- Change style by attribute\n",
    "  - Nodes\n",
    "  - Edges"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Style\n",
    "---------------------------------------\n",
    "\n",
    "In this section, you can learn how to apply default style or your original style. And you can also understand how to apply descrete or continuous mapping.\n",
    "\n",
    "\n",
    "## Table of contents\n",
    "---------------------------------------\n",
    "- Get the default Style and apply it\n",
    "- Get visual propeties\n",
    "- Create original Style and apply it\n",
    "- Create passthrough mapping\n",
    "- Create continuous mapping \n",
    "- Create descrete mapping"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": true
   },
   "source": [
    "# Prepare network data\n",
    "---------------------------------------\n",
    "\n",
    "To execute this cookbook's example, first you prepare network data."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "Loading required package: graph\n",
      "Loading required package: httr\n",
      "Warning message:\n",
      ": package ‘httr’ was built under R version 3.2.5Loading required package: RJSONIO\n",
      "Loading required package: RCurl\n",
      "Warning message:\n",
      ": package ‘RCurl’ was built under R version 3.2.4Loading required package: bitops\n",
      "\n",
      "Attaching package: ‘igraph’\n",
      "\n",
      " 以下のオブジェクトは ‘package:graph’ からマスクされています: \n",
      "\n",
      "     degree, edges, intersection, union \n",
      "\n",
      " 以下のオブジェクトは ‘package:stats’ からマスクされています: \n",
      "\n",
      "     decompose, spectrum \n",
      "\n",
      " 以下のオブジェクトは ‘package:base’ からマスクされています: \n",
      "\n",
      "     union \n",
      "\n",
      "Warning message:\n",
      ":  使われていないコネクション 4 (../sampleData/galFiltered.sif) を閉じます Warning message:\n",
      "In .local(from, to, graph): edges replaced: ‘YPL248C|YML051W’"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[1] \"label\"\n",
      "[1] \"edgeType\"\n"
     ]
    }
   ],
   "source": [
    "# import library\n",
    "library(RCy3)\n",
    "library(igraph)\n",
    "\n",
    "# import utility\n",
    "source(\"../../utility/import.R\")\n",
    "\n",
    "# first, delete existing windows to save memory:\n",
    "deleteAllWindows(CytoscapeConnection())\n",
    "\n",
    "# create graph class\n",
    "g <- new ('graphNEL', edgemode='directed')\n",
    "\n",
    "edgeDataDefaults(g, attr = \"edgeType\") <- \"undefined\"\n",
    "attr(edgeDataDefaults(g, attr = \"edgeType\"), \"class\") <- \"STRING\"\n",
    "\n",
    "# Load Data\n",
    "gal.matrix <- sifDataToMatrix('../sampleData/galFiltered.sif')\n",
    "\n",
    "# Get NodesVec\n",
    "gal.table.nodevec <- unique(c(gal.matrix[,1], gal.matrix[,3]))\n",
    "\n",
    "# add nodes to graph\n",
    "for(node in gal.table.nodevec){\n",
    "    g <- graph::addNode(node, g)\n",
    "}\n",
    "\n",
    "# get EdgeList and type\n",
    "gal.table.fromvec <- gal.matrix[,1]\n",
    "gal.table.type <- gal.matrix[,2]\n",
    "gal.table.tovec <-  gal.matrix[,3]\n",
    "\n",
    "for (index in 1:length(gal.table.fromvec)){\n",
    "    g <- graph::addEdge (gal.table.fromvec[[index]] ,gal.table.tovec[[index]], g)\n",
    "    edgeData(g, gal.table.fromvec[[index]] ,gal.table.tovec[[index]], \"edgeType\") <- gal.table.type[[index]]\n",
    "}\n",
    "\n",
    "# show it in cytescape\n",
    "cw <- CytoscapeWindow('vignette', graph=g, overwrite=TRUE)\n",
    "displayGraph (cw)\n",
    "layoutNetwork (cw, layout.name='degree-circle')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": true
   },
   "source": [
    "# Get the default Style and apply it\n",
    "---------------------------------------\n",
    "\n",
    "In Cytoscape, there are several useful default styles. You can get the list of the style and apply the style that you want."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": true
   },
   "source": [
    "## Get the default Style\n",
    "---------------------------------------\n",
    "\n",
    "First, to know the available default style, let's get all of the default style in Cytoscape. If you add some original style, you can get that style by this method. However, now we don't make any style, so we can only get the default style here."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<ol class=list-inline>\n",
       "\t<li>'default'</li>\n",
       "\t<li>'Sample3'</li>\n",
       "\t<li>'Minimal'</li>\n",
       "\t<li>'Gradient1'</li>\n",
       "\t<li>'Universe'</li>\n",
       "\t<li>'Marquee'</li>\n",
       "\t<li>'Nested Network Style'</li>\n",
       "\t<li>'Sample1'</li>\n",
       "\t<li>'Sample2'</li>\n",
       "\t<li>'Solid'</li>\n",
       "\t<li>'Curved'</li>\n",
       "\t<li>'BioPAX'</li>\n",
       "\t<li>'BioPAX_SIF'</li>\n",
       "\t<li>'Directed'</li>\n",
       "\t<li>'Ripple'</li>\n",
       "\t<li>'default black'</li>\n",
       "\t<li>'Big Labels'</li>\n",
       "</ol>\n"
      ],
      "text/latex": [
       "\\begin{enumerate*}\n",
       "\\item 'default'\n",
       "\\item 'Sample3'\n",
       "\\item 'Minimal'\n",
       "\\item 'Gradient1'\n",
       "\\item 'Universe'\n",
       "\\item 'Marquee'\n",
       "\\item 'Nested Network Style'\n",
       "\\item 'Sample1'\n",
       "\\item 'Sample2'\n",
       "\\item 'Solid'\n",
       "\\item 'Curved'\n",
       "\\item 'BioPAX'\n",
       "\\item 'BioPAX\\_SIF'\n",
       "\\item 'Directed'\n",
       "\\item 'Ripple'\n",
       "\\item 'default black'\n",
       "\\item 'Big Labels'\n",
       "\\end{enumerate*}\n"
      ],
      "text/markdown": [
       "1. 'default'\n",
       "2. 'Sample3'\n",
       "3. 'Minimal'\n",
       "4. 'Gradient1'\n",
       "5. 'Universe'\n",
       "6. 'Marquee'\n",
       "7. 'Nested Network Style'\n",
       "8. 'Sample1'\n",
       "9. 'Sample2'\n",
       "10. 'Solid'\n",
       "11. 'Curved'\n",
       "12. 'BioPAX'\n",
       "13. 'BioPAX_SIF'\n",
       "14. 'Directed'\n",
       "15. 'Ripple'\n",
       "16. 'default black'\n",
       "17. 'Big Labels'\n",
       "\n",
       "\n"
      ],
      "text/plain": [
       " [1] \"default\"              \"Sample3\"              \"Minimal\"             \n",
       " [4] \"Gradient1\"            \"Universe\"             \"Marquee\"             \n",
       " [7] \"Nested Network Style\" \"Sample1\"              \"Sample2\"             \n",
       "[10] \"Solid\"                \"Curved\"               \"BioPAX\"              \n",
       "[13] \"BioPAX_SIF\"           \"Directed\"             \"Ripple\"              \n",
       "[16] \"default black\"        \"Big Labels\"          "
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "getVisualStyleNames(cw)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": true
   },
   "source": [
    "## Apply default style network\n",
    "---------------------------------------\n",
    "\n",
    "Now, we know the available style, so let's apply the default style network."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "# apply 'Minimal' style\n",
    "setVisualStyle(cw, 'Minimal')\n",
    "\n",
    "# Show it \n",
    "# TODO : I don't know why this method is not available. So I have to find it.\n",
    "# print(saveImage(cw, 'sampleImage', 'pdf', 2.0))\n",
    "# The following code is available\n",
    "file.name <- paste (getwd (), 'resultImage' ,'applyMinimalStyle' , sep= '/' )\n",
    "image.type <- 'png'\n",
    "\n",
    "resource.uri <- paste(cw@uri, \n",
    "                      pluginVersion(cw), \"networks\", as.character(<EMAIL>), \n",
    "                      paste0(\"views/first.\", image.type), \n",
    "                      sep=\"/\")\n",
    "request.res <- GET(resource.uri, write_disk(paste0(file.name,\".\", image.type), overwrite = TRUE))\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "![cytoscape image](resultImage/applyMinimalStyle.png)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "# apply 'Gradient1' style\n",
    "setVisualStyle(cw, 'Gradient1')\n",
    "\n",
    "# Show it \n",
    "# TODO : I don't know why this method is not available. So I have to find it.\n",
    "# print(saveImage(cw, 'sampleImage', 'pdf', 2.0))\n",
    "\n",
    "# The following code is available\n",
    "file.name <- paste (getwd (), 'resultImage' ,'applyGradient1Style' , sep= '/' )\n",
    "image.type <- 'png'\n",
    "\n",
    "resource.uri <- paste(cw@uri, \n",
    "                      pluginVersion(cw), \"networks\", as.<EMAIL>(<EMAIL>), \n",
    "                      paste0(\"views/first.\", image.type), \n",
    "                      sep=\"/\")\n",
    "request.res <- GET(resource.uri, write_disk(paste0(file.name,\".\", image.type), overwrite = TRUE))\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "![cytoscape image](resultImage/applyGradient1Style.png)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": true
   },
   "source": [
    "# Get visual propeties\n",
    "---------------------------------------\n",
    "\n",
    "To create your original style, we have to set value to visual propeties. First, we should know the kind of visual propeties and there are several visual propeties in each node, edge and network."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Get all visual propeties\n",
    "---------------------------------------\n",
    "\n",
    "We can get all visual propeties."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "  [1] \"COMPOUND_NODE_PADDING\"              \"COMPOUND_NODE_SHAPE\"               \n",
      "  [3] \"DING_RENDERING_ENGINE_ROOT\"         \"EDGE\"                              \n",
      "  [5] \"EDGE_BEND\"                          \"EDGE_CURVED\"                       \n",
      "  [7] \"EDGE_LABEL\"                         \"EDGE_LABEL_COLOR\"                  \n",
      "  [9] \"EDGE_LABEL_FONT_FACE\"               \"EDGE_LABEL_FONT_SIZE\"              \n",
      " [11] \"EDGE_LABEL_TRANSPARENCY\"            \"EDGE_LABEL_WIDTH\"                  \n",
      " [13] \"EDGE_LINE_TYPE\"                     \"EDGE_PAINT\"                        \n",
      " [15] \"EDGE_SELECTED\"                      \"EDGE_SELECTED_PAINT\"               \n",
      " [17] \"EDGE_SOURCE_ARROW_SELECTED_PAINT\"   \"EDGE_SOURCE_ARROW_SHAPE\"           \n",
      " [19] \"EDGE_SOURCE_ARROW_UNSELECTED_PAINT\" \"EDGE_STROKE_SELECTED_PAINT\"        \n",
      " [21] \"EDGE_STROKE_UNSELECTED_PAINT\"       \"EDGE_TARGET_ARROW_SELECTED_PAINT\"  \n",
      " [23] \"EDGE_TARGET_ARROW_SHAPE\"            \"EDGE_TARGET_ARROW_UNSELECTED_PAINT\"\n",
      " [25] \"EDGE_TOOLTIP\"                       \"EDGE_TRANSPARENCY\"                 \n",
      " [27] \"EDGE_UNSELECTED_PAINT\"              \"EDGE_VISIBLE\"                      \n",
      " [29] \"EDGE_WIDTH\"                         \"NETWORK\"                           \n",
      " [31] \"NETWORK_BACKGROUND_PAINT\"           \"NETWORK_CENTER_X_LOCATION\"         \n",
      " [33] \"NETWORK_CENTER_Y_LOCATION\"          \"NETWORK_CENTER_Z_LOCATION\"         \n",
      " [35] \"NETWORK_DEPTH\"                      \"NETWORK_EDGE_SELECTION\"            \n",
      " [37] \"NETWORK_HEIGHT\"                     \"NETWORK_NODE_SELECTION\"            \n",
      " [39] \"NETWORK_SCALE_FACTOR\"               \"NETWORK_SIZE\"                      \n",
      " [41] \"NETWORK_TITLE\"                      \"NETWORK_WIDTH\"                     \n",
      " [43] \"NODE\"                               \"NODE_BORDER_PAINT\"                 \n",
      " [45] \"NODE_BORDER_STROKE\"                 \"NODE_BORDER_TRANSPARENCY\"          \n",
      " [47] \"NODE_BORDER_WIDTH\"                  \"NODE_CUSTOMGRAPHICS_1\"             \n",
      " [49] \"NODE_CUSTOMGRAPHICS_2\"              \"NODE_CUSTOMGRAPHICS_3\"             \n",
      " [51] \"NODE_CUSTOMGRAPHICS_4\"              \"NODE_CUSTOMGRAPHICS_5\"             \n",
      " [53] \"NODE_CUSTOMGRAPHICS_6\"              \"NODE_CUSTOMGRAPHICS_7\"             \n",
      " [55] \"NODE_CUSTOMGRAPHICS_8\"              \"NODE_CUSTOMGRAPHICS_9\"             \n",
      " [57] \"NODE_CUSTOMGRAPHICS_POSITION_1\"     \"NODE_CUSTOMGRAPHICS_POSITION_2\"    \n",
      " [59] \"NODE_CUSTOMGRAPHICS_POSITION_3\"     \"NODE_CUSTOMGRAPHICS_POSITION_4\"    \n",
      " [61] \"NODE_CUSTOMGRAPHICS_POSITION_5\"     \"NODE_CUSTOMGRAPHICS_POSITION_6\"    \n",
      " [63] \"NODE_CUSTOMGRAPHICS_POSITION_7\"     \"NODE_CUSTOMGRAPHICS_POSITION_8\"    \n",
      " [65] \"NODE_CUSTOMGRAPHICS_POSITION_9\"     \"NODE_CUSTOMGRAPHICS_SIZE_1\"        \n",
      " [67] \"NODE_CUSTOMGRAPHICS_SIZE_2\"         \"NODE_CUSTOMGRAPHICS_SIZE_3\"        \n",
      " [69] \"NODE_CUSTOMGRAPHICS_SIZE_4\"         \"NODE_CUSTOMGRAPHICS_SIZE_5\"        \n",
      " [71] \"NODE_CUSTOMGRAPHICS_SIZE_6\"         \"NODE_CUSTOMGRAPHICS_SIZE_7\"        \n",
      " [73] \"NODE_CUSTOMGRAPHICS_SIZE_8\"         \"NODE_CUSTOMGRAPHICS_SIZE_9\"        \n",
      " [75] \"NODE_CUSTOMPAINT_1\"                 \"NODE_CUSTOMPAINT_2\"                \n",
      " [77] \"NODE_CUSTOMPAINT_3\"                 \"NODE_CUSTOMPAINT_4\"                \n",
      " [79] \"NODE_CUSTOMPAINT_5\"                 \"NODE_CUSTOMPAINT_6\"                \n",
      " [81] \"NODE_CUSTOMPAINT_7\"                 \"NODE_CUSTOMPAINT_8\"                \n",
      " [83] \"NODE_CUSTOMPAINT_9\"                 \"NODE_DEPTH\"                        \n",
      " [85] \"NODE_FILL_COLOR\"                    \"NODE_HEIGHT\"                       \n",
      " [87] \"NODE_LABEL\"                         \"NODE_LABEL_COLOR\"                  \n",
      " [89] \"NODE_LABEL_FONT_FACE\"               \"NODE_LABEL_FONT_SIZE\"              \n",
      " [91] \"NODE_LABEL_POSITION\"                \"NODE_LABEL_TRANSPARENCY\"           \n",
      " [93] \"NODE_LABEL_WIDTH\"                   \"NODE_NESTED_NETWORK_IMAGE_VISIBLE\" \n",
      " [95] \"NODE_PAINT\"                         \"NODE_SELECTED\"                     \n",
      " [97] \"NODE_SELECTED_PAINT\"                \"NODE_SHAPE\"                        \n",
      " [99] \"NODE_SIZE\"                          \"NODE_TOOLTIP\"                      \n",
      "[101] \"NODE_TRANSPARENCY\"                  \"NODE_VISIBLE\"                      \n",
      "[103] \"NODE_WIDTH\"                         \"NODE_X_LOCATION\"                   \n",
      "[105] \"NODE_Y_LOCATION\"                    \"NODE_Z_LOCATION\"                   \n"
     ]
    }
   ],
   "source": [
    "# Get all visual propeties\n",
    "print(getDirectlyModifiableVisualProperties(cw))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Get node visual propeties\n",
    "---------------------------------------"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      " [1] \"NODE\"                              \"NODE_BORDER_PAINT\"                \n",
      " [3] \"NODE_BORDER_STROKE\"                \"NODE_BORDER_TRANSPARENCY\"         \n",
      " [5] \"NODE_BORDER_WIDTH\"                 \"NODE_CUSTOMGRAPHICS_1\"            \n",
      " [7] \"NODE_CUSTOMGRAPHICS_2\"             \"NODE_CUSTOMGRAPHICS_3\"            \n",
      " [9] \"NODE_CUSTOMGRAPHICS_4\"             \"NODE_CUSTOMGRAPHICS_5\"            \n",
      "[11] \"NODE_CUSTOMGRAPHICS_6\"             \"NODE_CUSTOMGRAPHICS_7\"            \n",
      "[13] \"NODE_CUSTOMGRAPHICS_8\"             \"NODE_CUSTOMGRAPHICS_9\"            \n",
      "[15] \"NODE_CUSTOMGRAPHICS_POSITION_1\"    \"NODE_CUSTOMGRAPHICS_POSITION_2\"   \n",
      "[17] \"NODE_CUSTOMGRAPHICS_POSITION_3\"    \"NODE_CUSTOMGRAPHICS_POSITION_4\"   \n",
      "[19] \"NODE_CUSTOMGRAPHICS_POSITION_5\"    \"NODE_CUSTOMGRAPHICS_POSITION_6\"   \n",
      "[21] \"NODE_CUSTOMGRAPHICS_POSITION_7\"    \"NODE_CUSTOMGRAPHICS_POSITION_8\"   \n",
      "[23] \"NODE_CUSTOMGRAPHICS_POSITION_9\"    \"NODE_CUSTOMGRAPHICS_SIZE_1\"       \n",
      "[25] \"NODE_CUSTOMGRAPHICS_SIZE_2\"        \"NODE_CUSTOMGRAPHICS_SIZE_3\"       \n",
      "[27] \"NODE_CUSTOMGRAPHICS_SIZE_4\"        \"NODE_CUSTOMGRAPHICS_SIZE_5\"       \n",
      "[29] \"NODE_CUSTOMGRAPHICS_SIZE_6\"        \"NODE_CUSTOMGRAPHICS_SIZE_7\"       \n",
      "[31] \"NODE_CUSTOMGRAPHICS_SIZE_8\"        \"NODE_CUSTOMGRAPHICS_SIZE_9\"       \n",
      "[33] \"NODE_CUSTOMPAINT_1\"                \"NODE_CUSTOMPAINT_2\"               \n",
      "[35] \"NODE_CUSTOMPAINT_3\"                \"NODE_CUSTOMPAINT_4\"               \n",
      "[37] \"NODE_CUSTOMPAINT_5\"                \"NODE_CUSTOMPAINT_6\"               \n",
      "[39] \"NODE_CUSTOMPAINT_7\"                \"NODE_CUSTOMPAINT_8\"               \n",
      "[41] \"NODE_CUSTOMPAINT_9\"                \"NODE_DEPTH\"                       \n",
      "[43] \"NODE_FILL_COLOR\"                   \"NODE_HEIGHT\"                      \n",
      "[45] \"NODE_LABEL\"                        \"NODE_LABEL_COLOR\"                 \n",
      "[47] \"NODE_LABEL_FONT_FACE\"              \"NODE_LABEL_FONT_SIZE\"             \n",
      "[49] \"NODE_LABEL_POSITION\"               \"NODE_LABEL_TRANSPARENCY\"          \n",
      "[51] \"NODE_LABEL_WIDTH\"                  \"NODE_NESTED_NETWORK_IMAGE_VISIBLE\"\n",
      "[53] \"NODE_PAINT\"                        \"NODE_SELECTED\"                    \n",
      "[55] \"NODE_SELECTED_PAINT\"               \"NODE_SHAPE\"                       \n",
      "[57] \"NODE_SIZE\"                         \"NODE_TOOLTIP\"                     \n",
      "[59] \"NODE_TRANSPARENCY\"                 \"NODE_VISIBLE\"                     \n",
      "[61] \"NODE_WIDTH\"                        \"NODE_X_LOCATION\"                  \n",
      "[63] \"NODE_Y_LOCATION\"                   \"NODE_Z_LOCATION\"                  \n"
     ]
    }
   ],
   "source": [
    "# Get node visual propeties\n",
    "all_visual_propeties = getDirectlyModifiableVisualProperties(cw)\n",
    "\n",
    "# Show it\n",
    "print(all_visual_propeties[grep(\"^NODE.*\", all_visual_propeties)])"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Get edge visual propeties\n",
    "---------------------------------------"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      " [1] \"EDGE\"                               \"EDGE_BEND\"                         \n",
      " [3] \"EDGE_CURVED\"                        \"EDGE_LABEL\"                        \n",
      " [5] \"EDGE_LABEL_COLOR\"                   \"EDGE_LABEL_FONT_FACE\"              \n",
      " [7] \"EDGE_LABEL_FONT_SIZE\"               \"EDGE_LABEL_TRANSPARENCY\"           \n",
      " [9] \"EDGE_LABEL_WIDTH\"                   \"EDGE_LINE_TYPE\"                    \n",
      "[11] \"EDGE_PAINT\"                         \"EDGE_SELECTED\"                     \n",
      "[13] \"EDGE_SELECTED_PAINT\"                \"EDGE_SOURCE_ARROW_SELECTED_PAINT\"  \n",
      "[15] \"EDGE_SOURCE_ARROW_SHAPE\"            \"EDGE_SOURCE_ARROW_UNSELECTED_PAINT\"\n",
      "[17] \"EDGE_STROKE_SELECTED_PAINT\"         \"EDGE_STROKE_UNSELECTED_PAINT\"      \n",
      "[19] \"EDGE_TARGET_ARROW_SELECTED_PAINT\"   \"EDGE_TARGET_ARROW_SHAPE\"           \n",
      "[21] \"EDGE_TARGET_ARROW_UNSELECTED_PAINT\" \"EDGE_TOOLTIP\"                      \n",
      "[23] \"EDGE_TRANSPARENCY\"                  \"EDGE_UNSELECTED_PAINT\"             \n",
      "[25] \"EDGE_VISIBLE\"                       \"EDGE_WIDTH\"                        \n"
     ]
    }
   ],
   "source": [
    "# Get edge visual propeties\n",
    "all_visual_propeties = getDirectlyModifiableVisualProperties(cw)\n",
    "\n",
    "# Show it\n",
    "print(all_visual_propeties[grep(\"^EDGE.*\", all_visual_propeties)])"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Get network visual propeties\n",
    "---------------------------------------"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      " [1] \"NETWORK\"                   \"NETWORK_BACKGROUND_PAINT\" \n",
      " [3] \"NETWORK_CENTER_X_LOCATION\" \"NETWORK_CENTER_Y_LOCATION\"\n",
      " [5] \"NETWORK_CENTER_Z_LOCATION\" \"NETWORK_DEPTH\"            \n",
      " [7] \"NETWORK_EDGE_SELECTION\"    \"NETWORK_HEIGHT\"           \n",
      " [9] \"NETWORK_NODE_SELECTION\"    \"NETWORK_SCALE_FACTOR\"     \n",
      "[11] \"NETWORK_SIZE\"              \"NETWORK_TITLE\"            \n",
      "[13] \"NETWORK_WIDTH\"            \n"
     ]
    }
   ],
   "source": [
    "# Get network visual propeties\n",
    "all_visual_propeties = getDirectlyModifiableVisualProperties(cw)\n",
    "\n",
    "# Show it\n",
    "print(all_visual_propeties[grep(\"^NETWORK.*\", all_visual_propeties)])"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Create original Style and apply it\n",
    "---------------------------------------\n",
    "\n",
    "Now, we know the all of the visual propeties, so let's create your original style and apply it."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Create original Style\n",
    "---------------------------------------\n",
    "\n",
    "To create original style, the first step is to create style object. Then, add the value to each visual propeties that you want to change from default."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Apply original style\n",
    "---------------------------------------"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": true
   },
   "source": [
    "# Create passthrough mapping\n",
    "---------------------------------------\n",
    "\n",
    "The \"passthrough\" means that vizual propetiy connect with the table column. So, if you set the 'NODE_LABEL' in visual propety as 'lable' data of the table's column, you can bind these data and will appear it as graph in Cytoscape."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Create continuous mapping\n",
    "---------------------------------------\n",
    "\n",
    "The continuous mapping is to map the network value to visual style. For example, you can map the color gradient from the node value."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Create descrete mapping \n",
    "---------------------------------------\n",
    "\n",
    "The descrete mapping is to map the network value to visual style. For example, you can map the color from the edge value and change the edge color by the edge's value."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "R",
   "language": "R",
   "name": "ir"
  },
  "language_info": {
   "codemirror_mode": "r",
   "file_extension": ".r",
   "mimetype": "text/x-r-source",
   "name": "R",
   "pygments_lexer": "r",
   "version": "3.2.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}

{'fraction_non_alphanumeric': 0.2081186244610369, 'fraction_numerical': 0.012935114102429278, 'mean_word_length': 1.6129327715698847, 'pattern_counts': {'":': 273, '<': 62, '<?xml version=': 0, '>': 42, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2222213', 'n_tokens_mistral': 10402, 'n_tokens_neox': 9976, 'n_words': 1898}