General instructions (read before running the code snippets)

In this second workflow, we will create a protein-protein interaction network of the up- and down-regulated genes in the different pancreatic cancer subtypes. Afterwards, we will extend the network with gene-pathway associations to see in which pathways the differentially expressed genes are present in.


Setup

Loading libraries

options(connectionObserver = NULL)

library(dplyr)
library(rWikiPathways)
library(RCy3)
library(RColorBrewer)
library(rstudioapi)
library(readr)
setwd(dirname(getActiveDocumentContext()$path))

Load differential gene expression dataset

Make sure you ran workflow 1 beforehand, so the differential gene expression file has been generated.

We take the series 1 from the following dataset (NHBE mock treated versus SARS-CoV-2 infected): * https://www.ncbi.nlm.nih.gov/geo/query/acc.cgi?acc=GSE147507

which is related to the following publication:

Blanco-Melo, Daniel, et al. “Imbalanced host response to SARS-CoV-2 drives development of COVID-19.” Cell 181.5 (2020): 1036-1045.

dataset <- read.delim("data/GSE71729-dataset.txt")

# filter genes without Entrez Gene identifier
data.panc <- dataset %>% tidyr::drop_na(Entrez.Gene)
colnames(data.panc)[2] <- "GeneName"
colnames(data.panc)[1] <- "GeneId"

deg.basal <- unique(data.panc[!is.na(data.panc$B_P.Value) & data.panc$B_P.Value < 0.05 & abs(data.panc$B_logFC) > 0.58,c(1,2)])

deg.classical <- unique(data.panc[!is.na(data.panc$C_P.Value) & data.panc$C_P.Value < 0.05 & abs(data.panc$C_logFC) > 0.58,c(1,2)])

PPI network analysis

Next, we will create a protein-protein interaction network with all differentially expressed genes using the STRING database.

commandsRun(paste0('string protein query cutoff=0.9 newNetName="PPI network" query="',query,'" limit=0'))
[1] "Loaded network 'STRING network - PPI network' with 724 nodes and 603 edges"

Let’s explore the network

  • Q1: How many of the differentially expressed genes were found in STRING?
  • Q2: Are all genes connected in the network?
  • Q3: Change the confidence cutoff in the commandsRun call from 0.9 (high confidence) to 0.4 (medium confidence). What changes?

Data visualization

Use the same visualization you created in workflow 1 to visualize the gene expression data on the network.

#RCy3::installApp("enhancedGraphics")
RCy3::copyVisualStyle("default", "my_style_heatmap")
RCy3::setNodeLabelMapping("display name", style.name = "my_style_heatmap")
NULL
RCy3::setNodeCustomHeatMapChart(c("B_logFC","C_logFC"), slot = 2, style.name = "my_style_heatmap", colors = c("#CC3300","#FFFFFF","#6699FF","#CCCCCC"))

RCy3::setVisualStyle("my_style_heatmap")
                message 
"Visual Style applied." 

Interpretation

  • Q4: Do you see clusters of up- or down-regulated genes in the PPI network?

Pathway information

Next, we will add information about participation of the differentially expressed genes in molecular pathway models.

# run CyTargetLinker

wp <- file.path(getwd(), "data/wikipathways-hsa-20200710.xgmml")

commandsRun(paste0('cytargetlinker extend idAttribute="query term" linkSetFiles="', wp, '"'))
commandsRun('cytargetlinker applyLayout network="current"')
commandsRun('cytargetlinker applyVisualstyle network="current"')
RCy3::setNodeLabelMapping("display name", style.name="CyTargetLinker")

# there is an issue in the latest version with visualization of the added edges - the workaround below solves this for now
RCy3::cloneNetwork()
RCy3::setVisualStyle("default")
RCy3::setVisualStyle("CyTargetLinker")

# TODO: VISUAL STYLE
# adapt the visual style to also show the differential gene expression as the node fill color

Interpretation

  • Q5: How many differentially expressed genes are in at least one of the pathways?
  • Q6: Are the genes also functionally related based on the PPI network?

Save Cytoscape output and session

# Saving output
png.file <- file.path(getwd(), "ppi-network.png")
exportImage(png.file,'PNG', zoom = 500)
cys.file <- file.path(getwd(), "ppi-network.cys")
saveSession(cys.file) 

#comment following line if you want to manipulate the visualization in Cytoscape
RCy3::closeSession(save.before.closing = F)
LS0tDQp0aXRsZTogIlBhbmNDYW5OZXQgLSBXb3JrZmxvdyAyIg0Kb3V0cHV0OiBodG1sX25vdGVib29rDQphdXRob3I6ICJNYXJ0aW5hIFN1bW1lci1LdXRtb24iDQpkYXRlOiAiMSBTZXB0ZW1iZXIgMjAyMSINCnZlcnNpb246IDEuMA0KbGljZW5zZTogIk1JVCBMaWNlbnNlIg0KLS0tDQoNCiMgR2VuZXJhbCBpbnN0cnVjdGlvbnMgKHJlYWQgYmVmb3JlIHJ1bm5pbmcgdGhlIGNvZGUgc25pcHBldHMpDQpJbiB0aG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