Strict Standards: Declaration of Doku_Renderer_metadata::table_open() should be compatible with Doku_Renderer::table_open($maxcols = NULL, $numrows = NULL, $pos = NULL) in /home2/cp-wiki/htdocs/inc/parser/metadata.php on line 24

Strict Standards: Declaration of Doku_Renderer_metadata::table_close() should be compatible with Doku_Renderer::table_close($pos = NULL) in /home2/cp-wiki/htdocs/inc/parser/metadata.php on line 24

Warning: Cannot modify header information - headers already sent by (output started at /home2/cp-wiki/htdocs/inc/parser/metadata.php:24) in /home2/cp-wiki/htdocs/inc/actions.php on line 581

Warning: Cannot modify header information - headers already sent by (output started at /home2/cp-wiki/htdocs/inc/parser/metadata.php:24) in /home2/cp-wiki/htdocs/inc/actions.php on line 581
cs190c:cytoscape_tutorial
Table of Contents

Brief Cytoscape Tutorial on Visualizing Graphs

Before using Cytoscape, download it from http://www.cytoscape.org/download.php?file=cyto2_5_2 and install it.

Consider the graph given by the example edge list:

1 2
1 3
2 4
4 1
3 4
3 5
5 4
4 6
6 7
7 6
6 8
8 9
9 10
10 8
11 9
16 11
16 15
15 12
12 16
11 12
11 13
15 14
14 13
13 12
13 14

Save it in a text file named fig1.txt (make sure there are no empty lines after the last line).

Viewing a Graph

Open Cytoscape. In the File menu, find File→Import→Network from Table. You will be presented with a window similar to the following:

Import the file using “Select File”.

After the import, take a look at the dropdown boxes that are selected for “Column 1” and “Column 2”. This is important as it tells Cytoscape which column contains what kind of data. After importing the graph, you should see

The graph is drawn with default values which is not attractive and has some problems. Tthe layout simply fits on a grid and the graph looks somewhat disorganized. Also, the edges shown have no directions.

To show the directions of the edges (as present in the input), find the “VizMapper” tab in the left window pane. Click on the image of the two nodes with an edge between them. You should get a window similar to the following:

Find the edge tab on the right pane and then choose an appropriate arrow for EDGE_TGTARROW_SHAPE by clicking it and selecting one. Click apply to apply the new style. Going back to the main graph, we now see the directions on the edges.

There exist a number of ways to generate better layouts. As an example, in the layout menu select Layout→yFiles→Circular. If you have done this correctly, you should see:

Notice that Cytoscape lets you can interact with the layout by clicking and dragging nodes around. Depending on the structure and size of a graph, different layouts may yield more useful results.

It is also possible to save the result as an image. To do so, see File→Export→Network view as Graphics. Here you will be given the option to choose among a number of image formats.

Adding node attributes

in the project it is important to note which nodes belong to which clusters. Conveniently, the MCL algorithm gives identical results to the Scc calculation for our example graph (however in general this is not the case). Node attributes can be dumped to a file by using the write_node_attributes function from provided_code.py.

To import this file into Cytoscape, use File→Import→Node attributes. After this, in the VizMapper tab find the “Node Color” item and expand it by clicking the +. On the right, choose clusterId. For Mapping Type choose Discrete Mapper. Next, right click on Node Color and select Generate Discrete Values→Rainbow 1 (or one of the other schemes). If you've done this correctly you should see something like:

Notice that in this part of the project we are working with an undirected graph, so if you are following along after the previous section you will need to go back and disable the arrows.