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


WikiPathways is a database of biological pathways maintained by and for the scientific community. Each pathway model in the database is annotated with database identifiers, which can be used for computation and data visualization.

The following workflow describes pathway import and data visualization.

Installation

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

Required software

RCy3 works by connecting with Cytoscape. You will need to install and launch Cytoscape:

cytoscapePing()

For this vignette, you’ll need the following apps:

#available in Cytoscape 3.7.0 and above
installApp('WikiPathways')

Import Cell Cycle pathway into Cytoscape.

RCy3::commandsRun('wikipathways import-as-pathway id=WP179')

The data we will be using for this workflow (E-GEOD-68086.csv) is from a study investigating the RNA-seq signatures of platelets from patients with various types of cancer, in an effort to develop a platelet-based diagnostic (Best et el., 2015). The data was downloaded from Expression Atlas.

df <- read.csv(file="https://cytoscape.github.io/cytoscape-tutorials/protocols/data/E-GEOD-68086.csv", stringsAsFactors = FALSE)

RCy3::loadTableData(df, data.key.column = "Gene.ID", table.key.column = "Ensembl" )

Data Visualization: Node Fill Color

We now have the data in Cytoscape, linked to the pathway, and ready to map to visual properties of the nodes in the network. For this workflow, we will choose data from one of the cancer types, “breast carcinoma”, and visualize the fold change as Node Fill Color.

RCy3::setNodeColorMapping('X.breast.carcinoma..vs..normal...foldChange', colors=paletteColorBrewerRdBu, style.name="WikiPathways")

Data Visualization: Node Border Width

We also have a significance measure for the fold change, which we can add to our visualization. For this, we will use both Node Border Width and Node Border Color to visualize the p value. Let’s start with Node Border Width:

RCy3::setNodeBorderWidthMapping('X.breast.carcinoma..vs..normal..pValue', table.column.values=c(0,0.05), widths=c(5,5,1,1), mapping.type='c', style.name="WikiPathways")

Data Visualization: Node Border Color

Significant genes now have a thicker node border, but we can also add color to further visualize significant nodes. We will set the default Node Border Color to dark grey, then update the Node Border Color for significant nodes to pink:

RCy3::setNodeBorderColorDefault('#5A5A5A',style.name="WikiPathways")

RCy3::setNodeBorderColorMapping('X.breast.carcinoma..vs..normal..pValue', c(0, 0.05,0.05), c('#FC0FC0', '#FC0FC0', '#5A5A5A'), mapping.type='c', style.name="WikiPathways")

We now have our example data visualized on the pathway, with fold change represented as a gradient node fill color and significance as node border color/width.

Saving and Exporting Data Visualization

RCy3::saveSession('wikipathway-data-visualization-basic')
RCy3::exportImage('wikipathway-data-visualization-basic', type = "png")
LS0tCnRpdGxlOiAiV2lraVBhdGh3YXlzIERhdGEgVmlzdWFsaXphdGlvbiBCYXNpYyIKYXV0aG9yOiAiWWloYW5nIFhpbiwgS3Jpc3RpbmEgSGFuc3BlcnMgYW5kIEFsZXggUGljbyIKb3V0cHV0OgogIGh0bWxfZG9jdW1lbnQ6CiAgICBkZl9wcmludDogcGFnZWQKICBodG1sX25vdGVib29rOgogICAgdG9jX2Zsb2F0OiB5ZXMKICAgIGNvZGVfZm9sZGluZzogbm9uZQotLS0KYGBge3IsIGVjaG8gPSBGQUxTRX0Ka25pdHI6Om9wdHNfY2h1bmskc2V0KAogIGV2YWw9RkFMU0UKKQpgYGAKKlRoZSBSIG1hcmtkb3duIGlzIGF2YWlsYWJsZSBmcm9tIHRoZSBwdWxsZG93biBtZW51IGZvciogQ29kZSAqYXQgdGhlIHVwcGVyLXJpZ2h0LCBjaG9vc2UgIkRvd25sb2FkIFJtZCIsIG9yIFtkb3dubG9hZCB0aGUgUm1kIGZyb20gR2l0SHViXShodHRwczovL3Jhdy5naXRodWJ1c2VyY29udGVudC5jb20vY3l0b3NjYXBlL2N5dG9zY2FwZS1hdXRvbWF0aW9uL21hc3Rlci9mb3Itc2NyaXB0ZXJzL1Ivbm90ZWJvb2tzL1dpa2lwYXRod2F5cy1kYXRhLXZpc3VhbGl6dGlvbi1iYXNpYy5SbWQpLioKCjxociAvPgoKV2lraVBhdGh3YXlzIGlzIGEgZGF0YWJhc2Ugb2YgYmlvbG9naWNhbCBwYXRod2F5cyBtYWludGFpbmVkIGJ5IGFuZCBmb3IgdGhlIHNjaWVudGlmaWMgY29t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