Tutorial:Filtering and Editing in Cytoscape 3

From OpenTutorials
Revision as of 18:51, 3 November 2015 by KristinaHanspers (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search


Slideshow Filtering and Editing in Cytoscape 3
Handout Filtering and Editing in Cytoscape 3


This tutorial will introduce you to some techniques for filtering and editing a network in Cytoscape:

  • Apply filters to remove low-confidence edges.
  • Perform basic network edits.

Prerequisites

This tutorial features the following data:

Before starting, download these data sets to your computer by right-clicking on the links to the files and saving them.

Loading a network and attributes

  • Launch Cytoscape.
  • Load the STELZ.sif network file by going to the File menu on the Cytoscape desktop, then select Import → Network → File..., and specifying the location you have downloaded the file to. Click OK for the Import Network dialog.
  • Load the node attribute file STELZ.txt by going to File → Import → Table → File....
  • In the Preview section of the import dialog, while holding down the Command key, click on the Gene ID column header. (On Windows, simply right-click.) This will open the Set Column Name and Type dialog.
  • Set the Column Type to "String" and click OK to exit. Click OK to import the data.
  • Generate a yFiles organic layout for your network.

Your network should now look like this:

Filters fig1.png
  • In the Node Table tab of the Table Panel, click on the Show Columns Showcolumn.png button.
  • Notice the attribute named Official HUGO Symbol, which should be selected by default. If it is not, select this attribute by clicking on it with the left mouse button. Exit the menu with the right mouse button.
  • Select some nodes on the Cytoscape canvas. You should now see their IDs (Entrez gene IDs, in this case), and their official HUGO gene names.

Filtering the network

Your interactions in your network has evidence from varying sources: high-confidence yeast two-hybrid interactions(lacz4) and low-confidence yeast two-hybrid interactions(sd4), coAP and GST pull-down interactions, and supporting evidence of interaction reported in literature. Verify this by examining the edge types under the Edge Table. We will now use Cytoscape's filters to remove some lower-confidence edges.

  • Click on the Select tab of the Control Panel.
  • In the Select tab, click on the drop-down to the right and select Create New Filter. Enter a name for your filter, for example high-confidence.
  • Click the + (add) button and select Column Filter. In the Choose column... drop-down, select Edge:interaction.
  • In the second drop-down, select is not and type SD4 in the text box. This will select all interactions, except those with the lower-confidence SD4 evidence.
SelectTab.png

The filter will be automatically applied by default. At the bottom of the Select tab, you can see how many edges/nodes where selected.

  • A set of 2230 edges have been selected in your network. Your network should now look like this:
Filters fig2.png
  • At this point, only the relevant edges are selected. To also select the connected nodes, go to Select → Nodes → Nodes connected by selected edges.
  • Create a new network from the selection under File → New → Network → From selected nodes, selected edges.
  • Your Cytoscape window should now appear as shown:
Filters fig3.png

Compared to the network you started with, the network you have now has fewer edges, but all the edges are determined through by higher-confidence experimentation or by literature-based methods. For some types of analysis, this is a more appropriate set of edges.

Note that this will not filter out nodes that only have self-edges. But at this point, such nodes are easy to select with the mouse and delete.

Choosing nodes based on adjacent nodes

It's often important to select a node based on properties of the nodes it connects to, not based on the properties of the node or an edge itself. For the sake of illustration, the STELZL data has a column tagging a node as "suspicious", as judged from some process outside of Cytoscape. In this tutorial, we show how to identify "non-suspicious" genes connected to at least three "suspicious" nodes in three steps:

  1. Select all suspicious nodes and any nodes they connect to
  2. Remove any non-suspicious nodes that connect to fewer than three suspicious nodes
  3. Remove any suspicious nodes that connect only to other suspicious nodes

To select suspicious nodes and all nodes they connect to:

  • Click inside of the original (unfiltered) view you created during the last example.
  • Click Edit → Remove Duplicated Edges to eliminate multiple links between suspicious and non-suspicious nodes. Select your network (STELZL.sif) and check the Ignore edge direction box, then click OK. Also click OK for the resulting delete message.
  • Click on the Select tab of the Control Panel.
  • In the Select tab, click on the drop-down to the right and select Create New Filter. Enter a name for your filter, for example, Suspicious nodes and neighbors.
  • Click the + (add) button and select Column Filter. In the Choose column... drop-down, select Node:Suspicous.
  • In the second drop-down, select is true.
  • Select edges connecting suspicious nodes Select → Edges → Select adjacent edges.
  • Create a new network (below) consisting of suspicious nodes and their (suspicious and non-suspicious) neighbors: File -> New -> From selected nodes, selected edges
Suspicious.png

To remove all non-suspicious nodes that connect to fewer than three suspicious nodes:

  • In the Select tab, click on the drop-down to the right and select Create New Filter. Enter a name for your filter, for example, Eliminate sparse non-suspicious nodes.
  • Click the + (add) button and select Degree Filter. Set the range to between 0 and 2.
  • Click the + (add) button and select Column Filter. Select Node:Suspicious and choose is false on the drop-down.
  • Remove the non-suspicious nodes that aren't sufficiently connected: Edit → Delete Selected Nodes and Edges....
Nonsuspicious.png

To remove the suspicious nodes that aren't connected to non-suspicious nodes:

  • In the Select tab, click on the drop-down to the right and select Create New Filter. Enter a name for your filter, for example, Eliminate superfluous suspicious nodes.
  • Click the + (add) button and select Column Filter. Select Node:Suspicious and choose is false on the drop-down.
  • Select edges connecting suspicious nodes Select → Edges → Select adjacent edges.
  • Create a new network consisting of suspicious nodes and their (suspicious and non-suspicious) neighbors: File → New → From selected nodes, selected edges

The new network has only non-suspicious nodes that connect to three or more suspicious nodes, and the non-suspicious nodes are highlighted.

Suspicious3.png

You can learn how to lay out and color your network in another tutorial. The layout below shows suspicious nodes in red and non-suspicious nodes in green -- note that each non-suspicious node connects to a minimum of 3 suspicious nodes and no other non-suspicious nodes, per our filters. (Hint: You can get the layout below by using the Layout → yFiles Layouts → Organic layout on the network in the picture above.)

Suspicious3Final.png

Editing

At times, it can be very useful to modify a network slightly: to add or remove nodes or edges. For instance, if you have prior knowledge of some biological process, you might want to add some nodes for proteins that you know are involved in the process, but that don't appear in your data set.

All network editing functions are available in a right-click context menu in the Network View Window.

  • To add a node, right-click anywhere in the Network View Window and select Add → Node.
  • Select the node with your mouse. In the Node Table, you should see a node with the shared name Node 1.
  • Give your new node a name by clicking on the entry in the Node Table, and entering a name under the column labeled Official HUGO Symbol.
  • To add an edge to the node, right-click on the node and choose Edit → Add Edge. Drag the end of the newly created edge to another node in the network, and click to attach it.

It is also possible to add nodes and interactions in a sif format.

  • Locate the CPNE6 gene using the Search interface. Note the gene ID, 9362.
  • We are going to add a known interaction between CPNE6 and GRB7, Entrez ID 2886. With the CPNE6 gene in focus (not selected), right-click anywhere in the Network View Window and select Add → Edge (and possibly Nodes) using SIF....
  • In the SIF Interpreter dialog, enter 2886 interacts 9362 and click OK. You should see the new node with id 2886 connected to CPNE6.

Congratulations! You are now finished the advanced course in Cytoscape menu operation.