-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathTranscriptomicsNetworks.Rmd
More file actions
136 lines (96 loc) · 4.06 KB
/
Copy pathTranscriptomicsNetworks.Rmd
File metadata and controls
136 lines (96 loc) · 4.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
---
title: "Cutoff Optimization Results"
output:
flexdashboard::flex_dashboard:
orientation: rows
social: menu
runtime: shiny
---
```{r setup, include=FALSE}
library(shiny)
library(visNetwork)
library(igraph)
library(dplyr)
library(ggplot2)
# load optimization results and network data
load("data/TranscriptomicsNetworkData.Rds")
# define cutoff vector
cut_vec <- (0:100)/100
```
Sidebar {.sidebar data-width=350}
=====================================
This page allows to explore the cutoff optimization results for all TCGA transcriptomics pathways considered.
After selecting a pathway from the drop-down menu below, the results will be automatically visualized in the two tabs ("_Networks_", "_Optimization Curve_").
_**Networks** tab_: statistical FDR 0.05 partial correlation network (upper left), the optimized partial correlation network (upper right), the reference network used for optimization based on STRING (lower left), and the reference network used for validation based on CORUM (lower right). Black edges indicate connections found in the STRING training adjacency, green edges indicate connections found in the CORUM testing adjacency, while gray edges indicate false positives.
_**Optimization Curve** tab_: cutoff optimization results with 100 bootstrap samples. The line indicates the median of the bootstrap, and the error bars indicate the 95% confidence intervals. The red dashed line indicated the multiple testing corrected significance threshold (3.21e-05).
```{r}
selectInput('pws', 'Pathway', sort(names(net_data)), selected = "Axon guidance")
```
Networks
=====================================
Row
-------------------------------------
### Statistical Network (FDR 0.05)
```{r}
renderVisNetwork(
{
visNetwork(nodes=net_data[[input$pws]]$nn_fdr, edges = net_data[[input$pws]]$ee_fdr) %>%
visIgraphLayout(layout = "layout.norm", layoutMatrix = as.matrix(net_data[[input$pws]]$Coords[,1:2])) %>%
return
})
```
### String-Optimized Network
```{r}
renderVisNetwork(
{
visNetwork(nodes=net_data[[input$pws]]$nn_opt, edges = net_data[[input$pws]]$ee_opt) %>%
visIgraphLayout(layout = "layout.norm", layoutMatrix = as.matrix(net_data[[input$pws]]$NetCoords_opt[,2:3])) %>%
return
})
```
Row
-------------------------------------
### Training Adjacency - STRING
```{r}
renderVisNetwork(
{
visNetwork(nodes=net_data[[input$pws]]$nn_s, edges = net_data[[input$pws]]$ee_s) %>%
visIgraphLayout(layout = "layout.norm", layoutMatrix = as.matrix(net_data[[input$pws]]$NetCoords_s[,2:3])) %>%
return
})
```
### Testing Adjacency - CORUM
```{r}
renderVisNetwork(
{
visNetwork(nodes=net_data[[input$pws]]$nn_c, edges = net_data[[input$pws]]$ee_c) %>%
visIgraphLayout(layout = "layout.norm", layoutMatrix = as.matrix(net_data[[input$pws]]$NetCoords_c[,2:3])) %>%
return
})
```
Optimization Curve
=====================================
```{r}
data_plot <- reactive({
as.data.frame(cbind(cut_vec=cut_vec, data[[input$pws]]$res_opt$res_adjl$s$ntw_cut_offs_ps[-c(1:4),]))
})
renderPlot({
p <- ggplot(data_plot(), aes(x=cut_vec, y=-M))+
geom_errorbar(aes(ymin=-U, ymax=-L),color="grey50")+
geom_line(size=1) +
xlab("Partial correlation cutoff")+
ylab("-log10(Fisher's p-value)")+
theme_light(base_size=10) +
theme(strip.text = element_text(size=6))+
geom_vline(aes(xintercept=m0,
linetype=rownames(data[[input$pws]]$res_opt$res_adjl$s$stat_cutoffs)),
data=as.data.frame(data[[input$pws]]$res_opt$res_adjl$s$stat_cutoffs))+
scale_linetype_manual(values=c(3,4,2,1),
name="Statistical cutoffs",
breaks=c("fdr_0.05","fdr_0.01","bonf_0.05","bonf_0.01"),
labels=c("FDR 0.05", "FDR 0.01", "Bonf 0.05", "Bonf 0.01")) +
geom_hline(yintercept = -log10(0.01/length(data)), color ="red", linetype="dashed",size=0.5)+
ggtitle("Cutoff optimization based on the STRING adjacency")
print(p)
})
```