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.

This workflow describes how to work with multiple WikiPathways pathways in Cytoscape, specifically how to visualize multiple data points on a set of pathways of interest. This analysis assumes that we already have a list of pathways of interest. This list could come from enrichment analysis, but could also be a list of pathways of interest from prior knowledge.

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.

If you are continuing from the previous workflow, make sure the session is saved and then select File → Close Session to start from scratch.

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 pathways into Cytoscape.

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

The 4 pathways will be listed as separate network collections in the Network Panel.

Data Import

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

RCy3::getNetworkList()
RCy3::loadTableData(df, data.key.column = "Gene.ID", table.key.column = "Ensembl", network = RCy3::getNetworkList()[1] )

RCy3::loadTableData(df, data.key.column = "Gene.ID", table.key.column = "Ensembl", network = RCy3::getNetworkList()[2] )

RCy3::loadTableData(df, data.key.column = "Gene.ID", table.key.column = "Ensembl", network = RCy3::getNetworkList()[3] )

RCy3::loadTableData(df, data.key.column = "Gene.ID", table.key.column = "Ensembl", network = RCy3::getNetworkList()[4] )

Each network should now have multiple extra columns corresponding to fold change and p-value for several cancer types.

Data Visualization: Node Fill Color

To visualize the data on the pathways, we are going to use Cytoscape’s built-in function for Custom Graphics to visualize the fold change values for three cancer types: breast carcinoma, pancreatic adenocarcinoma and colorectal carcinoma. For this particular workflow, the visualized data points should be of the same type, for example fold changes.

RCy3::setNodeCustomHeatMapChart(c('X.pancreatic.adenocarcinoma..vs..normal...foldChange','X.colorectal.carcinoma..vs..normal...foldChange','X.breast.carcinoma..vs..normal...foldChange'), colors=c('#FF0000','#FFFFFF','#0000FF','#FFFFFF'), style.name="WikiPathways")

The three data points are now visualized as vertical stripes, each with a gradient from blue-red for fold change. Note that for this particular graphic (heatmap with horizontal orientation), the data points are displayed in the opposite order from how they were listed in the Custom Graphics interface, so in this case from left to right it is showing pancreatic adenocarcinoma vs normal, colorectal carcinoma vs normal and breast carcinoma vs normal. # Saving and Exporting Data Visualization

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