-
Notifications
You must be signed in to change notification settings - Fork 0
/
RD139_RScript_3_Plots.r
708 lines (637 loc) · 30.5 KB
/
RD139_RScript_3_Plots.r
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
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
## LIBRARIES --------------------------------------------
library(ggplot2)
library(gridExtra)
library(ggpubr)
## WORKING DIRECTORY --
setwd("Z:/resultats/RD/RD139_LogicielsDIA/RD139_Papier_R_210108/")
## COLORS -----------------------------------------------
Col <- data.frame(Software = c("DIA-NN","DIA-Umpire", "OpenSWATH", "Skyline", "ScaffoldDIA", "Spectronaut" ),
Color = c("#1b6bb5", "#9e107b", "#5e5b56", "#17962a", "#ca431d", "#ff9d00" ))
set_color <- function(df) {
tibble(Software = df %>% pull(Software) %>% unique) %>%
left_join(Col, by = "Software") %>%
mutate(Software = factor(Software, levels = levels(df$Software))) %>%
arrange(Software)
}
## ORDER ------------------------------------------------
Lev_Acq = c("Narrow", "Overlap", "Mixed", "Wide")
Lev_Conc = c("0.1fmol", "0.25fmol", "1fmol", "2.5fmol", "5fmol", "10fmol", "25fmol", "50fmol")
## 1 - QUANTIFICATIONS - PEPTIDES ----------------------------
x_Eco <- read.csv("./Output_2_DataTreatment/SuppTable_IDs_Quant_pep_Eco.txt", header = T, sep = " ", stringsAsFactors = F) %>%
dplyr::select(Experience, Quant, sd) %>%
separate(Experience, c("Software","Acquisition", "Extraction"), sep = "_") %>%
mutate(Type = "Peptides ",
Software = factor(Software),
Acquisition = factor(Acquisition, levels = Lev_Acq))
x_UPS <- read.csv("./Output_2_DataTreatment/SuppTable_IDs_Quant_pep_UPS.txt", header = T, sep =" ") %>%
dplyr::select(-ID) %>%
gather(Concentration, Count, -Experience) %>%
separate(Experience, c("Software","Acquisition", "Extraction"), sep = "_") %>%
mutate(Concentration = gsub("X", "", Concentration) %>%
gsub("fmol", " fmol", .) %>%
factor(., levels = unique(.)),
Type = "Peptides",
Software = factor(Software),
Acquisition = factor(Acquisition, levels = Lev_Acq))
# Eco fasta
df <- x_Eco %>%
filter(Extraction == "Fasta")
colors <- set_color(df) %>% mutate(Color = as.character(Color))
p1 <- ggplot(df, aes(Type, Quant, color = Software, group = Software)) +
geom_point(size = 0.8) +
geom_errorbar(aes(ymin = Quant - sd, ymax = Quant + sd), width = 0.2, alpha = 0.8, size = 0.4) +
facet_grid(rows = vars(Type), cols = vars(Acquisition)) +
theme_minimal() +
scale_x_discrete(name = "") +
scale_y_continuous(name = "Fasta\nE.coli", limits = c(3500, 19000)) +
scale_color_manual(values = colors$Color) +
theme(panel.border = element_rect(color = 'black', fill = NA),
axis.text.x = element_text(size = 6.5, angle = 90, hjust = 1, vjust = 0.25, color = "white"),
axis.text.y = element_text(size = 6.5),
legend.position = "none",
legend.title = element_blank(),
strip.text.y = element_blank(),
plot.title = element_text(size = 8, hjust = 0.5, face = "bold"))
# UPS fasta
df <- x_UPS %>%
filter(Extraction == "Fasta")
colors <- set_color(df) %>% mutate(Color = as.character(Color))
p2 <- ggplot(df, aes(Concentration, Count, color = Software, group = Software)) +
geom_point(size = 0.8) +
geom_line(size = 0.5) +
facet_grid(rows = vars(Type), cols = vars(Acquisition)) +
theme_minimal() +
scale_x_discrete(name = "") +
scale_y_continuous(name = "Fasta\nUPS1", limits = c(0, 710)) +
scale_color_manual(values = colors$Color) +
theme(panel.border = element_rect(color = 'black', fill = NA),
axis.text.x = element_text(size = 6.5, angle = 90, hjust = 1, vjust = 0.25),
axis.text.y = element_text(size = 6.5),
legend.position = "none",
legend.title = element_blank(),
strip.text.y = element_blank(),
plot.title = element_text(size = 8, hjust = 0.5, face = "bold"))
# Eco library
df <- x_Eco %>%
filter(Extraction == "Library")
colors <- set_color(df) %>% mutate(Color = as.character(Color))
p3 <-ggplot(df, aes(Type, Quant, color = Software, group = Software)) +
geom_point(size = 0.8) +
geom_errorbar(aes(ymin = Quant - sd, ymax = Quant + sd), width = 0.2, alpha = 0.8, size = 0.4) +
facet_grid(rows = vars(Type), cols = vars(Acquisition)) +
theme_minimal() +
scale_x_discrete(name = "") +
scale_y_continuous(name = "Library\nE.coli", limits = c(3500, 19000)) +
scale_color_manual(values = colors$Color) +
theme(panel.border = element_rect(color = 'black', fill = NA),
axis.text.x = element_text(size = 6.5, angle = 90, hjust = 1, vjust = 0.25, color = "white"),
axis.text.y = element_text(size = 6.5),
legend.position = "none",
legend.title = element_blank(),
strip.text.y = element_blank(),
plot.title = element_text(size = 8, hjust = 0.5, face = "bold"))
# UPS library
df <- x_UPS %>%
filter(Extraction == "Library")
colors <- set_color(df) %>% mutate(Color = as.character(Color))
p4 <- ggplot(df, aes(Concentration, Count, color = Software, group = Software)) +
geom_point(size = 0.8) +
geom_line(size = 0.5) +
facet_grid(rows = vars(Type), cols = vars(Acquisition)) +
theme_minimal() +
scale_x_discrete(name = "") +
scale_y_continuous(name = "Library\nUPS1", limits = c(0, 710)) +
scale_color_manual(values = colors$Color) +
theme(panel.border = element_rect(color = 'black', fill = NA),
axis.text.x = element_text(size = 6.5, angle = 90, hjust = 1, vjust = 0.25),
axis.text.y = element_text(size = 6.5),
legend.position = "none",
legend.title = element_blank(),
strip.text.y = element_blank(),
plot.title = element_text(size = 8, hjust = 0.5, face = "bold"))
# Legend
df <- x_Eco
colors <- set_color(df) %>% mutate(Color = as.character(Color))
leg <- ggplot(df, aes(Type, Quant, color = Software, group = Software)) +
geom_point() +
geom_line(size = 0.5) +
scale_color_manual(values = colors$Color) +
theme_minimal() +
theme(legend.title = element_blank(),
legend.position = "bottom",
legend.text = element_text(size = 8))
leg <- get_legend(leg)
leg <- as_ggplot(leg)
pdf("Output_2_DataTreatment/Figures/1_Quant_Peptides.pdf", height = 5, width = 8)
grid.arrange(grobs = list(p1, p2, p3, p4, leg),
ncol = 2, nrow = 3,
widths = c(2, 5),
heights = c(3, 3, 1),
layout_matrix = rbind(c(1 ,2),
c(3, 4),
c(5, 5)),
top = "PEPTIDES\n")
dev.off()
## 1 - QUANTIFICATIONS - PROTEINS ----------------------------
x_Eco <- read.csv("./Output_2_DataTreatment/SuppTable_IDs_Quant_prot_Eco.txt", header = T, sep = " ", stringsAsFactors = F) %>%
dplyr::select(Experience, Quant, sd) %>%
separate(Experience, c("Software","Acquisition", "Extraction"), sep = "_") %>%
mutate(Type = "Proteins ",
Software = factor(Software),
Acquisition = factor(Acquisition, levels = Lev_Acq))
x_UPS <- read.csv("./Output_2_DataTreatment/SuppTable_IDs_Quant_prot_UPS.txt", header = T, sep =" ") %>%
dplyr::select(-ID) %>%
gather(Concentration, Count, -Experience) %>%
separate(Experience, c("Software","Acquisition", "Extraction"), sep = "_") %>%
mutate(Concentration = gsub("X", "", Concentration) %>%
gsub("fmol", " fmol", .) %>%
factor(., levels = unique(.)),
Type = "Peptides",
Software = factor(Software),
Acquisition = factor(Acquisition, levels = Lev_Acq))
# Eco fasta
df <- x_Eco %>%
filter(Extraction == "Fasta")
colors <- set_color(df) %>% mutate(Color = as.character(Color))
p1 <- ggplot(df, aes(Type, Quant, color = Software, group = Software)) +
geom_point(size = 0.8) +
geom_errorbar(aes(ymin = Quant - sd, ymax = Quant + sd), width = 0.2, alpha = 0.8, size = 0.4) +
facet_grid(rows = vars(Type), cols = vars(Acquisition)) +
theme_minimal() +
scale_x_discrete(name = "") +
scale_y_continuous(name = "Fasta\nE.coli", limits = c(700, 2200)) +
scale_color_manual(values = colors$Color) +
theme(panel.border = element_rect(color = 'black', fill = NA),
axis.text.x = element_text(size = 6.5, angle = 90, hjust = 1, vjust = 0.25, color = "white"),
axis.text.y = element_text(size = 6.5),
legend.position = "none",
legend.title = element_blank(),
strip.text.y = element_blank(),
plot.title = element_text(size = 8, hjust = 0.5, face = "bold"))
# UPS fasta
df <- x_UPS %>%
filter(Extraction == "Fasta")
colors <- set_color(df) %>% mutate(Color = as.character(Color))
p2 <- ggplot(df, aes(Concentration, Count, color = Software, group = Software)) +
geom_point(size = 0.8) +
geom_line(size = 0.5) +
facet_grid(rows = vars(Type), cols = vars(Acquisition)) +
theme_minimal() +
scale_x_discrete(name = "") +
scale_y_continuous(name = "Fasta\nUPS1", limits = c(0, 50)) +
scale_color_manual(values = colors$Color) +
theme(panel.border = element_rect(color = 'black', fill = NA),
axis.text.x = element_text(size = 6.5, angle = 90, hjust = 1, vjust = 0.25),
axis.text.y = element_text(size = 6.5),
legend.position = "none",
legend.title = element_blank(),
strip.text.y = element_blank(),
plot.title = element_text(size = 8, hjust = 0.5, face = "bold"))
# Eco library
df <- x_Eco %>%
filter(Extraction == "Library")
colors <- set_color(df) %>% mutate(Color = as.character(Color))
p3 <- ggplot(df, aes(Type, Quant, color = Software, group = Software)) +
geom_point(size = 0.8) +
geom_errorbar(aes(ymin = Quant - sd, ymax = Quant + sd), width = 0.2, alpha = 0.8, size = 0.4) +
facet_grid(rows = vars(Type), cols = vars(Acquisition)) +
theme_minimal() +
scale_x_discrete(name = "") +
scale_y_continuous(name = "Library\nE.coli", limits = c(700, 2200)) +
scale_color_manual(values = colors$Color) +
theme(panel.border = element_rect(color = 'black', fill = NA),
axis.text.x = element_text(size = 6.5, angle = 90, hjust = 1, vjust = 0.25, color = "white"),
axis.text.y = element_text(size = 6.5),
legend.position = "none",
legend.title = element_blank(),
strip.text.y = element_blank(),
plot.title = element_text(size = 8, hjust = 0.5, face = "bold"))
# UPS library
df <- x_UPS %>%
filter(Extraction == "Library")
colors <- set_color(df) %>% mutate(Color = as.character(Color))
p4 <- ggplot(df, aes(Concentration, Count, color = Software, group = Software)) +
geom_point(size = 0.8) +
geom_line(size = 0.5) +
facet_grid(rows = vars(Type), cols = vars(Acquisition)) +
theme_minimal() +
scale_x_discrete(name = "") +
scale_y_continuous(name = "Library\nUPS1", limits = c(0, 50)) +
scale_color_manual(values = colors$Color) +
theme(panel.border = element_rect(color = 'black', fill = NA),
axis.text.x = element_text(size = 6.5, angle = 90, hjust = 1, vjust = 0.25),
axis.text.y = element_text(size = 6.5),
legend.position = "none",
legend.title = element_blank(),
strip.text.y = element_blank(),
plot.title = element_text(size = 8, hjust = 0.5, face = "bold"))
# Legend
df <- x_Eco
colors <- set_color(df) %>% mutate(Color = as.character(Color))
leg <- ggplot(df, aes(Type, Quant, color = Software, group = Software)) +
geom_point() +
geom_line(size = 0.5) +
scale_color_manual(values = colors$Color) +
theme_minimal() +
theme(legend.title = element_blank(),
legend.position = "bottom",
legend.text = element_text(size = 8))
leg <- get_legend(leg)
leg <- as_ggplot(leg)
pdf("Output_2_DataTreatment/Figures/1_Quant_Proteins.pdf", height = 5, width = 8)
grid.arrange(grobs = list(p1, p2, p3, p4, leg),
ncol = 2, nrow = 3,
widths = c(2, 5),
heights = c(3, 3, 1),
layout_matrix = rbind(c(1 ,2),
c(3, 4),
c(5, 5)),
top = "PROTEINS\n")
dev.off()
## 2 - REPRODUCIBILITY - CV - PEPTIDES -----------------------
## Peptides Eco ----
CV_Eco_pep <- read.csv("./Output_2_DataTreatment/SuppTable_CV_pep.txt",
header = T, sep = " ", stringsAsFactors = T) %>%
filter(Specie == "Ecoli") %>%
dplyr::select(-Specie)
Exp <- CV_Eco_pep$Experience
CV_Eco_pep <- CV_Eco_pep %>%
dplyr::select(CV) %>%
aggregate(., by = list(Exp), FUN = mean, na.rm = T) %>%
mutate(Experience = Group.1) %>%
separate(Group.1, c("Software", "Acquisition", "Extraction"), sep = "_") %>%
mutate(Software = factor(Software),
Acquisition = factor(Acquisition, levels = Lev_Acq) )
write.table(CV_Eco_pep, "./Output_2_DataTreatment/SuppTable_CV_pep_Eco.txt")
## Peptides UPS1 ----
CV_UPS_pep <- read.csv("./Output_2_DataTreatment/SuppTable_CV_pep.txt",
header = T, sep = " ", stringsAsFactors = T) %>%
filter(Specie == "HUMAN") %>%
dplyr::select(-Specie) %>%
mutate(Combined = paste(Experience, Concentration, sep = "_"))
Comb <- CV_UPS_pep$Combined
CV_UPS_pep <- CV_UPS_pep %>%
dplyr::select(CV) %>%
aggregate(., by = list(Comb), FUN = mean, na.rm = T) %>%
separate(Group.1, c("Software", "Acquisition", "Extraction", "Concentration"), sep = "_") %>%
mutate(Software = factor(Software),
Acquisition = factor(Acquisition, levels = Lev_Acq),
Concentration = factor(Concentration, levels = Lev_Conc))
x <- CV_UPS_pep %>%
mutate(Exp = paste(Software, Extraction, Acquisition, sep = "_")) %>%
dplyr::select(-c(Software, Acquisition, Extraction)) %>%
spread(Concentration, CV)
write.table(x, "./Output_2_DataTreatment/SuppTable_CV_pep_UPS.txt")
# Eco fasta
df <- CV_Eco_pep %>%
filter(Extraction == "Fasta") %>%
mutate(Type = "Peptide")
colors <- set_color(df) %>% mutate(Color = as.character(Color))
p1 <- ggplot(df, aes(Type, CV, color = Software, group = Software)) +
geom_point(size = 0.8) +
facet_grid(rows = vars(Type), cols = vars(Acquisition)) +
theme_minimal() +
scale_x_discrete(name = "") +
scale_y_continuous(name = "Fasta\nE.coli", limits = c(5, 30)) +
scale_color_manual(values = colors$Color) +
theme(panel.border = element_rect(color = 'black', fill = NA),
axis.text.x = element_text(size = 6.5, angle = 90, hjust = 1, vjust = 0.25, color = "white"),
axis.text.y = element_text(size = 6.5),
legend.position = "none",
legend.title = element_blank(),
strip.text.y = element_blank(),
plot.title = element_text(size = 8, hjust = 0.5, face = "bold"))
# UPS fasta
df <- CV_UPS_pep %>%
filter(Extraction == "Fasta")
colors <- set_color(df) %>% mutate(Color = as.character(Color))
p2 <- ggplot(df, aes(Concentration, CV, color = Software, group = Software)) +
geom_point(size = 0.8) +
geom_line(size = 0.5) +
facet_grid( cols = vars(Acquisition)) +
theme_minimal() +
scale_x_discrete(name = "") +
scale_y_continuous(name = "Fasta\nUPS1", limits = c(0, 70)) +
scale_color_manual(values = colors$Color) +
theme(panel.border = element_rect(color = 'black', fill = NA),
axis.text.x = element_text(size = 6.5, angle = 90, hjust = 1, vjust = 0.25),
axis.text.y = element_text(size = 6.5),
legend.position = "none",
legend.title = element_blank(),
strip.text.y = element_blank(),
plot.title = element_text(size = 8, hjust = 0.5, face = "bold"))
# Eco library
df <- CV_Eco_pep %>%
filter(Extraction == "Library") %>%
mutate(Type = "Peptide")
colors <- set_color(df) %>% mutate(Color = as.character(Color))
p3 <- ggplot(df, aes(Type, CV, color = Software, group = Software)) +
geom_point(size = 0.8) +
facet_grid(rows = vars(Type), cols = vars(Acquisition)) +
theme_minimal() +
scale_x_discrete(name = "") +
scale_y_continuous(name = "Library\nE.coli", limits = c(5, 30)) +
scale_color_manual(values = colors$Color) +
theme(panel.border = element_rect(color = 'black', fill = NA),
axis.text.x = element_text(size = 6.5, angle = 90, hjust = 1, vjust = 0.25, color = "white"),
axis.text.y = element_text(size = 6.5),
legend.position = "none",
legend.title = element_blank(),
strip.text.y = element_blank(),
plot.title = element_text(size = 8, hjust = 0.5, face = "bold"))
# UPS library
df <- CV_UPS_pep %>%
filter(Extraction == "Library")
colors <- set_color(df) %>% mutate(Color = as.character(Color))
p4 <- ggplot(df, aes(Concentration, CV, color = Software, group = Software)) +
geom_point(size = 0.8) +
geom_line(size = 0.5) +
facet_grid( cols = vars(Acquisition)) +
theme_minimal() +
scale_x_discrete(name = "") +
scale_y_continuous(name = "Library\nUPS1", limits = c(0, 70)) +
scale_color_manual(values = colors$Color) +
theme(panel.border = element_rect(color = 'black', fill = NA),
axis.text.x = element_text(size = 6.5, angle = 90, hjust = 1, vjust = 0.25),
axis.text.y = element_text(size = 6.5),
legend.position = "none",
legend.title = element_blank(),
strip.text.y = element_blank(),
plot.title = element_text(size = 8, hjust = 0.5, face = "bold"))
# Legend
df <- CV_Eco_pep %>% mutate(Type = "Peptides")
colors <- set_color(df) %>% mutate(Color = as.character(Color))
leg <- ggplot(df, aes(Type, CV, color = Software, group = Software)) +
geom_point() +
geom_line(size = 0.5) +
scale_color_manual(values = colors$Color) +
theme_minimal() +
theme(legend.title = element_blank(),
legend.position = "bottom",
legend.text = element_text(size = 8))
leg <- get_legend(leg)
leg <- as_ggplot(leg)
pdf("Output_2_DataTreatment/Figures/2_Reproducibility_CV_Peptides.pdf", height = 5, width = 8)
grid.arrange(grobs = list(p1, p2, p3, p4, leg),
ncol = 2, nrow = 3,
widths = c(2, 5),
heights = c(3, 3, 1),
layout_matrix = rbind(c(1 ,2),
c(3, 4),
c(5, 5)),
top = "PEPTIDES\n")
dev.off()
## 2 - REPRODUCIBILITY - CV - PROTEINS -----------------------
## Proteins Eco ----
CV_Eco_prot <- read.csv("./Output_2_DataTreatment/SuppTable_CV_prot.txt",
header = T, sep = " ", stringsAsFactors = T) %>%
filter(Specie == "Ecoli") %>%
dplyr::select(-Specie)
Exp <- CV_Eco_prot$Experience
CV_Eco_prot <- CV_Eco_prot %>%
dplyr::select(CV) %>%
aggregate(., by = list(Exp), FUN = mean, na.rm = T) %>%
mutate(Experience = Group.1) %>%
separate(Group.1, c("Software", "Acquisition", "Extraction"), sep = "_") %>%
mutate(Software = factor(Software),
Acquisition = factor(Acquisition, levels = Lev_Acq) )
write.table(CV_Eco_prot, "./Output_2_DataTreatment/SuppTable_CV_prot_Eco.txt")
## Proteins UPS1 ----
CV_UPS_prot <- read.csv("./Output_2_DataTreatment/SuppTable_CV_prot.txt",
header = T, sep = " ", stringsAsFactors = T) %>%
filter(Specie == "HUMAN") %>%
dplyr::select(-Specie) %>%
mutate(Combined = paste(Experience, Concentration, sep = "_"))
Comb <- CV_UPS_prot$Combined
CV_UPS_prot <- CV_UPS_prot %>%
dplyr::select(CV) %>%
aggregate(., by = list(Comb), FUN = mean, na.rm = T) %>%
separate(Group.1, c("Software", "Acquisition", "Extraction", "Concentration"), sep = "_") %>%
mutate(Software = factor(Software),
Acquisition = factor(Acquisition, levels = Lev_Acq),
Concentration = factor(Concentration, levels = Lev_Conc))
x <- CV_UPS_prot %>%
mutate(Exp = paste(Software, Extraction, Acquisition, sep = "_")) %>%
dplyr::select(-c(Software, Acquisition, Extraction)) %>%
spread(Concentration, CV)
write.table(x, "./Output_2_DataTreatment/SuppTable_CV_prot_UPS.txt")
# Eco fasta
df <- CV_Eco_prot %>%
filter(Extraction == "Fasta") %>%
mutate(Type = "Protein")
colors <- set_color(df) %>% mutate(Color = as.character(Color))
p1 <- ggplot(df, aes(Type, CV, color = Software, group = Software)) +
geom_point(size = 0.8) +
facet_grid(rows = vars(Type), cols = vars(Acquisition)) +
theme_minimal() +
scale_x_discrete(name = "") +
scale_y_continuous(name = "Fasta\nE.coli", limits = c(0, 25)) +
scale_color_manual(values = colors$Color) +
theme(panel.border = element_rect(color = 'black', fill = NA),
axis.text.x = element_text(size = 6.5, angle = 90, hjust = 1, vjust = 0.25, color = "white"),
axis.text.y = element_text(size = 6.5),
legend.position = "none",
legend.title = element_blank(),
strip.text.y = element_blank(),
plot.title = element_text(size = 8, hjust = 0.5, face = "bold"))
# UPS fasta
df <- CV_UPS_prot %>%
filter(Extraction == "Fasta")
colors <- set_color(df) %>% mutate(Color = as.character(Color))
p2 <- ggplot(df, aes(Concentration, CV, color = Software, group = Software)) +
geom_point(size = 0.8) +
geom_line(size = 0.5) +
facet_grid( cols = vars(Acquisition)) +
theme_minimal() +
scale_x_discrete(name = "") +
scale_y_continuous(name = "Fasta\nUPS1", limits = c(0, 65)) +
scale_color_manual(values = colors$Color) +
theme(panel.border = element_rect(color = 'black', fill = NA),
axis.text.x = element_text(size = 6.5, angle = 90, hjust = 1, vjust = 0.25),
axis.text.y = element_text(size = 6.5),
legend.position = "none",
legend.title = element_blank(),
strip.text.y = element_blank(),
plot.title = element_text(size = 8, hjust = 0.5, face = "bold"))
# Eco library
df <- CV_Eco_prot %>%
filter(Extraction == "Library") %>%
mutate(Type = "Peptide")
colors <- set_color(df) %>% mutate(Color = as.character(Color))
p3 <- ggplot(df, aes(Type, CV, color = Software, group = Software)) +
geom_point(size = 0.8) +
facet_grid(rows = vars(Type), cols = vars(Acquisition)) +
theme_minimal() +
scale_x_discrete(name = "") +
scale_y_continuous(name = "Library\nE.coli", limits = c(0, 25)) +
scale_color_manual(values = colors$Color) +
theme(panel.border = element_rect(color = 'black', fill = NA),
axis.text.x = element_text(size = 6.5, angle = 90, hjust = 1, vjust = 0.25, color = "white"),
axis.text.y = element_text(size = 6.5),
legend.position = "none",
legend.title = element_blank(),
strip.text.y = element_blank(),
plot.title = element_text(size = 8, hjust = 0.5, face = "bold"))
# UPS library
df <- CV_UPS_prot %>%
filter(Extraction == "Library")
colors <- set_color(df) %>% mutate(Color = as.character(Color))
p4 <- ggplot(df, aes(Concentration, CV, color = Software, group = Software)) +
geom_point(size = 0.8) +
geom_line(size = 0.5) +
facet_grid( cols = vars(Acquisition)) +
theme_minimal() +
scale_x_discrete(name = "") +
scale_y_continuous(name = "Library\nUPS1", limits = c(0, 65)) +
scale_color_manual(values = colors$Color) +
theme(panel.border = element_rect(color = 'black', fill = NA),
axis.text.x = element_text(size = 6.5, angle = 90, hjust = 1, vjust = 0.25),
axis.text.y = element_text(size = 6.5),
legend.position = "none",
legend.title = element_blank(),
strip.text.y = element_blank(),
plot.title = element_text(size = 8, hjust = 0.5, face = "bold"))
# Legend
df <- CV_Eco_prot %>% mutate(Type = "Proteins")
colors <- set_color(df) %>% mutate(Color = as.character(Color))
leg <- ggplot(df, aes(Type, CV, color = Software, group = Software)) +
geom_point() +
geom_line(size = 0.5) +
scale_color_manual(values = colors$Color) +
theme_minimal() +
theme(legend.title = element_blank(),
legend.position = "bottom",
legend.text = element_text(size = 8))
leg <- get_legend(leg)
leg <- as_ggplot(leg)
pdf("Output_2_DataTreatment/Figures/2_Reproducibility_CV_Proteins.pdf", height = 5, width = 8)
grid.arrange(grobs = list(p1, p2, p3, p4, leg),
ncol = 2, nrow = 3,
widths = c(2, 5),
heights = c(3, 3, 1),
layout_matrix = rbind(c(1 ,2),
c(3, 4),
c(5, 5)),
top = "PROTEINSS\n")
dev.off()
## 3 - LINEARITY - R2 ----------------------------------------
Lin <- read.csv("./Output_2_DataTreatment/SuppTable_Linearities.txt", header = T, sep =" ", stringsAsFactors = T)
# Fasta
df <- Lin %>%
separate(Experience, c("Software", "Acquisition", "Extraction"), sep = "_") %>%
mutate(Software = factor(Software),
Acquisition = factor(Acquisition, levels = Lev_Acq)) %>%
filter(Extraction == "Fasta")
colors <- set_color(df) %>% mutate(Color = as.character(Color))
mu <- Lin %>%
ddply(., "Experience", summarise, grp.mean = round(mean(R2), 3)) %>%
separate(Experience, c("Software", "Acquisition", "Extraction"), sep = "_") %>%
mutate(Software = factor(Software),
Acquisition = factor(Acquisition)) %>%
filter(Extraction == "Fasta")
p1 <- ggplot(df, aes(R2, fill = Software)) +
geom_density() +
geom_vline(data = mu, aes(xintercept = grp.mean), linetype = "dashed", size = 0.7) +
geom_text(data = mu, size = 3, inherit.aes = F, aes(x = 0.7, y = 15, label = grp.mean)) +
facet_wrap( Acquisition ~ Software, scales = "free", ncol = 4) +
scale_x_continuous(limits = c(0.6, 1.01)) +
labs(x = parse(text = "r^{2}"), y = "Density" ) +
scale_fill_manual(values = colors$Color, label = colors$Software) +
theme_minimal() +
theme(axis.text.y = element_blank(),
axis.text.x = element_text(angle = 90, vjust = 0.5, hjust = 1, size = 6.5),
panel.border = element_rect(color = 'black', fill = NA),
legend.position = "none",
plot.title = element_text(hjust = 0.5)) +
ggtitle("Fasta")
# Library
df <- Lin %>%
separate(Experience, c("Software", "Acquisition", "Extraction"), sep = "_") %>%
mutate(Software = factor(Software),
Acquisition = factor(Acquisition, levels = Lev_Acq)) %>%
filter(Extraction == "Library")
colors <- set_color(df) %>% mutate(Color = as.character(Color))
mu <- Lin %>%
ddply(., "Experience", summarise, grp.mean = round(mean(R2), 3)) %>%
separate(Experience, c("Software", "Acquisition", "Extraction"), sep = "_") %>%
mutate(Software = factor(Software),
Acquisition = factor(Acquisition, levels = Lev_Acq)) %>%
filter(Extraction == "Library")
p2 <- ggplot(df, aes(R2, fill = Software)) +
geom_density() +
geom_vline(data = mu, aes(xintercept = grp.mean), linetype = "dashed", size = 0.7) +
geom_text(data = mu, size = 3, inherit.aes = F, aes(x = 0.7, y = 15, label = grp.mean)) +
facet_wrap( Acquisition ~ Software, scales = "free", ncol = 5) +
scale_x_continuous(limits = c(0.6, 1.01)) +
labs(x = parse(text = "r^{2}"), y = "Density" ) +
scale_fill_manual(values = colors$Color, label = colors$Software) +
theme_minimal() +
theme(axis.text.y = element_blank(),
axis.text.x = element_text(angle = 90, vjust = 0.5, hjust = 1, size = 6.5),
panel.border = element_rect(color = 'black', fill = NA),
legend.position = "none",
plot.title = element_text(hjust = 0.5)) +
ggtitle("Library")
pdf("Output_2_DataTreatment/Figures/3_Linearity-r2.pdf", height = 8.5, width = 12.5)
annotate_figure(
ggarrange(p1, p2,
ncol = 2, nrow = 1,
widths = c(4, 5))
)
dev.off()
## 4 - ACCURACY - MAPE ----------------------------------------
tab <- read.table("Input_1_Other/Tab_ratio.csv", sep = ";", header = T, stringsAsFactors = F)
df <- read.csv("Output_2_DataTreatment/SuppTable_MAPE_UPS_all.txt", sep = " ") %>%
dplyr::rename_all(function(.) {c("Experience", tab$Ratio)} ) %>%
gather(Ratio, MAPE, -Experience) %>%
separate(col = Experience, into = c("Software", "Acquisition", "Extraction"), sep = "_") %>%
mutate(Ratio = factor(Ratio, levels = as.character(tab$Ratio)),
Software = factor(Software),
Acquisition = factor(Acquisition, levels = Lev_Acq),
R1 = Ratio %>% as.character %>% gsub("fmol.*", "", .) %>% as.numeric,
R2 = Ratio %>% as.character %>% gsub("fmol", "", .) %>% gsub(".*\\/", "", .) %>% as.numeric,
ExpR = paste0(R1, " / ", R2, " (", R1 / R2, ")") %>% factor(., levels = unique(.)))
colors <- set_color(df) %>% mutate(Color = as.character(Color))
pdf("Output_2_DataTreatment/Figures/4_Accuracy_MAPE.pdf", height = 7, width = 9)
ggplot(df, aes(ExpR, MAPE, group = Software, color = Software, fill = Software)) +
geom_point(size = 1) +
geom_line() +
scale_color_manual(values = colors$Color) +
scale_fill_manual(values = colors$Color) +
scale_y_continuous(name = "", limits = c(0, 126)) +
scale_x_discrete(name = "") +
theme_minimal() +
theme(panel.border = element_rect(color = 'black', fill = NA),
axis.text.x = element_text(angle = 90, hjust = 1, vjust = 0.25, size = 8),
axis.text.y = element_text(size = 8),
axis.title = element_text(size = 9),
legend.position = "bottom",
legend.title = element_blank()) +
facet_grid(Acquisition ~ Extraction)
dev.off()
## 5 - SENSITIVITY - AUC ----------------------------------------
tab <- read.table("Input_1_Other/Tab_ratio.csv", sep = ";", header = T, stringsAsFactors = F)
df <- read.csv("Output_2_DataTreatment/SuppTable_AUC.txt", sep = " ") %>%
gather(Experience, AUC, -Ratio) %>%
separate(col = Experience, into = c("Software", "Acquisition", "Extraction"), sep = "_") %>%
mutate(Software = gsub("\\.", "\\-", Software) %>% as.factor,
Acquisition = factor(Acquisition, levels = Lev_Acq),
Ratio = factor(Ratio, levels = unique(Ratio)),
R1 = Ratio %>% as.character %>% gsub("fmol.*", "", .) %>% as.numeric,
R2 = Ratio %>% as.character %>% gsub("fmol", "", .) %>% gsub(".*\\/", "", .) %>% as.numeric,
ExpR = paste0(R1, " / ", R2, " (", R1 / R2, ")") %>% factor(., levels = unique(.)))
colors <- set_color(df) %>% mutate(Color = as.character(Color))
pdf("Output_2_DataTreatment/Figures/5_AUC.pdf", height = 7, width = 9)
ggplot(df, aes(ExpR, AUC, group = Software, color = Software)) +
geom_point(size = 1) +
geom_line() +
scale_color_manual(values = colors$Color) +
labs(x = "", y = "") +
theme_minimal() +
theme(panel.border = element_rect(color = 'black', fill = NA),
axis.text.x = element_text(angle = 90, hjust = 1, vjust = 0.25, size = 8),
axis.text.y = element_text(size = 8),
legend.position = "bottom",
legend.title = element_blank()) +
facet_grid(Acquisition ~ Extraction)
dev.off()