The R markdown is available from the pulldown menu for Code at the upper-right, choose “Download Rmd”, or download the Rmd from GitHub.


This vignette will introduce you to some techniques for filtering a network based on node properties. You will learn to:

  1. Select a set of nodes based on node degree and attribute filters
  2. Create a subnetwork based on selected nodes
  3. Hide a set of nodes based on filters

For this tutorial, we will use data from the STRING database (https://string-db.org/).

Installation

if(!"RCy3" %in% installed.packages()){
    install.packages("BiocManager")
    BiocManager::install("RCy3")
}
library(RCy3)

Prerequisites

In addition to this package (RCy3), you will need:

  • Cytoscape 3.7 or greater, which can be downloaded from https://cytoscape.org/download.html. Simply follow the installation instructions on screen.
  • Complete installation wizard
  • Install the STRING app:
installApp('STRINGapp')  

Get network from STRING

We are going to query the STRING Disease database for the term “breast cancer”. By default, the app pulls the top 100 human proteins associated with the disease along with edges having an evidence strength of 0.4 or greater:

string.cmd = 'string disease query disease="breast cancer"'
commandsRun(string.cmd)
string.net<-getNetworkSuid()  #grab handle on network for future reference

Filtering by degree

Creating a degree filter

Every node in a network has a Degree property, which corresponds to the number of edges connecting the node to other nodes, either as a target or source. Filtering based on node degree is a useful way to remove nodes with too few (or too many) connections.

In this example we want to exclude low degree nodes, e.g., those with only 0, 1 or 2 connections:

createDegreeFilter('degree filter', c(0,2), 'IS_NOT_BETWEEN')

At the bottom of the Select tab, you can see how many edges/nodes where selected.

Creating a subnetwork from a selection

We can now create a new network, or subnetwork, from our selected set of nodes and all relevant edges:

createSubnetwork(subnetwork.name ='Breast cancer: highly connected nodes')