-
Notifications
You must be signed in to change notification settings - Fork 0
/
DEG-GO_analysis.Rmd
1807 lines (1449 loc) · 71.2 KB
/
DEG-GO_analysis.Rmd
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
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
---
title: "GO analysis"
author: "ERM"
date: "`r Sys.Date()`"
output: html_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = FALSE, warning = FALSE)
```
# GO Analysis
I have created several files from the RNA analysis that contain the significant genes(determined by adj.P.val \< 0.1) from each Time and Condition. The names of the files are in the following format: 'sigV'+Drug(2 letters)+time.
example: 'sigVDA3.txt' means this file contains the significant DE genes from the Daunorubicin 3 hour compared to Vehicle Control 3 hour analysis
```{r Import libraries, message=FALSE, warning=FALSE}
library(tidyverse)
library(gprofiler2)
library(readr)
library(BiocGenerics)
library(gridExtra)
library(VennDiagram)
library(kableExtra)
library(scales)
library(ggVennDiagram)
library(cowplot)
```
```{r Import data, echo=FALSE, message=FALSE, warning=FALSE}
##note, in this chunk the .rmd file is in the cm/analysis folder. need to back out with ..
##this code checks the directory and searches for the pattern, returning the full name of the file
file.names <- list.files(path = "data/", pattern = "sig*", ignore.case = TRUE,full.names = TRUE)
##Next I use the list of names and lapply to read all files into a list
##made the csv file to reimport
#write.csv(filenameonly,"data/filenameonly.txt", col.names = FALSE,row.names = FALSE)
##readin the filenameonly.txt file from data to use for naming and filtering.
filenameonly <- read_csv("data/filenameonly.txt")
#loop through the list of files and make a separate dataframe for each file under the 'real' name of the data set
for (k in 1:length(file.names)){
assign(paste0(filenameonly$x[k]) , read.csv(file.names[k]))
}
##rename the columns to the previous names
colnames(sigVDA24)<- c("ENTREZID","SYMBOL","logFC","AveExpr","t","P.Value","adj.P.Val","B")
colnames(sigVDX24)<- c("ENTREZID","SYMBOL","logFC","AveExpr","t","P.Value","adj.P.Val","B")
colnames(sigVEP24)<- c("ENTREZID","SYMBOL","logFC","AveExpr","t","P.Value","adj.P.Val","B")
colnames(sigVMT24)<- c("ENTREZID","SYMBOL","logFC","AveExpr","t","P.Value","adj.P.Val","B")
colnames(sigVTR24)<- c("ENTREZID","SYMBOL","logFC","AveExpr","t","P.Value","adj.P.Val","B")
colnames(sigVDA3)<- c("ENTREZID","SYMBOL","logFC","AveExpr","t","P.Value","adj.P.Val","B")
colnames(sigVDX3)<- c("ENTREZID","SYMBOL","logFC","AveExpr","t","P.Value","adj.P.Val","B")
colnames(sigVEP3)<- c("ENTREZID","SYMBOL","logFC","AveExpr","t","P.Value","adj.P.Val","B")
colnames(sigVMT3)<- c("ENTREZID","SYMBOL","logFC","AveExpr","t","P.Value","adj.P.Val","B")
colnames(sigVTR3)<- c("ENTREZID","SYMBOL","logFC","AveExpr","t","P.Value","adj.P.Val","B")
```
The analysis is based on all genes that passed the rowMeans\>0 from the previous page [link](https://reneeisnowhere.github.io/Cardiotoxicity/RNAseqrun_1_analysis.html)
```{r uploading the background genes, echo=FALSE, message=FALSE, warning=FALSE, paged.print=FALSE}
#backGL <- efit2$genes ***making the list
#write.csv(backGL, "data/backGL.txt", row.names = FALSE)
##read the .csv the render into txt in the data file!
backGL <- read_csv("data/backGL.txt",
col_types = cols(...1 = col_skip()))
```
Below is the analysis of differentially expressed genes for each treatment at 3 hours and 24 hours.
##Daunorubicin
```{r intial analysis DA3 and DA24, echo=FALSE, message=FALSE, warning=FALSE}
DAspgostres3 <- gost(query = sigVDA3$ENTREZID,
organism = "hsapiens",
ordered_query = TRUE,
domain_scope = "custom",
measure_underrepresentation = FALSE,
evcodes = FALSE,
user_threshold = 0.05,
correction_method = c("fdr"),
custom_bg = backGL$ENTREZID,
sources=c("GO:BP","KEGG"))
DAspp3 <- gostplot(DAspgostres3, capped = FALSE, interactive = TRUE)
DAspp3
DAsptable3 <- DAspgostres3$result %>%
dplyr::select(c(source, term_id,
term_name,intersection_size,
term_size, p_value))# %>%
DAtable1 %>% mutate_at(.cols = 6, .funs= scientific_format()) %>%
kable(.,) %>%
kable_paper("striped", full_width = FALSE) %>%
kable_styling(full_width = FALSE, position = "left",bootstrap_options = c("striped","hover")) %>%
scroll_box(width = "100%", height = "400px")
```
###daun 3hour sig DEG
```{r daun 3 hour sig DEG,}
total3 <- list(sigVDA3$ENTREZID,sigVDX3$ENTREZID,sigVEP3$ENTREZID,sigVMT3$ENTREZID)
ggVennDiagram(total3,
category.names = c("Daunorubicin","Doxorubicin","Epirubicin","Mitoxantrone"),
show_intersect = FALSE,
set_color = "black",
label = "both",
label_percent_digit = 1,
label_size = 3.5,
label_alpha = 0,
label_color = "black",
edge_lty = "solid") +
scale_x_continuous(expand = expansion(mult = .2))+
scale_fill_gradient(low = "red2", high = "yellow")+
labs(title = "3 hour comparison of significant genes", caption = "n = 554 genes")+
theme(plot.title = element_text(size = rel(1.5), hjust = 0.5))
list3totvenn3 <- get.venn.partitions(total3)
list24totvenn24 <- get.venn.partitions(total24)
Daun3sp <- list3totvenn3$..values..[[15]]
Daun24sp <- list24totvenn24$..values..[[15]]
DAspgostres3 <- gost(query = Daun3sp,
organism = "hsapiens",
ordered_query = TRUE,
domain_scope = "custom",
measure_underrepresentation = FALSE,
evcodes = FALSE,
user_threshold = 0.05,
correction_method = c("fdr"),
custom_bg = backGL$ENTREZID,
sources=c("GO:BP","KEGG"))
DAspp3 <- gostplot(DAspgostres3, capped = FALSE, interactive = TRUE)
DAspp3
DAsptable3 <- DAspgostres3$result %>%
dplyr::select(c(source, term_id,
term_name,intersection_size,
term_size, p_value))# %>%
DAspp3 <- gostplot(DAspgostres3, capped = FALSE, interactive = TRUE)
DAspp3
DAsptable3 <- DAspgostres3$result %>%
dplyr::select(c(source, term_id,
term_name,intersection_size,
term_size, p_value))# %>%
DAsptable3 %>%
dplyr::filter(source=="GO:BP") %>%
dplyr::select(p_value,term_name,intersection_size) %>%
slice_min(., n=10 ,order_by=p_value) %>%
mutate(log_val = -log10(p_value)) %>%
# slice_max(., n=10,order_by = p_value) %>%
ggplot(., aes(x = log_val, y =reorder(term_name,p_value), col= intersection_size)) +
geom_point(aes(size = intersection_size)) +
scale_y_discrete(labels = wrap_format(30))+
guides(col="none", size=guide_legend(title = "# of intersected \n terms"))+
ggtitle('Daunorubicin 3 hour GO:BP terms') +
xlab(expression(" -"~log[10]~(adj. p-value)))+
ylab("GO: BP term")+
theme_bw()+
theme(plot.title = element_text(size = rel(1.5), hjust = 0.5),
axis.title = element_text(size = 15, color = "black"),
axis.ticks = element_line(linewidth = 1.5),
axis.line = element_line(linewidth = 1.5),
axis.text = element_text(size = 10, color = "black", angle = 0),
strip.text.x = element_text(size = 15, color = "black", face = "bold"))
DAtable1 %>% mutate_at(.cols = 6, .funs= scientific_format()) %>%
kable(.,) %>%
kable_paper("striped", full_width = FALSE) %>%
kable_styling(full_width = FALSE, position = "left",bootstrap_options = c("striped","hover")) %>%
scroll_box(width = "100%", height = "400px")
#---------------
```
```{r daun specific Venn genes}
# 3 hour daun specific genes (venn)
DAgostres <- gost(query = Daun3sp, organism = "hsapiens",
ordered_query = TRUE,
domain_scope = "custom",
measure_underrepresentation = FALSE,
evcodes = FALSE,
user_threshold = 0.0001,
correction_method = c("fdr"),
custom_bg = backGL$ENTREZID,
sources=c("GO:BP","KEGG"))
DAspp3 <- gostplot(DAspgostres3, capped = FALSE, interactive = TRUE)
DAspp3
DAsptable3 <- DAspgostres3$result %>%
dplyr::select(c(source, term_id, term_name,intersection_size, term_size, p_value))
DAsptable3 %>%
dplyr::filter(source=="GO:BP") %>%
dplyr::select(p_value,term_name,intersection_size) %>%
slice_min(., n=10 ,order_by=p_value) %>%
mutate(log_val = -log10(p_value)) %>%
# slice_max(., n=10,order_by = p_value) %>%
ggplot(., aes(x = log_val, y =reorder(term_name,p_value), col= intersection_size)) +
geom_point(aes(size = intersection_size)) +
scale_y_discrete(labels = wrap_format(30))+
guides(col="none", size=guide_legend(title = "# of intersected \n terms"))+
ggtitle('Daunorubicin specific 3 hour GO:BP \nterms n = 350') +
xlab(expression(" -"~log[10]~("adj. p-value")))+
ylab("GO: BP term")+
theme_bw()+
theme(plot.title = element_text(size = rel(1.5), hjust = 0.5),
axis.title = element_text(size = 15, color = "black"),
axis.ticks = element_line(linewidth = 1.5),
axis.line = element_line(linewidth = 1.5),
axis.text = element_text(size = 10, color = "black", angle = 0),
strip.text.x = element_text(size = 15, color = "black", face = "bold"))
DAsptable3 %>% mutate_at(.cols = 6, .funs= scientific_format()) %>%
kable(.,) %>%
kable_paper("striped", full_width = FALSE) %>%
kable_styling(full_width = FALSE, position = "left",bootstrap_options = c("striped","hover")) %>%
scroll_box(width = "100%", height = "400px")
ggVennDiagram::ggVennDiagram(list(Daun3sp, sigVDA24$ENTREZID),
category.names = c("3 hours","24 hours"),
show_intersect = FALSE,
set_color = "black",
label = "both",
label_percent_digit = 1,
label_size = 3.5,
label_alpha = 0,
label_color = "black",
edge_lty = "solid") +
scale_x_continuous(expand = expansion(mult = .2))+
scale_fill_gradient(low = "red4", high = "tan1")+
labs(title = "3 hour venn with 24 hour Daun", caption = "n = 554 genes")+
theme(plot.title = element_text(size = rel(1.5), hjust = 0.5))
Dau3sp_Dau24sig <- get.venn.partitions(list(Daun3sp, sigVDA24$ENTREZID,DDEresp ))
dau3hoursp_ddesp <- Dau3sp_Dau24sig$..values..[[1]]
##gives 150 genes expressed in Daun only at 3 hours and in the DDE set of 4400 at 24 hours.
DAgostressp3 <- gost(query = dau3hoursp_ddesp, organism = "hsapiens",
ordered_query = TRUE,
domain_scope = "custom",
measure_underrepresentation = FALSE,
evcodes = FALSE,
user_threshold = 0.05,
correction_method = c("fdr"),
custom_bg = backGL$ENTREZID,
sources=c("GO:BP","KEGG"))
DAspp3 <- gostplot(DAgostressp3, capped = FALSE, interactive = TRUE)
DAspp3
DAsptable3 <- DAgostressp3$result %>%
dplyr::select(c(source, term_id, term_name,intersection_size, term_size, p_value))
DAsptable3 %>%
dplyr::filter(source=="GO:BP") %>%
dplyr::select(p_value,term_name,intersection_size) %>%
slice_min(., n=20,order_by=p_value) %>%
mutate(log_val = -log10(p_value)) %>%
# slice_max(., n=10,order_by = p_value) %>%
ggplot(., aes(x = log_val, y =reorder(term_name,p_value), col= intersection_size)) +
geom_point(aes(size = intersection_size)) +
scale_y_discrete(labels = wrap_format(30))+
guides(col="none", size=guide_legend(title = "# of intersected \n terms"))+
ggtitle('Daunorubicin 3 hour sp in DDE GO:BP \nterms n = 150') +
xlab(expression(" -"~log[10]~("adj. p-value")))+
ylab("GO: BP term")+
theme_bw()+
theme(plot.title = element_text(size = rel(1.5), hjust = 0.5),
axis.title = element_text(size = 15, color = "black"),
axis.ticks = element_line(linewidth = 1.5),
axis.line = element_line(linewidth = 1.5),
axis.text = element_text(size = 10, color = "black", angle = 0),
strip.text.x = element_text(size = 15, color = "black", face = "bold"))
# ---------------------------------------------------------
```
###Daunorubicin 24 sigDEG
```{r DA sig deg 24}
DAgostres24 <- gost(query = sigVDA24$ENTREZID,
organism = "hsapiens",
ordered_query = TRUE,
domain_scope = "custom",
measure_underrepresentation = FALSE,
evcodes = FALSE,
user_threshold = 0.0001,
correction_method = c("fdr"),
custom_bg = backGL$ENTREZID,
sources=c("GO:BP","KEGG"))
DAp24 <- gostplot(DAgostres24, capped = FALSE, interactive = TRUE)
DAp24
DAtable124 <- DAgostres24$result %>%
dplyr::select(c(source, term_id, term_name,intersection_size, term_size, p_value))
DAtable124 %>%
dplyr::filter(source=="GO:BP") %>%
dplyr::select(p_value,term_name,intersection_size) %>%
slice_min(., n=10 ,order_by=p_value) %>%
mutate(log_val = -log10(p_value)) %>%
# slice_max(., n=10,order_by = p_value) %>%
ggplot(., aes(x = log_val, y =reorder(term_name,p_value), col= intersection_size)) +
geom_point(aes(size = intersection_size)) +
scale_y_discrete(labels = wrap_format(30))+
guides(col="none", size=guide_legend(title = "# of intersected \n terms"))+
ggtitle('Daunorubicin 24 hour GO:BP terms') +
xlab(expression(" -"~log[10]~(adj. p-value)))+
ylab("GO: BP term")+
theme_bw()+
theme(plot.title = element_text(size = rel(1.5), hjust = 0.5),
axis.title = element_text(size = 15, color = "black"),
axis.ticks = element_line(linewidth = 1.5),
axis.line = element_line(linewidth = 1.5),
axis.text = element_text(size = 10, color = "black", angle = 0),
strip.text.x = element_text(size = 15, color = "black", face = "bold"))
DAtable124 %>% mmutate_at(.cols = 6, .funs= scientific_format()) %>%
kable(.,) %>%
kable_paper("striped", full_width = FALSE) %>%
kable_styling(full_width = FALSE, position = "left",bootstrap_options = c("striped","hover")) %>%
scroll_box(width = "100%", height = "400px")
#------------------------------------------------------
```
###Daunorubicin 3 v 24 intersection
```{r DA 3v24 int}
daun3v24int <- intersect(sigVDA3$ENTREZID,sigVDA24$ENTREZID)
DAgostresint <- gost(query = daun3v24int,
organism = "hsapiens",
ordered_query = TRUE,
domain_scope = "custom",
measure_underrepresentation = FALSE,
evcodes = FALSE,
user_threshold = 0.0001,
correction_method = c("fdr"),
custom_bg = backGL$ENTREZID,
sources=c("GO:BP","KEGG"))
DApint <- gostplot(DAgostresint, capped = FALSE, interactive = TRUE)
DApint
DAtable_int <- DAgostresint$result %>%
dplyr::select(c(source, term_id, term_name,intersection_size, term_size, p_value))
DAtable_int %>%
dplyr::filter(source=="GO:BP") %>%
dplyr::select(p_value,term_name,intersection_size) %>%
slice_min(., n=10 ,order_by=p_value) %>%
mutate(log_val = -log10(p_value)) %>%
ggplot(., aes(x = log_val, y =reorder(term_name,p_value),
col= intersection_size)) +
geom_point(aes(size = intersection_size)) +
scale_y_discrete(labels = wrap_format(30))+
guides(col="none",
size=guide_legend(title = "# of intersected \n terms"))+
ggtitle('Daunorubicin intersect 3 v 24 hour GO:BP terms') +
xlab(expression(" -"~log[10]~(adj. p-value)))+
ylab("GO: BP term")+
theme_bw()+
theme(plot.title = element_text(size = rel(1.5), hjust = 0.5),
axis.title = element_text(size = 15, color = "black"),
axis.ticks = element_line(linewidth = 1.5),
axis.line = element_line(linewidth = 1.5),
axis.text = element_text(size = 10, color = "black", angle = 0),
strip.text.x = element_text(size = 15, color = "black", face = "bold"))
DAtable_int %>%
mutate_at(.cols = 6, .funs= scientific_format()) %>%
kable(.,) %>%
kable_paper("striped", full_width = FALSE) %>%
kable_styling(full_width = FALSE, position = "left",bootstrap_options = c("striped","hover")) %>%
scroll_box(width = "100%", height = "400px")
```
##Doxorubicin 3 hour and 24 hour
```{r intial analysis DX3 and DX24, echo=FALSE, message=FALSE, warning=FALSE}
DXgostres <- gost(query = sigVDX3$ENTREZID,
organism = "hsapiens",
ordered_query = TRUE,
domain_scope = "custom",
measure_underrepresentation = FALSE,
evcodes = FALSE,
user_threshold = 0.05,
correction_method = c("fdr"),
custom_bg = backGL$ENTREZID,
sources=c("GO:BP","KEGG"))
DXp <- gostplot(DXgostres, capped = FALSE, interactive = TRUE)
DXp
DXtable1 <- DXgostres$result %>%
dplyr::select(c(source, term_id, term_name,intersection_size, term_size, p_value))
DXtable1 %>%
dplyr::filter(source=="GO:BP") %>%
dplyr::select(p_value,term_name,intersection_size) %>%
slice_min(., n=10 ,order_by=p_value) %>%
mutate(log_val = -log10(p_value)) %>%
# slice_max(., n=10,order_by = p_value) %>%
ggplot(., aes(x = log_val, y =reorder(term_name,p_value), col= intersection_size)) +
geom_point(aes(size = intersection_size)) +
scale_y_discrete(labels = wrap_format(30))+
guides(col="none", size=guide_legend(title = "# of intersected \n terms"))+
ggtitle('Doxorubicin 3 hour GO:BP terms') +
xlab(expression(" -"~log[10]~(adj. p-value)))+
ylab("GO: BP term")+
theme_bw()+
theme(plot.title = element_text(size = rel(1.5), hjust = 0.5),
axis.title = element_text(size = 15, color = "black"),
axis.ticks = element_line(linewidth = 1.5),
axis.line = element_line(linewidth = 1.5),
axis.text = element_text(size = 9, color = "black", angle = 0),
strip.text.x = element_text(size = 15, color = "black", face = "bold"))
DXtable1%>% mutate_at(.cols = 6, .funs= scientific_format()) %>%
kable(.,) %>%
kable_paper("striped", full_width = FALSE) %>%
kable_styling(full_width = FALSE, position = "left",bootstrap_options = c("striped","hover")) %>%
scroll_box(width = "100%", height = "400px")
# ---------------------------------------------------------
gostres24 <- gost(query = sigVDX24$ENTREZID,
organism = "hsapiens",
ordered_query = TRUE,
domain_scope = "custom",
measure_underrepresentation = FALSE,
evcodes = FALSE,
user_threshold = 0.0001,
correction_method = c("fdr"),
custom_bg = backGL$ENTREZID,
sources=c("GO:BP","KEGG"))
p24 <- gostplot(gostres24, capped = FALSE, interactive = TRUE)
p24
DXtable124 <- gostres24$result %>%
dplyr::select(c(source, term_id, term_name,intersection_size, term_size, p_value))
table124 %>%
dplyr::filter(source=="GO:BP") %>%
dplyr::select(p_value,term_name,intersection_size) %>%
slice_min(., n=10 ,order_by=p_value) %>%
mutate(log_val = -log10(p_value)) %>%
# slice_max(., n=10,order_by = p_value) %>%
ggplot(., aes(x = log_val, y =reorder(term_name,p_value), col= intersection_size)) +
geom_point(aes(size = intersection_size)) +
scale_y_discrete(labels = wrap_format(30))+
guides(col="none", size=guide_legend(title = "# of intersected\n terms"))+
ggtitle('Doxorubicin 24 hour GO:BP terms') +
xlab(expression(" -"~log[10]~(adj. p-value)))+
ylab("GO: BP term")+
theme_bw()+
theme(plot.title = element_text(size = rel(1.5), hjust = 0.5),
axis.title = element_text(size = 15, color = "black"),
axis.ticks = element_line(linewidth = 1.5),
axis.line = element_line(linewidth = 1.5),
axis.text = element_text(size = 10, color = "black", angle = 0),
strip.text.x = element_text(size = 15, color = "black", face = "bold"))
DXtable124 %>%
mutate_at(.cols = 6, .funs= scientific_format()) %>%
kable(.,) %>%
kable_paper("striped", full_width = FALSE) %>%
kable_styling(full_width = FALSE, position = "left",bootstrap_options = c("striped","hover")) %>%
scroll_box(width = "100%", height = "400px")
```
##Epirubicin
```{r intial analysis EP3 and EP24, echo=FALSE, message=FALSE, warning=FALSE}
EPgostres <- gost(query = sigVEP3$ENTREZID, organism = "hsapiens",
ordered_query = TRUE,
domain_scope = "custom",
measure_underrepresentation = FALSE,
evcodes = FALSE,
user_threshold = 0.01,
correction_method = c("fdr"),
custom_bg = backGL$ENTREZID,
sources=c("GO:BP","KEGG"))
EPp <- gostplot(EPgostres, capped = FALSE, interactive = TRUE)
EPp
EPtable1 <- EPgostres$result %>%
dplyr::select(c(source, term_id, term_name,intersection_size, term_size, p_value))
EPtable1 %>%
dplyr::filter(source=="GO:BP") %>%
dplyr::select(p_value,term_name,intersection_size) %>%
slice_min(., n=10 ,order_by=p_value) %>%
mutate(log_val = -log10(p_value)) %>%
# slice_max(., n=10,order_by = p_value) %>%
ggplot(., aes(x = log_val, y =reorder(term_name,p_value), col= intersection_size)) +
geom_point(aes(size = intersection_size)) +
scale_y_discrete(labels = wrap_format(30))+
guides(col="none", size=guide_legend(title = "# of intersected \n terms"))+
ggtitle('Epirubicin 3 hour top ten GO:BP terms') +
xlab(expression(" -"~log[10]~(adj. p-value)))+
ylab("GO: BP term")+
theme_bw()+
theme(plot.title = element_text(size = rel(1.5), hjust = 0.5),
axis.title = element_text(size = 15, color = "black"),
axis.ticks = element_line(linewidth = 1.5),
axis.line = element_line(linewidth = 1.5),
axis.text = element_text(size = 10, color = "black", angle = 0),
strip.text.x = element_text(size = 15, color = "black", face = "bold"))
EPtable1%>%
mutate_at(.cols = 6, .funs= scientific_format()) %>%
kable(.,) %>%
kable_paper("striped", full_width = FALSE) %>%
kable_styling(full_width = FALSE, position = "left",bootstrap_options = c("striped","hover")) %>%
scroll_box(width = "100%", height = "400px")
# ---------------------------------------------------------
EPgostres24 <- gost(query = sigVEP24$ENTREZID,
organism = "hsapiens",
ordered_query = TRUE,
domain_scope = "custom",
measure_underrepresentation = FALSE,
evcodes = FALSE,
user_threshold = 0.0001,
correction_method = c("fdr"),
custom_bg = backGL$ENTREZID,
sources=c("GO:BP","KEGG"))
EPp24 <- gostplot(EPgostres24, capped = FALSE, interactive = TRUE)
EPp24
EPtable124 <- EPgostres24$result %>%
dplyr::select(c(source, term_id, term_name,intersection_size, term_size, p_value))
EPtable124 %>%
dplyr::filter(source=="GO:BP") %>%
dplyr::select(p_value,term_name,intersection_size) %>%
slice_min(., n=10 ,order_by=p_value) %>%
mutate(log_val = -log10(p_value)) %>%
# slice_max(., n=10,order_by = p_value) %>%
ggplot(., aes(x = log_val, y =reorder(term_name,p_value), col= intersection_size)) +
geom_point(aes(size = intersection_size)) +
scale_y_discrete(labels = wrap_format(30))+
guides(col="none", size=guide_legend(title = "# of intersected \n terms"))+
ggtitle('Epirubicin 24 hour top 10 GO:BP terms') +
xlab(expression(" -"~log[10]~(adj. p-value)))+
ylab("GO: BP term")+
theme_bw()+
theme(plot.title = element_text(size = rel(1.5), hjust = 0.5),
axis.title = element_text(size = 15, color = "black"),
axis.ticks = element_line(linewidth = 1.5),
axis.line = element_line(linewidth = 1.5),
axis.text = element_text(size = 10, color = "black", angle = 0),
strip.text.x = element_text(size = 15, color = "black", face = "bold"))
EPtable124%>%
mutate_at(.cols = 6, .funs= scientific_format()) %>%
kable(.,) %>%
kable_paper("striped", full_width = FALSE) %>%
kable_styling(full_width = FALSE, position = "left",bootstrap_options = c("striped","hover")) %>%
scroll_box(width = "100%", height = "400px")
##epi 24 specifi n = 533
epsp24 <- list24totvenn24$..values..[[12]]
mtsp24 <- list24totvenn24$..values..[[8]]
EPgostres24sp <- gost(query = epsp24,
organism = "hsapiens",
ordered_query = TRUE,
domain_scope = "custom",
measure_underrepresentation = FALSE,
evcodes = FALSE,
user_threshold = 0.05,
correction_method = c("fdr"),
custom_bg = backGL$ENTREZID,
sources=c("GO:BP","KEGG"))
EPsptable124 <- EPgostres24sp$result %>%
dplyr::select(c(source, term_id, term_name,intersection_size, term_size, p_value))
MTgostres24sp <- gost(query = mtsp24,
organism = "hsapiens",
ordered_query = TRUE,
domain_scope = "custom",
measure_underrepresentation = FALSE,
evcodes = FALSE,
user_threshold = 0.05,
correction_method = c("fdr"),
custom_bg = backGL$ENTREZID,
sources=c("GO:BP","KEGG"))
MTsptable124 <- MTgostres24sp$result %>%
dplyr::select(c(source, term_id, term_name,intersection_size, term_size, p_value))
MTsptable124%>%
dplyr::filter(source=="GO:BP") %>%
dplyr::select(p_value,term_name,intersection_size) %>%
slice_min(., n=10 ,order_by=p_value) %>%
mutate(log_val = -log10(p_value)) %>%
# slice_max(., n=10,order_by = p_value) %>%
ggplot(., aes(x = log_val, y =reorder(term_name,p_value), col= intersection_size)) +
geom_point(aes(size = intersection_size)) +
scale_y_discrete(labels = wrap_format(30))+
guides(col="none", size=guide_legend(title = "# of intersected \n terms"))+
ggtitle("Mitoxantrone specific 24 hour top GO:BP terms") +
xlab(expression(" -"~log[10]~"(adj p-value)"))+
ylab("GO: BP term")+
theme_bw()+
theme(plot.title = element_text(size = rel(1.5), hjust = 0.5),
axis.title = element_text(size = 15, color = "black"),
axis.ticks = element_line(linewidth = 1.5),
axis.line = element_line(linewidth = 1.5),
axis.text = element_text(size = 10, color = "black", angle = 0),
strip.text.x = element_text(size = 15, color = "black", face = "bold"))
```
##Mitoxantrone
```{r intial analysis MT3 and MT24, echo=FALSE, message=FALSE, warning=FALSE}
MTgostres <- gost(query = sigVMT3$ENTREZID, organism = "hsapiens",
ordered_query = TRUE,
domain_scope = "custom",
measure_underrepresentation = FALSE,
evcodes = FALSE,
user_threshold = 0.0001,
correction_method = c("fdr"),
custom_bg = backGL$ENTREZID,
sources=c("GO:BP","KEGG"))
MTp <- gostplot(MTgostres, capped = FALSE, interactive = TRUE)
MTp
MTtable1 <- MTgostres$result %>%
dplyr::select(c(source, term_id, term_name,intersection_size, term_size, p_value))
MTtable1 %>%
dplyr::filter(source=="GO:BP") %>%
dplyr::select(p_value,term_name,intersection_size) %>%
slice_min(., n=10 ,order_by=p_value) %>%
mutate(log_val = -log10(p_value)) %>%
# slice_max(., n=10,order_by = p_value) %>%
ggplot(., aes(x = log_val, y =reorder(term_name,p_value), col= intersection_size)) +
geom_point(aes(size = intersection_size)) +
scale_y_discrete(labels = wrap_format(30))+
guides(col="none", size=guide_legend(title = "# of intersected \n terms"))+
ggtitle('Mitoxatrone 3 hour GO:BP terms') +
xlab(expression(" -"~log[10]~(adj p-value)))+
ylab("GO: BP term")+
theme_bw()+
theme(plot.title = element_text(size = rel(1.5), hjust = 0.5),
axis.title = element_text(size = 15, color = "black"),
axis.ticks = element_line(linewidth = 1.5),
axis.line = element_line(linewidth = 1.5),
axis.text = element_text(size = 10, color = "black", angle = 0),
strip.text.x = element_text(size = 15, color = "black", face = "bold"))
MTtable1 %>%
mutate_at(.cols = 6, .funs= scientific_format()) %>%
kable(.,) %>%
kable_paper("striped", full_width = FALSE) %>%
kable_styling(full_width = FALSE, position = "left",bootstrap_options = c("striped","hover")) %>%
scroll_box(width = "100%", height = "400px")
# ---------------------------------------------------------
MTgostres24 <- gost(query = sigVMT24$ENTREZID,
organism = "hsapiens",
ordered_query = TRUE,
domain_scope = "custom",
measure_underrepresentation = FALSE,
evcodes = FALSE,
user_threshold = 0.0001,
correction_method = c("fdr"),
custom_bg = backGL$ENTREZID,
sources=c("GO:BP","KEGG"))
MTp24 <- gostplot(MTgostres24, capped = FALSE, interactive = TRUE)
MTp24
MTtable124 <- MTgostres24$result %>%
dplyr::select(c(source, term_id, term_name,intersection_size, term_size, p_value))
MTtable124 %>% dplyr::filter(source=="GO:BP") %>%
dplyr::select(p_value,term_name,intersection_size) %>%
slice_min(., n=10 ,order_by=p_value) %>%
mutate(log_val = -log10(p_value)) %>%
# slice_max(., n=10,order_by = p_value) %>%
ggplot(., aes(x = log_val, y =reorder(term_name,p_value), col= intersection_size)) +
geom_point(aes(size = intersection_size)) +
scale_y_discrete(labels = wrap_format(30))+
guides(col="none", size=guide_legend(title = "# of intersected \n terms"))+
ggtitle('Mitoxantrone 24 hour GO:BP terms') +
xlab(expression(" -"~log[10]~(adj. p-value)))+
ylab("GO: BP term")+
theme_bw()+
theme(plot.title = element_text(size = rel(1.5), hjust = 0.5),
axis.title = element_text(size = 15, color = "black"),
axis.ticks = element_line(linewidth = 1.5),
axis.line = element_line(linewidth = 1.5),
axis.text = element_text(size = 10, color = "black", angle = 0),
strip.text.x = element_text(size = 15, color = "black", face = "bold"))
MTtable124 %>%
mutate_at(.cols = 6, .funs= scientific_format()) %>%
kable(.,) %>%
kable_paper("striped", full_width = FALSE) %>%
kable_styling(full_width = FALSE, position = "left",bootstrap_options = c("striped","hover")) %>%
scroll_box(width = "100%", height = "400px")
```
```{r up down trial data3, eval=FALSE, message=FALSE, warning=FALSE, include=FALSE}
#results_sig = subset(sigVDA3,adj.P.Val < 0.05)
# # get the significant up-regulated genes
# up = subset(sigVDA3, logFC > 0)
# # get the significant down-regulated genes
# down = subset(sigVDA3, logFC < 0)
# gp_up = gost(query = up$ENTREZID, organism = "hsapiens",
# ordered_query = TRUE,
# domain_scope = "custom",
# measure_underrepresentation = FALSE,
# evcodes = FALSE,
# user_threshold = 0.001,
# correction_method = c("fdr"),
# custom_bg = backGL$ENTREZID,
# sources=c("GO:BP","GO:MF", "GO:CC"))
#
#
# #gp_down = gost(query = down$ENTREZID, organism = "hsapiens",
# # ordered_query = TRUE,
# # domain_scope = "custom",
# # measure_underrepresentation = FALSE,
# # evcodes = FALSE,
# # user_threshold = 0.05,
# # correction_method = c("bonferroni"),
# # custom_bg = backGL$ENTREZID,
# # sources=c("GO:BP","GO:MF", "GO:CC"))
# p2_up <- gostplot(gp_up, capped = FALSE, interactive = TRUE)
#
# p2_up #+ ggtitle("Daunorubicin up regulated gene enrichment at 3 hours")
```
```{r showing it all, eval = FALSE, echo=FALSE, message=FALSE, warning=FALSE}
#p2_down <- gostplot(gp_down, capped = FALSE, interactive = TRUE)
#p2_down #+ ggtitle("Daunorubicin down regulated gene enrichment at 3 hours")
```
##Venn Diagrams
```{r venndiagram, echo=FALSE, message=FALSE, warning=FALSE}
total24 <-list(sigVDA24$ENTREZID,sigVDX24$ENTREZID,sigVEP24$ENTREZID,sigVMT24$ENTREZID)
in_common24 <-c(sigVDA24$ENTREZID,sigVDX24$ENTREZID,sigVEP24$ENTREZID,sigVMT24$ENTREZID)
length(unique(in_common24))
ggVennDiagram(total24,
category.names = c("Daunorubicin\n n = 7518",
"Doxorubicin\n n = 6793","Epirubicin\n n = 6783","Mitoxantrone\n n = 1213"),
show_intersect = FALSE,
set_color = "black",
catagory_size = c(6,6,6,6),
label = "both",
label_percent_digit = 1,
label_size = 3,
label_alpha = 0,
label_color = "black",
edge_lty = "solid", set_size = )+
scale_x_continuous(expand = expansion(mult = .3))+
scale_y_continuous(expand = expansion(mult = .2))+
#scale_color_brewer(palette = "Dark2",name = "Individual",)
scale_fill_distiller(palette="RdYlBu")+
labs(title = "24 hour comparison of significant DE genes", caption = "n = 8887 genes")+
theme(plot.title = element_text(size = rel(1.6), hjust = 0.5, vjust =1))
```
```{r 3 hours, echo=FALSE, message=FALSE, warning=FALSE}
# total 3 ----------------------------------------------------------------
total3 <- list(sigVDA3$ENTREZID,sigVDX3$ENTREZID,sigVEP3$ENTREZID,sigVMT3$ENTREZID)
totalin_common3 <- c(sigVDA3$SYMBOL,sigVDX3$SYMBOL,sigVEP3$SYMBOL,sigVMT3$SYMBOL)
length(unique(totalin_common3))
ggVennDiagram(total3,
category.names = c("Daunorubicin\nn = 523",
"Doxorubicin\nn = 25",
"Epirubicin\nn = 179",
"Mitoxantrone\nn = 52"),
show_intersect = FALSE,
set_color = "black",
catagory_size = c(6,6,6,6),
label = "both",
label_percent_digit = 1,
label_size = 3,
label_alpha = 0,
label_color = "black",
edge_lty = "solid", set_size = )+
scale_x_continuous(expand = expansion(mult = .3))+
scale_y_continuous(expand = expansion(mult = .2))+
#scale_color_brewer(palette = "Dark2",name = "Individual",)
scale_fill_distiller(palette="RdYlBu")+
labs(title = "3 hour comparison of significant DE genes", caption = "n = 554 genes")+
theme(plot.title = element_text(size = rel(1.6), hjust = 0.5, vjust =1))
```
```{r 3V 24 BY DRUG, eval=FALSE, include=FALSE}
# Dauno comp --------------------------------------------------------------
Dauncomp <- list(sigVDA24$ENTREZID,sigVDA3$ENTREZID)
in_commonDa <- c(sigVDA24$ENTREZID,sigVDA3$ENTREZID)
length(unique(in_commonDa))
ggVennDiagram(Dauncomp,
category.names = c("Daunorubicin-24","Daunorubicin-3"),
show_intersect = FALSE,
set_color = "black",
label = "both",
label_percent_digit = 1,
label_size = 3,
label_alpha = 0,
label_color = "black",
edge_lty = "solid", set_size = )+
scale_x_continuous(expand = expansion(mult = .2))+
scale_fill_gradient(low = "light blue", high = "yellow")+
labs(title = "Comparision of Dauno 3h v 24h", caption = "n = 7732 genes")+
theme(plot.title = element_text(size = rel(1.5), hjust = 0.5))
#Davenlist <- intersect(Dauncomp[[1]],Dauncomp[[2]])
# Doxocomp ----------------------------------------------------------------
Doxcomp <- list(sigVDX24$ENTREZID,sigVDX3$ENTREZID)
in_commonDx <- c(sigVDX24$ENTREZID,sigVDX3$ENTREZID)
length(unique(in_commonDx))
ggVennDiagram(Doxcomp,
category.names = c("Doxorubicin-24","Doxorubicin-3"),
show_intersect = FALSE,
set_color = "black",
label = "both",
label_percent_digit = 1,
label_size = 3,
label_alpha = 0,
label_color = "black",
edge_lty = "solid", set_size = )+
scale_x_continuous(expand = expansion(mult = .2))+
scale_fill_gradient(low = "light blue", high = "yellow")+
labs(title = "Comparision of Doxo 3h v 24h", caption = "n = 6808 genes")+
theme(plot.title = element_text(size = rel(1.5), hjust = 0.5))
#Dxvenlist <- intersect(Doxcomp[[1]],Doxcomp[[2]])
#length(intersect(Dxvenlist,Davenlist))## 7 of DX are in DA
# Epi Comp ----------------------------------------------------------------
Epicomp <- list(sigVEP24$ENTREZID,sigVEP3$ENTREZID)
in_commonEp <- c(sigVEP24$ENTREZID,sigVEP3$ENTREZID)
length(unique(in_commonEp))
ggVennDiagram(Epicomp,
category.names = c("Epirubicin-24","Epirubicin-3"),
show_intersect = FALSE,
set_color = "black",
label = "both",
label_percent_digit = 1,
label_size = 3,
label_alpha = 0,
label_color = "black",
edge_lty = "solid", set_size = )+
scale_x_continuous(expand = expansion(mult = .2))+
scale_fill_gradient(low = "light blue", high = "yellow")+
labs(title = "Comparision of Epi 3h v 24h", caption = "n = 6858 genes")+
theme(plot.title = element_text(size = rel(1.5), hjust = 0.5))
#Epvenlist <- intersect(Epicomp[[1]],Epicomp[[2]])
# qA <- (intersect(Epvenlist , Davenlist))##76 are are in da
# qB <- (intersect(Dxvenlist, Epvenlist))#y are in Ep from Dx
# #ACintersect <- intersect(qA,qB)##total of 6 are in all 3 comparisons
# #ggVennDiagram(qA,qB)
#
# qA
# qB
# Mito comp ---------------------------------------------------------------
Mitocomp <- list(sigVMT24$ENTREZID,sigVMT3$ENTREZID)
in_commonMt <-c(sigVMT24$ENTREZID,sigVMT3$ENTREZID)
length(unique(in_commonMt))
ggVennDiagram(Mitocomp,
category.names = c("Mitoxantrone-24","Mitoxantrone-3"),
show_intersect = FALSE,
set_color = "black",
label = "both",
label_percent_digit = 1,
label_size = 3,
label_alpha = 0,
label_color = "black",
edge_lty = "solid", set_size = )+
scale_x_continuous(expand = expansion(mult = .21))+
scale_fill_gradient(low = "light blue", high = "yellow")+
labs(title = "Comparision of Mito 3h v 24h", caption = "n = 1251 genes")+
theme(plot.title = element_text(size = rel(1.5), hjust = 0.5))
#Mtvenlist <- intersect(Mitocomp[[1]],Mitocomp[[2]])
#intersect(Mtvenlist,ACintersect)
#
# AC comparison -----------------------------------------------------------
ACcomp <- list(sigVDA24$ENTREZID,sigVDX24$ENTREZID,sigVEP24$ENTREZID,sigVDA3$ENTREZID,sigVDX3$ENTREZID,sigVEP3$ENTREZID)
in_commonAC <-c(sigVDA24$ENTREZID,sigVDX24$ENTREZID,sigVEP24$ENTREZID,sigVDA3$ENTREZID,sigVDX3$ENTREZID,sigVEP3$ENTREZID)
length(unique(in_commonAC))
ggVennDiagram(ACcomp,
category.names = c("Daunorubicin-24","Doxorubicin-24", "Epirubicin-24","Daunorubicin-3","Doxorubicin-3", "Epirubicin-3"),
show_intersect = FALSE,
set_color = "black",
label = "both",
label_percent_digit = 1,
label_size = 3,
label_alpha = 0,
label_color = "black",
edge_lty = "solid", set_size = )+
scale_x_continuous(expand = expansion(mult = .21))+
scale_fill_gradient(low = "purple", high = "yellow")+
labs(title = "Comparision AC 3h v 24h", caption = "n = 8925 genes")+
theme(plot.title = element_text(size = rel(1.5), hjust = 0.5))
```
Tell me more! what are those genes at 24 hours?? give me some GO!
# Graphing GO of the Venn results
```{r Making Go lists from SigDE genes, message=FALSE, warning=FALSE, paged.print=TRUE}
list24totvenn <- get.venn.partitions(total24)
# > list24totvenn$..count..
# [1] 960 13 19 15 37 18 25 126 4440 265 538 533 661 399 838
# > list24totvenn$..values..[?]
# ##From Cormotif
##pairwise
DDEresp<- list24totvenn$..values..[[9]]
write.csv(DDEresp,"data/DDEresp_list.csv")
DDEMresp<- list24totvenn$..values..[[1]]
DXsprespon<- list24totvenn$..values..[[14]]
# top2bi <- read_csv("data/Top2biresp_cluster24h.csv",col_select = x, col_types = "c")
# NRresp <- read_csv("data/nonresponse_cluster24h.csv",col_select =x,col_types = "c")
complete <- c(sigVDA24$ENTREZID,sigVDX24$ENTREZID,sigVEP24$ENTREZID,sigVMT24$ENTREZID, sigVDA3$ENTREZID, sigVDX3$ENTREZID, sigVEP3$ENTREZID, sigVMT3$ENTREZID)
complete <- as.data.frame(unique(complete))
colnames(complete) <- "ENTREZID" #9047 genes
NoResp <- backGL %>% anti_join(.,(complete), by = "ENTREZID") #5776 genes