-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.R
More file actions
501 lines (433 loc) · 25.2 KB
/
build.R
File metadata and controls
501 lines (433 loc) · 25.2 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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
# Create OmicNavigator study from files in the directory data/
library(openxlsx)
library(dplyr)
library(ggplot2)
library(plotly)
library(OmicNavigator)
# Import data from file
phospho <- openxlsx::read.xlsx("data/1-s2.0-S0092867420308114-mmc1.xlsx", sheet=1)
protein_abundance <- openxlsx::read.xlsx("data/1-s2.0-S0092867420308114-mmc1.xlsx", sheet=2)
# Create a new study -----------------------------------------------------------
study <- createStudy("SARSCoV2.proteomic.and.phosphoproteomic.profiling",
"SARS-CoV-2 global proteomic and phosphoproteomic analysis from Bouhaddou et al converted into a multi-omic OmicNavigator study. In this work Vero E6 cells were profiled at six time points following SARS-CoV-2 infection with quantitative mass spectrometry. Protein abundance and phosphorylation levels were estimated from this data. Please click on the analysis details button for more information.",
version = "0.1.0")
# Models -----------------------------------------------------------------------
models <- list(
protein_abundance = "Differential protein abundance analysis in SARS-CoV-2 infected or mock treated Vero E6 cells",
protein_phosphorylation = "Differential protein phosphorylation analysis in SARS-CoV-2 infected or mock treated Vero E6 cells"
)
study <- addModels(study, models)
# Features ---------------------------------------------------------------------
# List of unique uniprot entries in phosphorylation group & having finite nr
cleaned_phospho_features <- which(!duplicated(phospho$C.s.uniprot) &
is.finite(as.numeric(phospho[, 'Ctrl_24Hr.log2FC'])))
cleaned_abundance_features <- which(!duplicated(protein_abundance$C.s.uniprot) &
is.finite(as.numeric(protein_abundance[, 'Ctrl_24Hr.log2FC'])))
# FeatureIDs in the first column are required to be a character vector
# with unique entries
features_phospho <- phospho[, c(4, 1:3, 5, 20:ncol(phospho))]
features_phospho <- features_phospho[cleaned_phospho_features,]
features_phospho <- data.frame(apply(features_phospho, 2, as.character))
features_abundance <- protein_abundance[, c(3, 1:2, 18:ncol(protein_abundance))]
features_abundance <- features_abundance[cleaned_abundance_features,]
features_abundance <- data.frame(apply(features_abundance, 2, as.character))
features <- list(
protein_abundance = features_abundance[1:3],
protein_phosphorylation = features_phospho[1:5]
)
study <- addFeatures(study, features)
# MetaFeatures -----------------------------------------------------------------
metaFeatures <- list(
protein_abundance = features_abundance[, c(1, 4:ncol(features_abundance))],
protein_phosphorylation = features_phospho[, c(1, 6:ncol(features_phospho))]
)
study <- addMetaFeatures(study, metaFeatures)
# Mapping ----------------------------------------------------------------------
phospho_id <- data.frame("C.s.uniprot" = phospho[cleaned_phospho_features, "C.s.uniprot"])
phospho_id$protein_phosphorylation <- phospho_id$C.s.uniprot
abundance_id <- data.frame("C.s.uniprot" = protein_abundance[cleaned_abundance_features, "C.s.uniprot"])
abundance_id$protein_abundance <- abundance_id$C.s.uniprot
mapping <- dplyr::full_join(x = abundance_id, y = phospho_id, by="C.s.uniprot")[,2:3]
mapping <- list(
default = mapping
)
study <- addMapping(study, mapping)
# Results (differential expression) --------------------------------------------
phospho_results <- phospho[cleaned_phospho_features, c(4, 6:19)]
phospho_results <- phospho_results %>% mutate_at(c(2:ncol(phospho_results)), as.numeric)
abundance_results <- protein_abundance[cleaned_abundance_features, c(3, 4:17)]
abundance_results <- abundance_results %>% mutate_at(c(2:ncol(abundance_results)), as.numeric)
# The featureID in the first column must be a character vector
results <- list(
protein_abundance = list(
ctrl24h_vs_ctrl00h = abundance_results[, c('C.s.uniprot', 'Ctrl_24Hr.log2FC', 'Ctrl_24Hr.adj.pvalue')],
inf00h_vs_ctrl00h = abundance_results[, c('C.s.uniprot', 'Inf_00Hr.log2FC', 'Inf_00Hr.adj.pvalue')],
inf02h_vs_ctrl00h = abundance_results[, c('C.s.uniprot', 'Inf_02Hr.log2FC', 'Inf_02Hr.adj.pvalue')],
inf04h_vs_ctrl00h = abundance_results[, c('C.s.uniprot', 'Inf_04Hr.log2FC', 'Inf_04Hr.adj.pvalue')],
inf08h_vs_ctrl00h = abundance_results[, c('C.s.uniprot', 'Inf_08Hr.log2FC', 'Inf_08Hr.adj.pvalue')],
inf12h_vs_ctrl00h = abundance_results[, c('C.s.uniprot', 'Inf_12Hr.log2FC', 'Inf_12Hr.adj.pvalue')],
inf24h_vs_ctrl00h = abundance_results[, c('C.s.uniprot', 'Inf_24Hr.log2FC', 'Inf_24Hr.adj.pvalue')]
),
protein_phosphorylation = list(
ctrl24h_vs_ctrl00h = phospho_results[, c('C.s.uniprot', 'Ctrl_24Hr.log2FC', 'Ctrl_24Hr.adj.pvalue')],
inf00h_vs_ctrl00h = phospho_results[, c('C.s.uniprot', 'Inf_00Hr.log2FC', 'Inf_00Hr.adj.pvalue')],
inf02h_vs_ctrl00h = phospho_results[, c('C.s.uniprot', 'Inf_02Hr.log2FC', 'Inf_02Hr.adj.pvalue')],
inf04h_vs_ctrl00h = phospho_results[, c('C.s.uniprot', 'Inf_04Hr.log2FC', 'Inf_04Hr.adj.pvalue')],
inf08h_vs_ctrl00h = phospho_results[, c('C.s.uniprot', 'Inf_08Hr.log2FC', 'Inf_08Hr.adj.pvalue')],
inf12h_vs_ctrl00h = phospho_results[, c('C.s.uniprot', 'Inf_12Hr.log2FC', 'Inf_12Hr.adj.pvalue')],
inf24h_vs_ctrl00h = phospho_results[, c('C.s.uniprot', 'Inf_24Hr.log2FC', 'Inf_24Hr.adj.pvalue')]
)
)
results$protein_abundance <- lapply(results$protein_abundance, setNames, c('C.s.uniprot', 'log2FC', 'adj.pvalue'))
results$protein_phosphorylation <- lapply(results$protein_phosphorylation, setNames, c('C.s.uniprot', 'log2FC', 'adj.pvalue'))
# sort df by adj pvalue
results$protein_abundance <- lapply(results$protein_abundance, function(x){x[order(x$adj.pvalue),]})
results$protein_phosphorylation <- lapply(results$protein_phosphorylation, function(x){x[order(x$adj.pvalue),]})
study <- addResults(study, results)
# Tests ------------------------------------------------------------------------
# here we can add a description of each test, along with columns
tests <- list(
protein_abundance = list(
ctrl24h_vs_ctrl00h = list(
description = 'Test of differential expression (abundance proteomics) between control 24h and control 0h',
C.s.uniprot = 'Chlorocebus sabaeus Uniprot ID (and viral protein identifiers)',
log2FC = 'Log2 transform of the fold change measured as ratio of intensity in Ctrl_24Hr vs Ctrl_00Hr',
adj.pvalue = 'Adjusted p.value testing the null hypothesis that the log2FC for Ctrl_24Hr vs Ctrl_00Hr is 0.0'
),
inf00h_vs_ctrl00h = list(
description = 'Test of differential expression (abundance proteomics) between infection 00h and control 0h',
C.s.uniprot = 'Chlorocebus sabaeus Uniprot ID (and viral protein identifiers)',
log2FC = 'Log2 transform of the fold change measured as ratio of intensity in Inf_00Hr vs Ctrl_00Hr',
adj.pvalue = 'Adjusted p.value testing the null hypothesis that the log2FC for Inf_00Hr vs Ctrl_00Hr is 0.0'
),
inf02h_vs_ctrl00h = list(
description = 'Test of differential expression (abundance proteomics) between infection 02h and control 0h',
C.s.uniprot = 'Chlorocebus sabaeus Uniprot ID (and viral protein identifiers)',
log2FC = 'Log2 transform of the fold change measured as ratio of intensity in Inf_02Hr vs Ctrl_00Hr',
adj.pvalue = 'Adjusted p.value testing the null hypothesis that the log2FC for Inf_02Hr vs Ctrl_00Hr is 0.0'
),
inf04h_vs_ctrl00h = list(
description = 'Test of differential expression (abundance proteomics) between infection 04h and control 0h',
C.s.uniprot = 'Chlorocebus sabaeus Uniprot ID (and viral protein identifiers)',
log2FC = 'Log2 transform of the fold change measured as ratio of intensity in Inf_04Hr vs Ctrl_00Hr',
adj.pvalue = 'Adjusted p.value testing the null hypothesis that the log2FC for Inf_04Hr vs Ctrl_00Hr is 0.0'
),
inf08h_vs_ctrl00h = list(
description = 'Test of differential expression (abundance proteomics) between infection 08h and control 0h',
C.s.uniprot = 'Chlorocebus sabaeus Uniprot ID (and viral protein identifiers)',
log2FC = 'Log2 transform of the fold change measured as ratio of intensity in Inf_08Hr vs Ctrl_00Hr',
adj.pvalue = 'Adjusted p.value testing the null hypothesis that the log2FC for Inf_08Hr vs Ctrl_00Hr is 0.0'
),
inf12h_vs_ctrl00h = list(
description = 'Test of differential expression (abundance proteomics) between infection 12h and control 0h',
C.s.uniprot = 'Chlorocebus sabaeus Uniprot ID (and viral protein identifiers)',
log2FC = 'Log2 transform of the fold change measured as ratio of intensity in Inf_12Hr vs Ctrl_00Hr',
adj.pvalue = 'Adjusted p.value testing the null hypothesis that the log2FC for Inf_12Hr vs Ctrl_00Hr is 0.0'
),
inf24h_vs_ctrl00h = list(
description = 'Test of differential expression (abundance proteomics) between infection 24h and control 0h',
C.s.uniprot = 'Chlorocebus sabaeus Uniprot ID (and viral protein identifiers)',
log2FC = 'Log2 transform of the fold change measured as ratio of intensity in Inf_24Hr vs Ctrl_00Hr',
adj.pvalue = 'Adjusted p.value testing the null hypothesis that the log2FC for Inf_24Hr vs Ctrl_00Hr is 0.0'
)
),
protein_phosphorylation = list(
ctrl24h_vs_ctrl00h = list(
description = 'Test of differential expression (phosphoproteomics) between control 24h and control 0h',
C.s.uniprot = 'Chlorocebus sabaeus Uniprot ID (and viral protein identifiers)',
log2FC = 'Log2 transform of the fold change measured as ratio of intensity in Ctrl_24Hr vs Ctrl_00Hr',
adj.pvalue = 'Adjusted p.value testing the null hypothesis that the log2FC for Ctrl_24Hr vs Ctrl_00Hr is 0.0'
),
inf00h_vs_ctrl00h = list(
description = 'Test of differential expression (phosphoproteomics) between infection 00h and control 0h',
C.s.uniprot = 'Chlorocebus sabaeus Uniprot ID (and viral protein identifiers)',
log2FC = 'Log2 transform of the fold change measured as ratio of intensity in Inf_00Hr vs Ctrl_00Hr',
adj.pvalue = 'Adjusted p.value testing the null hypothesis that the log2FC for Inf_00Hr vs Ctrl_00Hr is 0.0'
),
inf02h_vs_ctrl00h = list(
description = 'Test of differential expression (phosphoproteomics) between infection 02h and control 0h',
C.s.uniprot = 'Chlorocebus sabaeus Uniprot ID (and viral protein identifiers)',
log2FC = 'Log2 transform of the fold change measured as ratio of intensity in Inf_02Hr vs Ctrl_00Hr',
adj.pvalue = 'Adjusted p.value testing the null hypothesis that the log2FC for Inf_02Hr vs Ctrl_00Hr is 0.0'
),
inf04h_vs_ctrl00h = list(
description = 'Test of differential expression (phosphoproteomics) between infection 04h and control 0h',
C.s.uniprot = 'Chlorocebus sabaeus Uniprot ID (and viral protein identifiers)',
log2FC = 'Log2 transform of the fold change measured as ratio of intensity in Inf_04Hr vs Ctrl_00Hr',
adj.pvalue = 'Adjusted p.value testing the null hypothesis that the log2FC for Inf_04Hr vs Ctrl_00Hr is 0.0'
),
inf08h_vs_ctrl00h = list(
description = 'Test of differential expression (phosphoproteomics) between infection 08h and control 0h',
C.s.uniprot = 'Chlorocebus sabaeus Uniprot ID (and viral protein identifiers)',
log2FC = 'Log2 transform of the fold change measured as ratio of intensity in Inf_08Hr vs Ctrl_00Hr',
adj.pvalue = 'Adjusted p.value testing the null hypothesis that the log2FC for Inf_08Hr vs Ctrl_00Hr is 0.0'
),
inf12h_vs_ctrl00h = list(
description = 'Test of differential expression (phosphoproteomics) between infection 12h and control 0h',
C.s.uniprot = 'Chlorocebus sabaeus Uniprot ID (and viral protein identifiers)',
log2FC = 'Log2 transform of the fold change measured as ratio of intensity in Inf_12Hr vs Ctrl_00Hr',
adj.pvalue = 'Adjusted p.value testing the null hypothesis that the log2FC for Inf_12Hr vs Ctrl_00Hr is 0.0'
),
inf24h_vs_ctrl00h = list(
description = 'Test of differential expression (phosphoproteomics) between infection 24h and control 0h',
C.s.uniprot = 'Chlorocebus sabaeus Uniprot ID (and viral protein identifiers)',
log2FC = 'Log2 transform of the fold change measured as ratio of intensity in Inf_24Hr vs Ctrl_00Hr',
adj.pvalue = 'Adjusted p.value testing the null hypothesis that the log2FC for Inf_24Hr vs Ctrl_00Hr is 0.0'
)
)
)
study <- addTests(study, tests)
# Linkouts to external resources for the results table -------------------------
resultsLinkouts <- list(
protein_abundance = list(
Gene_Name = "https://www.genenames.org/data/gene-symbol-report/#!/symbol/",
C.s.uniprot = "https://www.uniprot.org/uniprotkb/",
H.s.uniprot = c("https://www.uniprot.org/uniprotkb/",
"https://www.phosphosite.org/uniprotAccAction?id=",
"https://www.proteomicsdb.org/proteomicsdb/#protein/search/query?protein_name=")
),
protein_phosphorylation = list(
Gene_Name = "https://www.genenames.org/data/gene-symbol-report/#!/symbol/",
C.s.uniprot = "https://www.uniprot.org/uniprotkb/",
H.s.uniprot = c("https://www.uniprot.org/uniprotkb/",
"https://www.phosphosite.org/uniprotAccAction?id=",
"https://www.proteomicsdb.org/proteomicsdb/#protein/search/query?protein_name=")
)
)
study <- addResultsLinkouts(study, resultsLinkouts)
# Custom plots -----------------------------------------------------------------
x <- getPlottingData(study,
modelID = "protein_abundance",
featureID = c("A0A0D9QUI8"),
testID = c("ctrl24h_vs_ctrl00h", "inf00h_vs_ctrl00h",
"inf02h_vs_ctrl00h", "inf04h_vs_ctrl00h",
"inf08h_vs_ctrl00h", "inf12h_vs_ctrl00h",
"inf24h_vs_ctrl00h"))
head(x)
# Singlefeature + Multitest plot (can also be used as multifeature)
plotMultiTest_singleFeature <- function(x) {
var_x <- data.frame(lapply(x$results, `[`, 2))
colnames(var_x)<- names(x$results)
row.names(var_x) <- as.matrix(lapply(x$results, `[`, 1)[[1]])
var_x <- data.table::data.table(features = rownames(var_x), var_x)
var_x <- data.table::melt(var_x, measure.vars = c(2:ncol(var_x)))
var_y <- data.frame(lapply(x$results, `[`, 3))
colnames(var_y) <- names(x$results)
row.names(var_y) <- as.matrix(lapply(x$results, `[`, 1)[[1]])
var_y <- data.table::data.table(features = rownames(var_y), var_y)
var_y <- data.table::melt(var_y, measure.vars = c(2:ncol(var_y)))
df <- merge(var_x, var_y, by=c("variable", "features"))
colnames(df)[3:4] <- c("log2FC", "adj.pvalue")
cols <- c("darkred", "cadetblue1", "cadetblue2", "cadetblue3", "cadetblue", "cadetblue4", "darkblue")
cols <- cols[1:length(names(x$results))]
plotly::plot_ly(data = df, x = ~variable, y = ~log2FC,
type = "bar",
hoverinfo = 'text',
text = ~paste('adj.pval: ', round(adj.pvalue, 6), '\nlog2FC: ', log2FC),
color = ~variable,
colors = cols) %>%
layout(xaxis = list(title = ''),
title = unique(df$features),
showlegend = FALSE)
}
plotMultiTest_singleFeature(x)
# Singlefeature + Multitest + Multimodel plot
x <- getPlottingData(study,
modelID = c(rep("protein_abundance", 7),
rep("protein_phosphorylation", 7)),
featureID = c("A0A0D9QUI8"),
testID = rep(c("ctrl24h_vs_ctrl00h", "inf00h_vs_ctrl00h",
"inf02h_vs_ctrl00h", "inf04h_vs_ctrl00h",
"inf08h_vs_ctrl00h", "inf12h_vs_ctrl00h",
"inf24h_vs_ctrl00h"), 2)) %>% suppressMessages()
head(x)
plotMultiModel_singleFeature <- function(x) {
mm <- x$mapping[complete.cases(x$mapping),]
models <- names(x)[1:length(names(x))-1]
for (i_models in models) {
testID <- names(x[[i_models]]$results)
for (i_test in testID) {
selected_feats <- which(x[[i_models]]$results[[i_test]][,1] %in% mm[, i_models])
x[[i_models]]$results[[i_test]] <- x[[i_models]]$results[[i_test]][selected_feats,]
log2FC <- x[[i_models]]$results[[i_test]]$log2FC
feat <- x[[i_models]]$results[[i_test]]$C.s.uniprot
pval <- x[[i_models]]$results[[i_test]]$adj.pvalue
if (!exists("gdf")) {
gdf <- data.frame(feature = feat, modelID = i_models, testID = i_test, log2FC = log2FC, adj.pvalue = pval)
} else {
gdf <- rbind(gdf, data.frame(feature = feat, modelID = i_models, testID = i_test, log2FC = log2FC, adj.pvalue = pval))
}
}
}
gdf$cols <- c("darkred", "cadetblue1", "cadetblue2", "cadetblue3", "cadetblue", "cadetblue4", "darkblue")
gdf$groups <- paste(gdf[,"modelID"], gdf[,"testID"], sep = " / ")
gdf$log2FC <- round(gdf$log2FC, 4)
p <- ggplot(data=gdf,
aes(text = paste('adj p.val: ', round(adj.pvalue, 4),
'</br> feature: ', feature),
x = testID, y = log2FC)) +
geom_bar(stat='identity', fill=gdf$cols) +
facet_grid(modelID~.) +
theme(axis.text.x = element_text(angle = 90, vjust = .5),
panel.background = element_blank(),
axis.ticks.x = element_blank(),
panel.grid.major.y = element_line(size = 0.5, linetype = 'solid',
colour = "gray"), )
ggplotly(p)
}
plotMultiModel_singleFeature(x)
# MultiFeature + singleTest + Multimodel plot
mapped_proteins <- study$mapping$default
mapped_proteins <- mapped_proteins[!is.na(mapped_proteins$protein_abundance) & !is.na(mapped_proteins$protein_phosphorylation), "protein_abundance"]
x <- getPlottingData(study,
modelID = c(rep("protein_phosphorylation", 7),
rep("protein_abundance", 7)),
featureID = mapped_proteins,
testID = rep(c("ctrl24h_vs_ctrl00h", "inf00h_vs_ctrl00h",
"inf02h_vs_ctrl00h", "inf04h_vs_ctrl00h",
"inf08h_vs_ctrl00h", "inf12h_vs_ctrl00h",
"inf24h_vs_ctrl00h"), 2)) %>% suppressMessages()
head(x)
plotMultiModel_multiFeature <- function(x) {
mm <- x$mapping[complete.cases(x$mapping),]
if (nrow(mm) == 0) stop('Selected features cannot be mapped across models')
p_results <- x$protein_abundance$results[[1]][x$protein_abundance$results[[1]]$C.s.uniprot %in% mm$protein_abundance,]
t_results <- x$protein_phosphorylation$results[[1]][x$protein_phosphorylation$results[[1]]$C.s.uniprot %in% mm$protein_phosphorylation,]
t_features <- x$protein_phosphorylation$features[x$protein_phosphorylation$features$C.s.uniprot %in% mm$protein_phosphorylation,]
# ggdf to store data for plot
minuslog10_pval <- -log10(t_results$adj.pvalue)
threshold <- t_results$adj.pvalue < 0.05 & abs(t_results$log2FC) > 1.8
gene_labels <- as.character(t_features$Gene_Name)
ggdf <- as.data.frame(
cbind(
feature = as.character(gene_labels),
log2FC_m1 = round(t_results$log2FC, 4),
log2FC_m2 = round(p_results$log2FC, 4),
minuslog10_pval = ifelse(minuslog10_pval < 3, 3, minuslog10_pval),
pval_transc = as.character(ifelse(t_results$adj.pvalue >= 0.001,
round(t_results$adj.pvalue, 3),
"<0.001")),
pval_proteo = as.character(ifelse(p_results$adj.pvalue >= 0.001,
round(p_results$adj.pvalue, 3),
"<0.001")
)
)
)
ggdf$log2FC_m1 <- as.numeric(ggdf$log2FC_m1)
ggdf$log2FC_m2 <- as.numeric(ggdf$log2FC_m2)
plotly::plot_ly(data = ggdf, x = ~log2FC_m1, y = ~log2FC_m2,
type = "scatter",
mode = "markers",
hoverinfo = 'text',
text = paste(ggdf$feature, '</br></br>',
"phosphorylation adj pval: ", ggdf$pval_transc, '</br>',
"phosphorylation log2FC: ", ggdf$log2FC_m1, '</br>',
"abundance adj pval: ", ggdf$pval_proteo, '</br>',
"abundance log2FC: ", ggdf$log2FC_m2) ,
marker = list(size = ~minuslog10_pval)) %>%
layout(
yaxis = list(title = paste0('log2FC abundance | ', names(x$protein_abundance$results)[[1]])),
xaxis = list(title = paste0('log2FC phosphorylation | ', names(x$protein_phosphorylation$results)[[1]])))
}
plotMultiModel_multiFeature(x)
# Cannot have duplicate plots in different models
phosphoplot_MultiTest_singleFeature = plotMultiTest_singleFeature
phosphoplot_MultiModel_singleFeature = plotMultiModel_singleFeature
phosphoplot_MultiModel_multiFeature = plotMultiModel_multiFeature
plots <- list(
protein_abundance = list(
plotMultiTest_singleFeature = list(
displayName = "barplot log2FC/pval per test",
packages = c("data.table", "plotly"),
plotType = c("multiTest", "plotly")
),
plotMultiModel_singleFeature = list(
displayName = "multiModel barplot log2FC/pval per test",
packages = c("plotly"),
plotType = c("singleFeature", "multiTest", "multiModel", "plotly")
),
plotMultiModel_multiFeature = list(
displayName = "multiModel scatterplot",
packages = c("data.table", "plotly"),
plotType = c("multiFeature", "singleTest", "multiModel", "plotly")
)
),
protein_phosphorylation = list(
phosphoplot_MultiTest_singleFeature = list(
displayName = "barplot log2FC/pval per test",
packages = c("data.table", "plotly"),
plotType = c("multiTest", "plotly")
),
phosphoplot_MultiModel_singleFeature = list(
displayName = "multiModel barplot log2FC/pval per test",
packages = c("plotly"),
plotType = c("singleFeature", "multiTest", "multiModel", "plotly")
),
phosphoplot_MultiModel_multiFeature = list(
displayName = "multiModel scatterplot",
packages = c("data.table", "plotly"),
plotType = c("multiFeature", "singleTest", "multiModel", "plotly")
)
)
)
study <- addPlots(study, plots = plots)
plotStudy(study,
modelID = "protein_abundance",
featureID = "A0A0D9R1T3",
testID = c("ctrl24h_vs_ctrl00h", "inf00h_vs_ctrl00h",
"inf02h_vs_ctrl00h", "inf04h_vs_ctrl00h",
"inf08h_vs_ctrl00h", "inf12h_vs_ctrl00h",
"inf24h_vs_ctrl00h"),
plotID = "plotMultiTest_singleFeature") %>% suppressMessages()
plotStudy(study,
modelID = c(rep("protein_abundance", 7), rep("protein_phosphorylation", 7)),
featureID = "A0A0D9QUI8",
testID = rep(c("ctrl24h_vs_ctrl00h", "inf00h_vs_ctrl00h",
"inf02h_vs_ctrl00h", "inf04h_vs_ctrl00h",
"inf08h_vs_ctrl00h", "inf12h_vs_ctrl00h",
"inf24h_vs_ctrl00h"), 2),
plotID = 'plotMultiModel_singleFeature') %>% suppressMessages()
plotStudy(study,
modelID = c(rep("protein_abundance", 7), rep("protein_phosphorylation", 7)),
featureID = mapped_proteins,
testID = rep(c("ctrl24h_vs_ctrl00h", "inf00h_vs_ctrl00h",
"inf02h_vs_ctrl00h", "inf04h_vs_ctrl00h",
"inf08h_vs_ctrl00h", "inf12h_vs_ctrl00h",
"inf24h_vs_ctrl00h"), 2),
plotID = 'plotMultiModel_multiFeature') %>% suppressMessages()
plotStudy(study,
modelID = "protein_phosphorylation",
featureID = "A0A0D9R1T3",
testID = c("ctrl24h_vs_ctrl00h", "inf00h_vs_ctrl00h",
"inf02h_vs_ctrl00h", "inf04h_vs_ctrl00h",
"inf08h_vs_ctrl00h", "inf12h_vs_ctrl00h",
"inf24h_vs_ctrl00h"),
plotID = "phosphoplot_MultiTest_singleFeature") %>% suppressMessages()
plotStudy(study,
modelID = c(rep("protein_phosphorylation", 7), rep("protein_abundance", 7)),
featureID = "A0A0D9QUI8",
testID = rep(c("ctrl24h_vs_ctrl00h", "inf00h_vs_ctrl00h",
"inf02h_vs_ctrl00h", "inf04h_vs_ctrl00h",
"inf08h_vs_ctrl00h", "inf12h_vs_ctrl00h",
"inf24h_vs_ctrl00h"), 2),
plotID = 'phosphoplot_MultiModel_singleFeature') %>% suppressMessages()
plotStudy(study,
modelID = c(rep("protein_phosphorylation", 7), rep("protein_abundance", 7)),
featureID = mapped_proteins,
testID = rep(c("ctrl24h_vs_ctrl00h", "inf00h_vs_ctrl00h",
"inf02h_vs_ctrl00h", "inf04h_vs_ctrl00h",
"inf08h_vs_ctrl00h", "inf12h_vs_ctrl00h",
"inf24h_vs_ctrl00h"), 2),
plotID = 'phosphoplot_MultiModel_multiFeature') %>% suppressMessages()
# Reports ----------------------------------------------------------------------
reports <- list(
protein_abundance = "data/report.html",
protein_phosphorylation = "data/report.html"
)
study <- addReports(study, reports)
# Install study package and start app ------------------------------------------
installStudy(study)
if (interactive()) {
message("Starting app. Should open in new browser tab.")
startApp()
}