-
Notifications
You must be signed in to change notification settings - Fork 0
/
diffAnal_GOenrich_Clustering_Bcells.R
1903 lines (1628 loc) · 111 KB
/
diffAnal_GOenrich_Clustering_Bcells.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
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
## Load packages ------------------------------------------
library(tidyverse)
library(ggplot2)
library(ggpubr)
library(ggstatsplot)
library(plotly)
library(magrittr)
library(limma)
library(Glimma)
library(edgeR)
library(FactoMineR)
library(factoextra)
library(DESeq2)
library(RColorBrewer)
library(gplots)
library(cluster)
library(mclust)
library(org.Hs.eg.db)
library(clusterProfiler)
library(DOSE)
library(msigdbr)
library(ReactomePA)
library(enrichplot)
library(igraph)
library(Factoshiny)
library(pheatmap)
library(VennDiagram)
library(eulerr)
library(heatmap3)
library(ggpubr)
library(GGally)
## Functions ----------------------------------------------
# Source functions from the .r file.
source("/home/costas/devel/u-paris/diffAnalysis_GOenrich_Clustering_Bcells/diffAnal_GOenrich_Clustering_Bcells_FunctionSource.r")
## Preprocess data DE ------------------------------------
# Load the counts table.
countsTableRaw <- read.table("data/countsTOTALS_CodingGenes.tsv", header = TRUE, sep = "\t")
# Compute the CPM
cpmall <- as.data.frame(cpm(countsTableRaw))
# Divide the Counts Table
countsTableRawT <- countsTableRaw[,1:6]
countsTableRawM <- countsTableRaw[,7:12]
countsTableRawL <- countsTableRaw[,13:18]
countsTableRawH <- countsTableRaw[,19:24]
# Form the proper factors for naming.
groupsformatrix_M <- factor(c("MonoH", "MonoH", "MonoH", "MonoL", "MonoL", "MonoL"), levels = c("MonoH", "MonoL"))
groupsformatrix_L <- factor(c("LightH", "LightH", "LightH", "LightL", "LightL", "LightL"), levels = c("LightH", "LightL"))
groupsformatrix_H <- factor(c("HeavyH", "HeavyH", "HeavyH", "HeavyL", "HeavyL", "HeavyL"), levels = c("HeavyH", "HeavyL"))
groupsformatrix_T <- factor(c("TotalH", "TotalH", "TotalH", "TotalL", "TotalL", "TotalL"), levels = c("TotalH", "TotalL"))
groupsall <- factor(c("Mono", "Mono", "Mono", "Mono", "Mono", "Mono",
"Light", "Light", "Light", "Light", "Light", "Light",
"Heavy", "Heavy", "Heavy", "Heavy", "Heavy", "Heavy",
"Total", "Total", "Total", "Total", "Total", "Total"),
levels = c("Mono", "Light", "Heavy", "Total"));
treasAll <- as.factor(c("High", "High", "High", "Low", "Low", "Low")) ## WHY this thing exists two times we do not know.
treasAll <- as.factor(c(rep(c("High", "High", "High", "Low", "Low", "Low"), 4)));
# Compute the CPM for each division.
cpmtmpM <- cpm(countsTableRawM)
cpmtmpL <- cpm(countsTableRawL)
cpmtmpH <- cpm(countsTableRawH)
cpmtmpT <- cpm(countsTableRawT)
# Remove genes with CPM < 1
cpmtmpM <- cpmtmpM[apply(cpmtmpM > 1, 1, all),]
cpmtmpL <- cpmtmpL[apply(cpmtmpL > 1, 1, all),]
cpmtmpH <- cpmtmpH[apply(cpmtmpH > 1, 1, all),]
cpmtmpT <- cpmtmpT[apply(cpmtmpT > 1, 1, all),]
# Filter the CPM,
cpmallM <- filter_low_expression(cpmtmpM, groupsformatrix_M, thres = 4, samples = 2)
cpmallL <- filter_low_expression(cpmtmpL, groupsformatrix_L, thres = 4, samples = 2)
cpmallH <- filter_low_expression(cpmtmpH, groupsformatrix_H, thres = 4, samples = 2)
cpmallT <- filter_low_expression(cpmtmpT, groupsformatrix_T, thres = 4, samples = 2)
# Collect all the names of filtered genes.
cpm_Filt_names <- unique(c(rownames(cpmallM), rownames(cpmallL), rownames(cpmallH), rownames(cpmallT)))
# Extract the counts of the filtered genes.
countsTable_H <- countsTableRawH[rownames(cpmallH),]
countsTable_L <- countsTableRawL[rownames(cpmallL),]
countsTable_M <- countsTableRawM[rownames(cpmallM),]
countsTable_T <- countsTableRawT[rownames(cpmallT),]
countsTableAll <- countsTableRaw[cpm_Filt_names,]
cpmAll_Filt <- cpmall[cpm_Filt_names, ]
### Quality Control Plots ---------------------------------
## PCA on counts.
res.pca.Counts = PCA(t(countsTableAll), graph = FALSE)
fviz_pca_ind(res.pca.Counts,
fill.ind = groupsall, col.var = "black", repel = TRUE,
col.ind = groupsall, # colorer by groups
palette = c("#00AFBB", "#E7B800", "#FC4E07", "orange"),
addEllipses = TRUE, # Ellipses de concentration
legend.title = "Groups",
title = "PCA on the Polysome profile counts table.")
## PCA on CPMs
res.pca.CPMs = PCA(t(cpmAll_Filt), graph = FALSE)
fviz_pca_ind(res.pca.CPMs,
fill.ind = groupsall, col.var = "black", repel = TRUE,
col.ind = groupsall, # colorer by groups
palette = c("#00AFBB", "#E7B800", "#FC4E07", "orange"),
addEllipses = TRUE, # Ellipses de concentration
legend.title = "Groups",
title = "PCA on the Polysome profile CPMs table.")
# Cluster transcriptome CPMs.
hcT <- hclust(dist(t(cpmallT)), method = "ward.D2")
clus2 = cutree(hcT, 2)
colCl <- c("green", "red")
plot(as.dendrogram(hcT))
fviz_dend(hcT, cex = 1.5, main = "", k =2, k_colors = c("#00AFBB", "#FC4E07"), color_labels_by_k = TRUE, xlab = "Total mRNA samples", ylab = "", sub = "", ggtheme = theme_ggstatsplot())
## Differential Expression analyses -----------------------
# Form the design matrices
designMat_M <- model.matrix(~0+groupsformatrix_M)
colnames(designMat_M) <- levels(groupsformatrix_M)
designMat_L <- model.matrix(~0+groupsformatrix_L)
colnames(designMat_L) <- levels(groupsformatrix_L)
designMat_H <- model.matrix(~0+groupsformatrix_H)
colnames(designMat_H) <- levels(groupsformatrix_H)
designMat_T <- model.matrix(~0+groupsformatrix_T)
colnames(designMat_T) <- levels(groupsformatrix_T)
# Form the contrast matrices
contr.matrix_M <- makeContrasts(
Monosomes_HvsL = MonoH - MonoL,
levels = colnames(designMat_M))
contr.matrix_L <- makeContrasts(
LightPoly_HvsL = LightH - LightL,
levels = colnames(designMat_L))
contr.matrix_H <- makeContrasts(
HeavyPoly_HvsL = HeavyH - HeavyL,
levels = colnames(designMat_H))
contr.matrix_T <- makeContrasts(
Total_HvsL = TotalH - TotalL,
levels = colnames(designMat_T))
### DiffExp Monosomes -------------------------------------
vmM <- voom(countsTable_M, designMat_M, plot = TRUE)
fitM <- lmFit(vmM, designMat_M)
vfitM <- contrasts.fit(fitM, contrasts = contr.matrix_M)
efitM <- eBayes(vfitM, robust = TRUE) # Playing with the parameters of ebayes makes no difference.
efM <- decideTests(efitM, p.value = 0.05, lfc = 0.5)
summary(efM)
plotSA(efitM, main = "SA plot for monosomes L/H")
tfitM <- treat(vfitM, lfc = log2(1.1))
ttM <- decideTests(tfitM)
summary(ttM)
plotMD(efitM, column = 1, status = efM[,1], main = colnames(efitM)[1], ylim = c( -1.5, 1.5))
# For the manuscript figure.
par(mar = c(7,6,3,0))
plotMD(efitM, column = 1, status = efM[,1], ylim = c( -1.5, 1.5), xlab = "Average log occupancy", ylab= "log Fold-Change", main = "Monosome occupancy on High vs. Low glucose", hl.col = c("lightgreen", "red3"), cex.lab = 2, cex.axis = 2, cex = 2, cex.main = 2, legend = FALSE)
### DiffExp Light ribosomes -------------------------------
vmL <- voom(countsTable_L, designMat_L, plot = TRUE)
fitL <- lmFit(vmL, designMat_L)
vfitL <- contrasts.fit(fitL, contrasts = contr.matrix_L)
efitL <- eBayes(vfitL, robust = TRUE) # Playing with the parameters of ebayes makes no difference.
efL <- decideTests(efitL, p.value = 0.05, lfc = 0.5)
summary(efL)
plotSA(efitL, main = "SA plot for light polysomes L/H")
tfitL <- treat(vfitL, lfc = log2(1.1))
ttL <- decideTests(tfitL)
summary(ttL)
plotMD(efitL, column = 1, status = efL[,1], main = colnames(efitL)[1], ylim = c( -1.5, 1.5))
# For the manuscript figure.
par(mar = c(7,6,3,0))
plotMD(efitL, column = 1, status = efL[,1], ylim = c( -1.5, 1.5), xlab = "Average log occupancy", ylab= "log Fold-Change", main = "Light-polysomes occupancy on High vs. Low glucose", hl.cex = 2, hl.col = c("lightgreen", "red3"), cex.lab = 2, cex.axis = 2, cex = 2, cex.main = 1.75, legend = FALSE)
### DiffExp Heavy ribosomes -------------------------------
vmH <- voom(countsTable_H, designMat_H, plot = TRUE)
fitH <- lmFit(vmH, designMat_H)
vfitH <- contrasts.fit(fitH, contrasts = contr.matrix_H)
efitH <- eBayes(vfitH, robust = TRUE) # Playing with the parameters of ebayes makes no difference.
efH <- decideTests(efitH,p.value = 0.05, lfc = 0.5)
summary(efH)
plotSA(efitH, main = "SA plot for heavy polysomes L/H")
tfitH <- treat(vfitH, lfc = log2(1.1))
ttH <- decideTests(tfitH)
summary(ttH)
plotMD(efitH, column = 1, status = efH[,1], main = colnames(efitH)[1],ylim = c( -1.5, 1.5))
# For the manuscript figure.
par(mar = c(7,6,3,0))
plotMD(efitH, column = 1, status = efH[,1], ylim = c( -1.5, 1.5), xlab = "Average log occupancy", ylab= "log Fold-Change", main = "Heavy-polysomes occupancy on High vs. Low glucose", hl.cex = 2, hl.col = c("lightgreen", "red3"), cex.lab = 2, cex.axis = 2, cex = 2, cex.main = 1.75, legend = FALSE)
### DiffExp Total RNA -------------------------------------
vmT <- voom(countsTable_T, designMat_T, plot = TRUE)
fitT <- lmFit(vmT, designMat_T)
vfitT <- contrasts.fit(fitT, contrasts = contr.matrix_T)
efitT <- eBayes(vfitT, robust = TRUE) # Playing with the parameters of ebayes makes no difference.
efT <- decideTests(efitT, p.value = 0.05, lfc = 0.5)
summary(efT)
efitTtab <- topTable(efitT, p.value = 0.05, lfc = 0.5, number = "ALL")
efitTtab$GeneName <- as.vector(mapIds(org.Hs.eg.db, keys = rownames(efitTtab), column = "SYMBOL", keytype = "ENSEMBL", multiVals = "first"))
write.table(efitTtab, file = "degs_RNAtotal_201911.tab", quote = FALSE, sep = "\t")
plotSA(efitT, main = "SA plot for RNA total L/H")
tfitT <- treat(vfitT, lfc = log2(1.1))
ttT <- decideTests(tfitT, p.value = 0.05)
summary(ttT)
plotMD(efitT, column = 1, status = efT[,1], main = colnames(efitT)[1], ylim = c( -1.1, 1.1))
plotMD(tfitT, column = 1, status = ttT[,1], main = colnames(tfitT)[1], ylim = c( -1.1, 1.1))
# For the manuscript figure.
par(mar = c(7,6,3,0))
plotMD(efitT, column = 1, status = efT[,1], ylim = c( -1, 1), xlab = "Average log expression", ylab= "log Fold-Change", main = "Total RNA abundance on High vs. Low glucose", hl.cex = 2, hl.col = c("lightgreen", "red3"), cex.lab = 2, cex.axis = 2, cex = 2, cex.main = 1.75, legend = FALSE)
### Toptables ---------------------------------------------
DEH <- topTable(efitH, coef = 1, p.value = 0.05, lfc = 0.5, number = Inf)
DEL <- topTable(efitL, coef = 1, p.value = 0.05, lfc = 0.5, number = Inf)
DEM <- topTable(efitM, coef = 1, p.value = 0.05, lfc = 0.5, number = Inf)
DET <- topTable(efitT, coef = 1, p.value = 0.05, lfc = 0.5, number = Inf)
DEHup <- subset(DEH, DEH$logFC > 0)
DEHdown <- subset(DEH, DEH$logFC < 0)
DELup <- subset(DEL, DEL$logFC > 0)
DELdown <- subset(DEL, DEL$logFC < 0)
DETup <- subset(DET, DET$logFC > 0)
DETdown <- subset(DET, DET$logFC < 0)
degs <- union(rownames(DEL), rownames(DEH))
write(degs, "degs_17092020_geneNames.txt")
### Venn diagrams -----------------------------------------
# Intersection between Light, Heavy, Total
# DEPRECATED vennALL <- venn.diagram(list(Heavy = rownames(DEH), Light = rownames(DEL), Total = rownames(DET)), NULL, fill = c("darkorange1", "deepskyblue3", "darkolivegreen4"), alpha = c(0.5, 0.5, 0.5), cex = 3) DEPRECATED #
# Venn diagrams with eulerr package
polyVenn <- list("Heavy_UP" = rownames(DEHup), "Light_UP" = rownames(DELup), "Total_UP" = rownames(DETup), "Heavy_DOWN" = rownames(DEHdown), "Light_DOWN" = rownames(DELdown), "Total_DOWN" = rownames(DETdown))
plot(euler(polyVenn, shape = "ellipse"), quantities = TRUE)
# VEnn diagram figure 1 paper.
#### Process Translation data --------------------------
tpmPPglu <- read.table("data/polysomeProfile_TPM_proteinCoding.csv", header = TRUE, sep = ",")
row_NON_zero <- apply(tpmPPglu, 1, function(row) all(row != 0))
tpmPPgluClean <- tpmPPglu[row_NON_zero,]
# Then we collect the genes and remove the total.
tpmDEGs <- tpmPPglu[degs,]
tpmDEGs <- tpmDEGs[,1:18]
# Calculate means of each group
monoHdeg <- rowMeans(tpmDEGs[,1:3])
monoLdeg <- rowMeans(tpmDEGs[,4:6])
lightHdeg <- rowMeans(tpmDEGs[,7:9])
lightLdeg <- rowMeans(tpmDEGs[,10:12])
heavyHdeg <- rowMeans(tpmDEGs[,13:15])
heavyLdeg <- rowMeans(tpmDEGs[,16:18])
monoHall <- rowMeans(tpmPPgluClean[,1:3])
monoLall <- rowMeans(tpmPPgluClean[,4:6])
lightHall <- rowMeans(tpmPPgluClean[,7:9])
lightLall <- rowMeans(tpmPPgluClean[,10:12])
heavyHall <- rowMeans(tpmPPgluClean[,13:15])
heavyLall <- rowMeans(tpmPPgluClean[,16:18])
# Calculate the ratios.
ratioHall <- log2(heavyHall/heavyLall)
ratioLall <- log2(lightHall/lightLall)
ratioMall <- log2(monoHall/monoLall)
ratioHdeg <- log2(heavyHdeg/heavyLdeg)
ratioLdeg <- log2(lightHdeg/lightLdeg)
ratioMdeg <- log2(monoHdeg/monoLdeg)
# Put the logRatios all in a dataframe.
logRatiosDEG <- data.frame("Mono" = ratioMdeg, "Light" = ratioLdeg, "Heavy" = ratioHdeg, row.names = rownames(tpmDEGs))
logRatiosALL <- data.frame("Mono" = ratioMall, "Light" = ratioLall, "Heavy" = ratioHall, row.names = rownames(tpmPPgluClean))
## Enrichments --------------------------------------------
# Generate the gene list.
geneListENS <- logRatiosDEG[["Heavy"]]
names(geneListENS) <- degs
geneListENS <- sort(geneListENS, decreasing = TRUE)
genesENS <- degs
# Generate a gene list with gene symbols too
geneConv <- bitr(degs, fromType = "ENSEMBL", toType = c("SYMBOL"), OrgDb = org.Hs.eg.db)
rownames(geneConv) <- geneConv[["ENSEMBL"]]
geneConv$ENSEMBL <- NULL
genesSYMB <- vector()
for (name in names(geneListENS)) {
nSymb <- geneConv[name,]
genesSYMB <- append(genesSYMB, nSymb)
}
geneListSYMB <- geneListENS
names(geneListSYMB) <- genesSYMB
# Create the "universe" gene set (this is a set of all the "detected" genes)
row_NON_zero <- apply(tpmPPglu, 1, function(row) all(row != 0))
tpmPPgluClean <- tpmPPglu[row_NON_zero,]
univPPglu <- rownames(tpmPPgluClean)
geneConv2 <- bitr(univPPglu, fromType = "ENSEMBL", toType = c("SYMBOL"), OrgDb = org.Hs.eg.db)
univPPglu2 <- geneConv2[["SYMBOL"]]
## MSIGDB enrichment
m_df <- msigdbr(species = "Homo sapiens")
m_df$gs_id <- m_df$gene_symbol # BIG TRICK TO SWAP THE COLUMN NAMES!!!!!!
# Gene enrichment
esigDEGs <- enricher(genesSYMB, universe = univPPglu2, TERM2GENE = m_df, minGSSize = 50, maxGSSize = 1000) # One can play arounf with the set sizes to obtain something meaningfull.
barplot(esigDEGs, showCategory = 50, title = "BarPlot DEGs MsiGDB enrichment")
dotplot(esigDEGs, showCategory = 50, title = "DotPlot DEGs MsiGDB enrichment")
# Gene set enrichment
esigsDEGs <- GSEA(geneListSYMB, minGSSize = 20, TERM2GENE = m_df)
dotplot(esigsDEGs, showCategory = 50, title = "DotPlot MsiGDB DEGS GSEA")
### GO enrichments ----------------------------------------
# GO group enrichment
ggoDEGs_MF2 <- groupGO(gene = genesENS, OrgDb = org.Hs.eg.db, ont = "MF", level = 2, keyType = "ENSEMBL", readable = TRUE)
barplot(ggoDEGs_MF2, showCategory = 30, title = "GroupGO DEGs MF_2")
ggoDEGs_MF4 <- groupGO(gene = genesENS, OrgDb = org.Hs.eg.db, ont = "MF", level = 4, keyType = "ENSEMBL", readable = TRUE)
barplot(ggoDEGs_MF4, showCategory = 60, title = "GroupGO DEGs MF_4")
ggoDEGs_BP2 <- groupGO(gene = genesENS, OrgDb = org.Hs.eg.db, ont = "BP", level = 2, keyType = "ENSEMBL", readable = TRUE)
barplot(ggoDEGs_BP2, showCategory = 30, title = "GroupGO DEGs BP_2")
ggoDEGs_BP4 <- groupGO(gene = genesENS, OrgDb = org.Hs.eg.db, ont = "BP", level = 4, keyType = "ENSEMBL", readable = TRUE)
barplot(ggoDEGs_BP4, showCategory = 100, title = "GroupGO DEGs BP_4")
# GO enrichment
egoDEGs_MF <- enrichGO(gene = genesENS, OrgDb = org.Hs.eg.db, ont = "MF", pAdjustMethod = "BH", pvalueCutoff = 0.05, universe = univPPglu, keyType = "ENSEMBL", readable = TRUE)
dotplot(egoDEGs_MF, title = "GO enrichment DEGs MF")
egoDEGs_BP <- enrichGO(gene = genesENS, OrgDb = org.Hs.eg.db, ont = "BP", pAdjustMethod = "BH", pvalueCutoff = 0.05, universe = univPPglu, keyType = "ENSEMBL", readable = TRUE)
dotplot(egoDEGs_BP, title = "GO enrichment DEGs BP")
# and one for ALL
egoDEGs_ALL <- enrichGO(gene = genesENS, OrgDb = org.Hs.eg.db, ont = "ALL", pAdjustMethod = "BH", pvalueCutoff = 0.05, universe = univPPglu, keyType = "ENSEMBL", pool = TRUE, readable = TRUE)
dotplot(egoDEGs_ALL, title = "ALL GO enrichment DEGs")
# GO GSEA enrichment
egogsDEGs_MF <- gseGO(geneList = geneListSYMB, OrgDb = org.Hs.eg.db, ont = "MF", nPerm = 1000, pvalueCutoff = 0.05, keyType = "SYMBOL")
dotplot(egogsDEGs_MF, title = "GSEA GO MF DEGs")
egogsDEGs_BP <- gseGO(geneList = geneListSYMB, OrgDb = org.Hs.eg.db, ont = "BP", nPerm = 1000, pvalueCutoff = 0.05, keyType = "SYMBOL")
dotplot(egogsDEGs_BP, title = "GSEA GO BP DEGs")
egogsDEGs_ALL <- gseGO(geneList = geneListSYMB, OrgDb = org.Hs.eg.db, ont = "ALL", nPerm = 1000, pvalueCutoff = 0.05, keyType = "SYMBOL")
dotplot(egogsDEGs_ALL, title = "GSEA GO ALL DEGs")
#TODO include the WikiPathways enrichments also!
## Perform KEEG pathway enrichment.
# Convert ENSEMBL IDs to ENTREZ
genesENTREZ <- as.character(mapIds(org.Hs.eg.db, genesENS, "ENTREZID", "ENSEMBL"))
# Enrich KEGG pathways
ekegDEGs <- enrichKEGG(gene = genesENTREZ, organism = "hsa", pvalueCutoff = 0.05)
barplot(ekegDEGs, title = "DEGs KEGG enrichment") # Only one "ribosome"
# Enrich KEGG modules
ekegMDGEs <- enrichMKEGG(gene = genesENTREZ, organism = "hsa", pvalueCutoff = 0.05)
barplot(ekegMDGEs, title = "DEGs KEGG modules enrichment") # Only one "ribosome"
# Enrich REACTOME Pathways
ekePDEGs <- enrichPathway(gene = genesENTREZ, organism = "human", pvalueCutoff = 0.05)
barplot(ekePDEGs, showCategory = 30, title = "DEGs REACTOME Pathways enrichment")
dotplot(ekePDEGs, showCategory = 20, font.size = 18) #, title = "DEGs REACTOME Pathways enrichment")
### Enrichment Visualisation ------------------------------
# Category Network (CNET) plots (perhaps the most usefull!)
cnetplot(egoDEGs_MF, foldChange = geneListENS, colorEdge = TRUE, showCategory = 10) + ggtitle("CNETplot GOenrich DEGs MF")
cnetplot(egoDEGs_BP, foldChange = geneListENS, colorEdge = TRUE, showCategory = 10) + ggtitle("CNETplot GOenrich DEGs BP")
cnetplot(egoDEGs_ALL, foldChange = geneListENS, colorEdge = TRUE, showCategory = 10) + ggtitle("CNETplot GOenrich DEGs ALL")
# Paper figure 2A
egoDEGs_MF_paper <- egoDEGs_MF
egoDEGs_MF_paper@result <- egoDEGs_MF@result[-c(2, 9),] # Remove two redundant categories
cnetplot(egoDEGs_MF_paper, foldChange = geneListENS, colorEdge = TRUE, showCategory = 8,cex_category =2, cex_label_category = 1.5, cex_gene =0.75, shadowtext= 'category')
# Paper figure 2B
egoDEGs_BP_paper <- egoDEGs_BP
egoDEGs_BP_paper@result <- egoDEGs_BP@result[-c(1,2,5,6),] # remove 4 redundant categories
cnetplot(egoDEGs_BP_paper, foldChange = geneListENS, colorEdge = TRUE, showCategory = 6, cex_category = 1.5, cex_label_category = 1.4, cex_gene = 0.5, cex_label_gene = 1, shadowtext= 'category')
cnetplot(egogsDEGs_MF, foldChange = geneListSYMB, colorEdge = TRUE, showCategory = 10) + ggtitle("CNETplot GOgsea DEGs MF")
cnetplot(egogsDEGs_BP, foldChange = geneListSYMB, colorEdge = TRUE, showCategory = 10) + ggtitle("CNETplot GOgsea DEGs BP")
cnetplot(egogsDEGs_ALL, foldChange = geneListSYMB, colorEdge = TRUE, showCategory = 10) + ggtitle("CNETplot GOgsea DEGs ALL")
cnetplot(ekePDEGs, foldChange = geneListSYMB, colorEdge = TRUE, symbol = "ENSEMBL") + ggtitle("CNETplot GOgsea DEGs ALL")
## Clustering -------------------------------------------
my_palette <- brewer.pal(n = 11, name = "RdYlGn")
### Hierarchical Clustering -------------------------------
# Clustering.
hc_S <- hclust(dist(logRatiosDEG), method = "single")
# define clusters (hard threshold)
hc_S_Cls <- cutree(hc_S, h = max(hc_S$height/4))
# Colour vector for clusters side bar.
myCols_hc_S <- rainbow(length(unique(hc_S_Cls)))mclust
myClusts_hc_S <- myCols_hc_S[hc_S_Cls]
heatmap.2(as.matrix(logRatiosDEG), main = "DEGs logRatio H/L HClust Single", Rowv = as.dendrogram(hc_S), Colv = FALSE, dendrogram = "row", col = my_palette, cexCol = 1.5, cexRow = 0.5, key.title = NA, keysize = 0.8, key.xlab = NA, ylab = "Genes", RowSideColors = myClusts_hc_S)
# Independent clustering just for comparison.
heatmap.2(as.matrix(logRatiosDEG), main = "DEGs logRatio H/L HClust Average", dendrogram = "row", Colv = FALSE, col = my_palette, cexCol = 1.5, cexRow = 0.5, key.title = NA, keysize = 0.8, key.xlab = NA, ylab = "Genes", hclustfun = function(x) hclust(x, method = "average"))
heatmap.2(as.matrix(logRatiosDEG), main = "DEGs logRatio H/L HClust Ward", dendrogram = "row", Colv = FALSE, col = my_palette, cexCol = 1.5, cexRow = 0.5, key.title = NA, keysize = 0.8, key.xlab = NA, ylab = "Genes", hclustfun = function(x) hclust(x, method = "ward.D2"))
heatmap.2(as.matrix(logRatiosDEG), main = "DEGs logRatio H/L HClust Single", dendrogram = "row", Colv = FALSE, col = my_palette, cexCol = 1.5, cexRow = 0.5, key.title = NA, keysize = 0.8, key.xlab = NA, ylab = "Genes", hclustfun = function(x) hclust(x, method = "single"))
heatmap.2(as.matrix(logRatiosDEG), main = "DEGs logRatio H/L HClust Complete", dendrogram = "row", Colv = FALSE, col = my_palette, cexCol = 1.5, cexRow = 0.5, key.title = NA, keysize = 0.8, key.xlab = NA, ylab = "Genes", hclustfun = function(x) hclust(x, method = "complete"))
## Visualise results from different clustering algorithms.
# Hierarchical clustering
clustH.res <- hclust(dist(logRatiosDEG), method = "ward.D2")
fviz_cluster(clustH.res, data = logRatiosDEG, ellipse.type = "convex") + theme_minimal()
# K-means
kmeans4.res <- kmeans(scale(logRatiosDEG), 4)
kmeans5.res <- kmeans(scale(logRatiosDEG), 5)
plot_semiSupervised_clust(logRatiosDEG, 4, "kmeans")
fviz_cluster(kmeans5.res, data = logRatiosDEG, ellipse.type = "convex") + theme_minimal()
# PAM
pam4.res <- pam(logRatiosDEG, 4)
pam5.res <- pam(logRatiosDEG, 5)
plot_semiSupervised_clust(logRatiosDEG, 4, "pam")
plot_semiSupervised_clust(logRatiosDEG, 5, "pam")
fviz_cluster(pam5.res, data = logRatiosDEG, ellipse.type = "convex") + theme_minimal()
# MClust!
mclust.res <- Mclust(logRatiosDEG)
fviz_cluster(mclust.res, data = logRatiosDEG, ellipse.type = "convex") + theme_minimal()
### We choose the MClust method!
plot_unSupervised_clust(logRatiosDEG, "Mclust")
# The paper figure.
par(mar = c(0,0,0,0))
heatmap.2(as.matrix(logRatiosDEG)[order(mclust.res$classification),], Colv = NA, Rowv = NA, labRow = NA, cexCol = 4, col = my_palette, RowSideColors = brewer.pal(n = 6, name = "Dark2")[as.factor(as.character(sort(mclust.res$classification)))], trace = "none", lwid = c(0.8, 3), lhei = c(0.7, 3), margins = c(9,0), srtCol = 45, key.ylab = "Density", key.xlab = "logOdds", key.title = "")
#mtext("Genes", side = 4, cex = 2.5, padj = -1.5)
#mtext(colnames(logRatiosDEG), cex = 2, side = 1, srt = 45, padj = -5)
legend("bottomleft", legend=c(1:6), fill = brewer.pal(6, "Dark2"), border = brewer.pal(6, "Dark2"), cex = 2.5, bty = "n", y.intersp = 1.7, title = "Cluster")
# TODO 3D interactive plot of the MClust result.
## RNA Features analysis ----------------------------------
# Prepare the features data frame.q
clusterGeneIDs <- clustRes$df["cluster"]
featuresDF <- read.table("rnaFeat/201905/degs_02052019_ENSEMBL.tab", header = TRUE, sep = "\t")
# Create a slice with only the numeric values of the data frame.
featDF <- featuresDF[,c(1:15)]
# Add the clustering column
featDF["Cluster"] <- 0
for (r in row.names(featDF)) {
geneID <- as.character(featDF[r,]$ensembl_gene_id);
featDF[r,]$Cluster <- clusterGeneIDs[geneID,];
}
# Add the translation column.
featDF["Translation"] <- "a"
# Characterise the clusters based on translation behaviour.
#! ATTENTION !# This is ONLY for the specific clustering result!
for (r in row.names(featDF)) {
if (featDF[r,]$Cluster %in% c(1,6)) featDF[r,]$Translation <- "Up"
if (featDF[r,]$Cluster %in% c(4,5)) featDF[r,]$Translation <- "Down"
if (featDF[r,]$Cluster %in% c(2,3)) featDF[r,]$Translation <- "Inter"
}
# Features correlations
## BOXPLOTS ---------
# Coding length boxplots
clCD <- ggplot(featDF[featDF$coding_len <= 4000,], aes(x = Cluster, y = coding_len, fill = Cluster)) + theme_pubr() + scale_fill_brewer(palette="Dark2") +
#ggtitle("Coding length distributions of the 6 MClust clusters")
geom_boxplot(varwidth = TRUE, alpha = 0.5, notch = TRUE, outlier.shape = NA) +
geom_jitter(alpha=0.4, shape = 16, color = "grey2", position = position_jitter(width = 0.1, height = 0)) +
scale_x_discrete(limits = c("1","2","3","4","5","6")) +
theme(legend.position = "none", axis.title.x=element_blank()) +
ylab("Coding Length") + xlab("Clusters")
#stat_summary(fun.data = n_fun, geom = "text", hjust = 0.5, position = "fill") +
#stat_compare_means(comparisons = list(c(1, 2), c(1, 3), c(1, 4), c(1, 5), c(6, 2), c(6, 3), c(6, 4), c(6, 5), c(2, 4), c(3, 5)), method = "t.test", tip.length = 0, hide.ns = TRUE, size = 2.5)
clCDa <- ggbetweenstats( # Group clusters
ggtheme = theme_pubr(), ylab = "Coding Length",
data = featDF[featDF$coding_len <= 4000,], # Select the ones less than 4000.
x = Cluster, y = coding_len,
notch = TRUE, point.jitter.width = 1,
type = "np", conf.level = 0.95, var.equal = FALSE,
point.args = list(position = ggplot2::position_jitterdodge(dodge.width = 0.2), alpha = 0.5, size = 4, stroke = 0),
k = 0, mean.point.args = list(size = 1.5, color = "darkred"),
pairwise.comparisons = TRUE, results.subtitle = TRUE, sample.size.label = TRUE, mean.plotting = TRUE, # Set FALSE for the manuscript figure.
title = "Coding length distributions of the 6 MClust clusters")
trCDa <- ggbetweenstats( # Group translation
ggtheme = theme_ggstatsplot(), ylab = "Coding Length", xlab = "",
data = featDF[featDF$coding_len <= 4000,],
x = Translation, y = coding_len,
notch = TRUE, point.jitter.width = 1,
type = "np", conf.level = 0.95, var.equal = FALSE,
point.args = list(position = ggplot2::position_jitterdodge(dodge.width = 0.2), alpha = 0.5, size = 4, stroke = 0),
k = 0, mean.point.args = list(size = 1.5, color = "darkred"),
pairwise.comparisons = TRUE, results.subtitle = TRUE, sample.size.label = TRUE, mean.plotting = TRUE, # Set FALSE for the manuscript figure.
title = "Coding length distributions of the 3 translation behaviours")
# GC content boxplots
clGC <- ggplot(featDF, aes(x = Cluster, y = GC, fill = Cluster)) + theme_pubr() +
scale_fill_brewer(palette="Dark2") +
coord_cartesian(ylim = c(30, 75)) +
#ggtitle("Transcript GC content distributions of the 6 Mclust clusters") +
geom_boxplot(varwidth = TRUE, alpha = 0.5, notch = TRUE, outlier.shape = NA) +
geom_jitter(alpha=0.4, shape = 16, color = "grey2", position = position_jitter(width = 0.1, height = 0)) +
theme(legend.position = "none", axis.title.x=element_blank()) +
scale_x_discrete(limits = c("1","2","3","4","5","6")) +
ylab("GC") + xlab("Clusters")
#stat_summary(fun.data = n_fun, geom = "text", hjust = 0.5, position = "fill") +
#stat_compare_means(comparisons = list(c(1, 2), c(1, 3), c(1, 4), c(1, 5), c(6, 2), c(6, 3), c(6, 4), c(6, 5), c(2, 4), c(3, 5)), method = "t.test", tip.length = 0, hide.ns = TRUE, size = 2.5)
clGCa <- ggbetweenstats( # Group clusters
ggtheme = theme_pubr(),
data = featDF, ylab = "GC",
x = Cluster, y = GC,
notch = TRUE, point.jitter.width = 1,
type = "np", conf.level = 0.95, var.equal = FALSE,
point.args = list(position = ggplot2::position_jitterdodge(dodge.width = 0.2), alpha = 0.5, size = 4, stroke = 0),
k = 1, mean.point.args = list(size = 1.5, color = "darkred"),
pairwise.comparisons = TRUE, results.subtitle = TRUE, sample.size.label = TRUE, mean.plotting = TRUE, # Set FALSE for the manuscript figure.
title = "GC content distributions of the 6 MClust clusters")
trGCa <- ggbetweenstats( # Group translation
ggtheme = theme_ggstatsplot(),
data = featDF[featDF$coding_len <= 4000,], ylab = "GC",
x = Translation, y = GC,
notch = TRUE, point.jitter.width = 1,
type = "np", conf.level = 0.95, var.equal = FALSE,
point.args = list(position = ggplot2::position_jitterdodge(dodge.width = 0.2), alpha = 0.5, size = 4, stroke = 0),
k = 1, mean.point.args = list(size = 1.5, color = "darkred"),
pairwise.comparisons = TRUE, results.subtitle = TRUE, sample.size.label = TRUE, mean.plotting = TRUE, # Set FALSE for the manuscript figure.
title = "GC content distributions of the 3 translation behaviours")
# 5'UTR length boxplots
cl5pLEN <- ggplot(featDF[featDF$len_5pUTR <= 800 & featDF$len_5pUTR != 0,], aes(x = Cluster, y = len_5pUTR, fill = Cluster)) + theme_pubr() +
scale_fill_brewer(palette="Dark2") +
#ggtitle("5'UTR length distributions of the 6 Mclust cluster") +
geom_boxplot(varwidth = TRUE, alpha = 0.5, notch = TRUE, outlier.shape = NA) +
geom_jitter(alpha=0.4, shape = 16, color = "grey2", position = position_jitter(width = 0.1, height = 0)) +
theme(legend.position = "none", axis.title.x=element_blank()) +
scale_x_discrete(limits = c("1","2","3","4","5","6")) +
ylab("5'UTR length") + xlab("Clusters")
#stat_summary(fun.data = n_fun, geom = "text", hjust = 0.5, position = "fill") +
#stat_compare_means(comparisons = list(c(1, 2), c(1, 3), c(1, 4), c(1, 5), c(6, 2), c(6, 3), c(6, 4), c(6, 5), c(2, 4), c(3, 5)), method = "t.test", tip.length = 0, hide.ns = TRUE, size = 2.5)
cl5pLENa <- ggbetweenstats( # Group clusters
ggtheme = theme_pubr(),
data = featDF[featDF$len_5pUTR <= 1000,], ylab = "5'UTR length",
x = Cluster, y = len_5pUTR,
notch = TRUE, point.jitter.width = 1,
type = "np", conf.level = 0.95, var.equal = FALSE,
point.args = list(position = ggplot2::position_jitterdodge(dodge.width = 0.2), alpha = 0.5, size = 4, stroke = 0),
k = 0, mean.point.args = list(size = 1.5, color = "darkred"),
pairwise.comparisons = TRUE, results.subtitle = TRUE, sample.size.label = TRUE, mean.plotting = TRUE, # Set FALSE for the manuscript figure.
title = "5'UTR length distributions of the 6 MClust clusters")
tr5pLENa <- ggbetweenstats( # Group translation
ggtheme = theme_ggstatsplot(),
data = featDF[featDF$len_5pUTR <= 1000,], ylab = "5'UTR length",
x = Translation, y = len_5pUTR,
notch = TRUE, point.jitter.width = 1,
type = "np", conf.level = 0.95, var.equal = FALSE,
point.args = list(position = ggplot2::position_jitterdodge(dodge.width = 0.2), alpha = 0.5, size = 4, stroke = 0),
k = 0, mean.point.args = list(size = 1.5, color = "darkred"),
pairwise.comparisons = TRUE, results.subtitle = TRUE, sample.size.label = TRUE, mean.plotting = TRUE, # Set FALSE for the manuscript figure.
title = "5'UTR length distributions of the 3 translation behaviours")
# 5'UTR GC boxplots
cl5pGC <- ggplot(featDF[featDF$len_5pUTR != 0,], aes(x = Cluster, y = GC_5pUTR, fill = Cluster)) + theme_pubr() +
scale_fill_brewer(palette="Dark2") +
#ggtitle("5'UTR GC distributions of the 6 Mclust cluster") +
geom_boxplot(varwidth = TRUE, alpha = 0.5, notch = TRUE, outlier.shape = NA) +
geom_jitter(alpha=0.4, shape = 16, color = "grey2", position = position_jitter(width = 0.1, height = 0)) +
theme(legend.position = "none", axis.title.x=element_blank()) +
scale_x_discrete(limits = c("1","2","3","4","5","6")) +
ylab("5'UTR GC") + xlab("Clusters")
#stat_summary(fun.data = n_fun, geom = "text", hjust = 0.5, position = "fill") +
#stat_compare_means(comparisons = list(c(1, 2), c(1, 3), c(1, 4), c(1, 5), c(6, 2), c(6, 3), c(6, 4), c(6, 5), c(2, 4), c(3, 5)), method = "t.test", tip.length = 0, hide.ns = TRUE, size = 2.5)
cl5pGCa <- ggbetweenstats( # Group clusters
ggtheme = theme_pubr(),
data = featDF[featDF$len_5pUTR > 1,], ylab = "GC 5pUTR",
x = Cluster, y = GC_5pUTR,
notch = TRUE, point.jitter.width = 1,
type = "np", conf.level = 0.95, var.equal = FALSE,
point.args = list(position = ggplot2::position_jitterdodge(dodge.width = 0.2), alpha = 0.5, size = 4, stroke = 0),
k = 1, mean.point.args = list(size = 1.5, color = "darkred"),
pairwise.comparisons = TRUE, results.subtitle = TRUE, sample.size.label = TRUE, mean.plotting = TRUE, # Set FALSE for the manuscript figure.
title = "5'UTR GC distributions of the 6 MClust clusters")
tr5pGCa <- ggbetweenstats( # Group translation
ggtheme = theme_ggstatsplot(),
data = featDF[featDF$GC_5pUTR >= 25,], ylab = "GC 5pUTR",
x = Translation, y = GC_5pUTR,
notch = TRUE, point.jitter.width = 1,
type = "np", conf.level = 0.95, var.equal = FALSE,
point.args = list(position = ggplot2::position_jitterdodge(dodge.width = 0.2), alpha = 0.5, size = 4, stroke = 0),
k = 1, mean.point.args = list(size = 1.5, color = "darkred"),
pairwise.comparisons = TRUE, results.subtitle = TRUE, sample.size.label = TRUE, mean.plotting = TRUE, # Set FALSE for the manuscript figure.
title = "5'UTR GC distributions of the 3 translation behaviours")
# 5'UTR MFE boxplots
cl5pMFE <- ggplot(featDF[featDF$MFE_5pUTR > -400 & featDF$len_5pUTR != 0,], aes(x = Cluster, y = MFE_5pUTR, fill = Cluster)) + theme_pubr() +
scale_fill_brewer(palette="Dark2") +
#coord_cartesian(ylim = c(-400, 0)) +
#ggtitle("5'UTR MFE distributions of the 6 Mclust cluster") +
geom_boxplot(varwidth = TRUE, alpha = 0.5, notch = TRUE, outlier.shape = NA) +
geom_jitter(alpha=0.4, shape = 16, color = "grey2", position = position_jitter(width = 0.1, height = 0)) +
theme(legend.position = "none", axis.title.x=element_blank()) +
scale_x_discrete(limits = c("1","2","3","4","5","6")) +
ylab("5'UTR MFE") #+ xlab("Clusters")
#stat_summary(fun.data = n_fun, geom = "text", hjust = 0.5, position = "fill") +
#stat_compare_means(comparisons = list(c(1, 2), c(1, 3), c(1, 4), c(1, 5), c(6, 2), c(6, 3), c(6, 4), c(6, 5), c(2, 4), c(3, 5)), method = "t.test", tip.length = 0, hide.ns = TRUE, size = 2.5)
cl5pMFEa <- ggbetweenstats( # Group clusters
ggtheme = theme_pubr(),
data = featDF[featDF$MFE_5pUTR >= -400,], ylab = "5'UTR MFE",
x = Cluster, y = MFE_5pUTR,
notch = TRUE, point.jitter.width = 1,
type = "np", conf.level = 0.95, var.equal = FALSE,
point.args = list(position = ggplot2::position_jitterdodge(dodge.width = 0.2), alpha = 0.5, size = 4, stroke = 0),
k = 0, mean.point.args = list(size = 1.5, color = "darkred"),
pairwise.comparisons = TRUE, results.subtitle = TRUE, sample.size.label = TRUE, mean.plotting = TRUE, # Set FALSE for the manuscript figure.
title = "5'UTR MFE distributions of the 6 MClust clusters")
tr5pMFEa <- ggbetweenstats( # Group translation
ggtheme = theme_ggstatsplot(),
data = featDF[featDF$MFE_5pUTR >= -400,], ylab = "5'UTR MFE",
x = Translation, y = MFE_5pUTR,
type = "np", conf.level = 0.95, var.equal = FALSE,
point.args = list(position = ggplot2::position_jitterdodge(dodge.width = 0.2), alpha = 0.5, size = 4, stroke = 0),
k = 0, mean.point.args = list(size = 1.5, color = "darkred"),
pairwise.comparisons = TRUE, results.subtitle = TRUE, sample.size.label = TRUE, mean.plotting = TRUE, # Set FALSE for the manuscript figure.
title = "MFE 5'UTR distributions of the 3 translation behaviours")
# 5UTR MFE_BP boxplots
cl5pMfeBP <- ggplot(featDF[featDF$len_5pUTR > 1,], aes(x = Cluster, y = MfeBP_5pUTR, fill = Cluster)) + theme_pubr() +
scale_fill_brewer(palette="Dark2") +
#ggtitle("5'UTR MFE per BP distributions of the 6 Mclust cluster") +
geom_boxplot(varwidth = TRUE, alpha = 0.5, notch = TRUE, outlier.shape = NA) +
geom_jitter(alpha=0.4, shape = 16, color = "grey2", position = position_jitter(width = 0.1, height = 0)) +
theme(legend.position = "none", axis.title.x=element_blank()) +
scale_x_discrete(limits = c("1","2","3","4","5","6")) +
ylab("5'UTR MFE") #+ xlab("Clusters")
#stat_summary(fun.data = n_fun, geom = "text", hjust = 0.5, position = "fill") +
#stat_compare_means(comparisons = list(c(1, 2), c(1, 3), c(1, 4), c(1, 5), c(6, 2), c(6, 3), c(6, 4), c(6, 5), c(2, 4), c(3, 5)), method = "t.test", tip.length = 0, hide.ns = TRUE, size = 2.5)
cl5pMfeBPa <- ggbetweenstats( # Group clusters
ggtheme = theme_pubr(),
data = featDF[featDF$MfeBP_5pUTR != 0,], ylab = "5'UTR MFE/BP",
x = Cluster, y = MfeBP_5pUTR,
notch = TRUE, point.jitter.width = 1,
type = "np", conf.level = 0.95, var.equal = FALSE,
point.args = list(position = ggplot2::position_jitterdodge(dodge.width = 0.2), alpha = 0.5, size = 4, stroke = 0),
k = 2, mean.point.args = list(size = 1.5, color = "darkred"),
pairwise.comparisons = TRUE, results.subtitle = TRUE, sample.size.label = TRUE, mean.plotting = TRUE, # Set FALSE for the manuscript figure.
title = "MFE per BP 5'UTR distributions of the 6 MClust clusters")
tr5pMfeBPa <- ggbetweenstats( # Group translation
ggtheme = theme_ggstatsplot(),
data = featDF[featDF$MfeBP_5pUTR != 0,], ylab = "5'UTR MFE/BP",
x = Translation, y = MfeBP_5pUTR,
notch = TRUE, point.jitter.width = 1,
type = "np", conf.level = 0.95, var.equal = FALSE,
point.args = list(position = ggplot2::position_jitterdodge(dodge.width = 0.2), alpha = 0.5, size = 4, stroke = 0),
k = 2, mean.point.args = list(size = 1.5, color = "darkred"),
pairwise.comparisons = TRUE, results.subtitle = TRUE, sample.size.label = TRUE, mean.plotting = TRUE, # Set FALSE for the manuscript figure.
title = "MFE per BP 5'UTR distributions of the 3 translation behaviours")
# 3UTR lengths boxplots
cl3pLEN <- ggplot(featDF[featDF$len_3pUTR <= 4000 & featDF$len_3pUTR !=0,], aes(x = Cluster, y = len_3pUTR, fill = Cluster)) + theme_pubr() +
scale_fill_brewer(palette="Dark2") +
#ggtitle("3'UTR length distributions of the 6 Mclust cluster") +
geom_boxplot(varwidth = TRUE, alpha = 0.5, notch = TRUE, outlier.shape = NA) +
geom_jitter(alpha=0.4, shape = 16, color = "grey2", position = position_jitter(width = 0.1, height = 0)) +
theme(legend.position = "none", axis.title.x=element_blank()) +
scale_x_discrete(limits = c("1","2","3","4","5","6")) +
ylab("3'UTR length") #+ xlab("Clusters")
#stat_summary(fun.data = n_fun, geom = "text", hjust = 0.5, position = "fill") +
#stat_compare_means(comparisons = list(c(1, 2), c(1, 3), c(1, 4), c(1, 5), c(6, 2), c(6, 3), c(6, 4), c(6, 5), c(2, 4), c(3, 5)), method = "t.test", tip.length = 0, hide.ns = TRUE, size = 2.5)
cl3pLENa <- ggbetweenstats( # Group clusters
ggtheme = theme_pubr(), ylab = "3'UTR length",
data = featDF[featDF$len_3pUTR != 0 & featDF$len_3pUTR <= 4000,],
x = Cluster, y = len_3pUTR,
notch = TRUE, point.jitter.width = 1,
type = "np", conf.level = 0.95, var.equal = FALSE,
point.args = list(position = ggplot2::position_jitterdodge(dodge.width = 0.2), alpha = 0.5, size = 4, stroke = 0),
k = 0, mean.point.args = list(size = 1.5, color = "darkred"),
pairwise.comparisons = TRUE, results.subtitle = TRUE, sample.size.label = TRUE, mean.plotting = TRUE, # Set FALSE for the manuscript figure.
title = "3'UTR length distributions of the 6 MClust clusters")
tr3pLENa <- ggbetweenstats( # Group translation
ggtheme = theme_ggstatsplot(), ylab = "3'UTR length",
data = featDF[featDF$len_3pUTR != 0 & featDF$len_3pUTR <= 4000,],
x = Translation, y = len_3pUTR,
notch = TRUE, point.jitter.width = 1,
type = "np", conf.level = 0.95, var.equal = FALSE,
point.args = list(position = ggplot2::position_jitterdodge(dodge.width = 0.2), alpha = 0.5, size = 4, stroke = 0),
k = 0, mean.point.args = list(size = 1.5, color = "darkred"),
pairwise.comparisons = TRUE, results.subtitle = TRUE, sample.size.label = TRUE, mean.plotting = TRUE, # Set FALSE for the manuscript figure.
title = "3'UTR length distributions of the 3 translation behaviours")
# 3UTR GC boxplots
cl3pGC <- ggplot(featDF[featDF$len_3pUTR !=0,], aes(x = Cluster, y = GC_3pUTR, fill = Cluster)) + theme_pubr() +
scale_fill_brewer(palette="Dark2") +
#ggtitle("3'UTR GC distributions of the 6 Mclust cluster") +
geom_boxplot(varwidth = TRUE, alpha = 0.5, notch = TRUE, outlier.shape = NA) +
geom_jitter(alpha=0.4, shape = 16, color = "grey2", position = position_jitter(width = 0.1, height = 0)) +
theme(legend.position = "none", axis.title.x=element_blank()) +
scale_x_discrete(limits = c("1","2","3","4","5","6")) +
ylab("3'UTR GC") #+ xlab("Clusters")
#stat_summary(fun.data = n_fun, geom = "text", hjust = 0.5, position = "fill") +
#stat_compare_means(comparisons = list(c(1, 2), c(1, 3), c(1, 4), c(1, 5), c(6, 2), c(6, 3), c(6, 4), c(6, 5), c(2, 4), c(3, 5)), method = "t.test", tip.length = 0, hide.ns = TRUE, size = 2.5)
cl3pGCa <- ggbetweenstats( # Group clusters
ggtheme = theme_pubr(), ylab = "3'UTR GC",
data = featDF[featDF$len_3pUTR != 0,],
x = Cluster, y = GC_3pUTR,
notch = TRUE, point.jitter.width = 1,
type = "np", conf.level = 0.95, var.equal = FALSE,
point.args = list(position = ggplot2::position_jitterdodge(dodge.width = 0.2), alpha = 0.5, size = 4, stroke = 0),
k = 1, mean.point.args = list(size = 1.5, color = "darkred"),
pairwise.comparisons = TRUE, results.subtitle = TRUE, sample.size.label = TRUE, mean.plotting = TRUE, # Set FALSE for the manuscript figure.
title = "GC 3'UTR distributions of the 6 MClust clusters")
tr3pGCa <- ggbetweenstats( # Group translation
ggtheme = theme_ggstatsplot(), ylab = "3'UTR GC",
data = featDF[featDF$len_3pUTR != 0,],
x = Translation, y = GC_3pUTR,
notch = TRUE, point.jitter.width = 1,
type = "np", conf.level = 0.95, var.equal = FALSE,
point.args = list(position = ggplot2::position_jitterdodge(dodge.width = 0.2), alpha = 0.5, size = 4, stroke = 0),
k = 1, mean.point.args = list(size = 1.5, color = "darkred"),
pairwise.comparisons = TRUE, results.subtitle = TRUE, sample.size.label = TRUE, mean.plotting = TRUE, # Set FALSE for the manuscript figure.
title = "GC 3'UTR distribution of the 3 translation behaviours")
# Plot the 3UTR MFE boxplots
cl3pMFE <- ggplot(featDF[featDF$MFE_3pUTR >= -1500 & featDF$len_3pUTR !=0,], aes(x = Cluster, y = MFE_3pUTR, fill = Cluster)) + theme_pubr() +
scale_fill_brewer(palette="Dark2") +
coord_cartesian(ylim = c(-1500, 0)) +
#ggtitle("3'UTR MFE distributions of the 6 Mclust cluster") +
geom_boxplot(varwidth = TRUE, alpha = 0.5, notch = TRUE, outlier.shape = NA) +
geom_jitter(alpha=0.4, shape = 16, color = "grey2", position = position_jitter(width = 0.1, height = 0)) +
theme(legend.position = "none", axis.title.x=element_blank()) +
scale_x_discrete(limits = c("1","2","3","4","5","6")) +
ylab("3'UTR MFE") + xlab("Clusters")
#stat_summary(fun.data = n_fun, geom = "text", hjust = 0.5, position = "fill") +
#stat_compare_means(comparisons = list(c(1, 2), c(1, 3), c(1, 4), c(1, 5), c(6, 2), c(6, 3), c(6, 4), c(6, 5), c(2, 4), c(3, 5)), method = "t.test", tip.length = 0, hide.ns = TRUE, size = 2.5)
cl3pMFEa <- ggbetweenstats( # Group clusters
ggtheme = theme_pubr(), ylab = "3'UTR MFE",
data = featDF[featDF$MFE_3pUTR >= -1500 & featDF$MFE_3pUTR != 0,],
x = Cluster, y = MFE_3pUTR,
notch = TRUE, point.jitter.width = 1,
type = "np", conf.level = 0.95, var.equal = FALSE,
point.args = list(position = ggplot2::position_jitterdodge(dodge.width = 0.2), alpha = 0.5, size = 4, stroke = 0),
k = 0, mean.point.args = list(size = 1.5, color = "darkred"),
pairwise.comparisons = TRUE, results.subtitle = TRUE, sample.size.label = TRUE, mean.plotting = TRUE, # Set FALSE for the manuscript figure.
title = "MFE 3'UTR distributions of the 6 MClust clusters")
tr3pMFEa <- ggbetweenstats( # Group translation
ggtheme = theme_ggstatsplot(), ylab = "3'UTR MFE",
data = featDF[featDF$MFE_3pUTR >= -1500 & featDF$MFE_3pUTR != 0,],
x = Translation, y = MFE_3pUTR,
notch = TRUE, point.jitter.width = 1,
type = "np", conf.level = 0.95, var.equal = FALSE,
point.args = list(position = ggplot2::position_jitterdodge(dodge.width = 0.2), alpha = 0.5, size = 4, stroke = 0),
k = 0, mean.point.args = list(size = 1.5, color = "darkred"),
pairwise.comparisons = TRUE, results.subtitle = TRUE, sample.size.label = TRUE, mean.plotting = TRUE, # Set FALSE for the manuscript figure.
title = "MFE 3'UTR distributions of the 3 translation behaviours")
# Plot the 3UTR MFE_BP lengths boxplots
cl3pMfeBP <- ggplot(featDF[featDF$MFE_3pUTR >= -1500 & featDF$len_3pUTR !=0,], aes(x = Cluster, y = MfeBP_3pUTR, fill = Cluster)) + theme_pubr() +
scale_fill_brewer(palette="Dark2") +
#ggtitle("3'UTR MFE per BP distributions of the 6 Mclust cluster") +
geom_boxplot(varwidth = TRUE, alpha = 0.5, notch = TRUE, outlier.shape = NA) +
geom_jitter(alpha=0.4, shape = 16, color = "grey2", position = position_jitter(width = 0.1, height = 0)) +
theme(legend.position = "none", axis.title.x=element_blank()) +
scale_x_discrete(limits = c("1","2","3","4","5","6")) +
ylab("3'UTR MFE per BP") + xlab("Clusters")
#stat_summary(fun.data = n_fun, geom = "text", hjust = 0.5, position = "fill") +
#stat_compare_means(comparisons = list(c(1, 2), c(1, 3), c(1, 4), c(1, 5), c(6, 2), c(6, 3), c(6, 4), c(6, 5), c(2, 4), c(3, 5)), method = "t.test", tip.length = 0, hide.ns = TRUE, size = 2.5)
cl3pMfeBPa <- ggbetweenstats( # Group clusters
ggtheme =theme_pubr(), ylab = "3'UTR MFE/BP",
data = featDF[featDF$MFE_3pUTR >= -1500 & featDF$MFE_3pUTR != 0,],
x = Cluster, y = MfeBP_3pUTR,
notch = TRUE, point.jitter.width = 1,
type = "np", conf.level = 0.95, var.equal = FALSE,
point.args = list(position = ggplot2::position_jitterdodge(dodge.width = 0.2), alpha = 0.5, size = 4, stroke = 0),
k = 2, mean.point.args = list(size = 1.5, color = "darkred"),
pairwise.comparisons = TRUE, results.subtitle = TRUE, sample.size.label = TRUE, mean.plotting = TRUE, # Set FALSE for the manuscript figure.
title = "MFE per BP 3'UTR distributions of the 6 MClust clusters")
tr3pMfeBPa <- ggbetweenstats( # Group translation
ggtheme = theme_ggstatsplot(), ylab = "3'UTR MFE/BP",
data = featDF[featDF$MFE_3pUTR >= -1500 & featDF$MFE_3pUTR != 0,],
x = Translation, y = MfeBP_3pUTR,
notch = TRUE, point.jitter.width = 1,
type = "np", conf.level = 0.95, var.equal = FALSE,
point.args = list(position = ggplot2::position_jitterdodge(dodge.width = 0.2), alpha = 0.5, size = 4, stroke = 0),
k = 2, mean.point.args = list(size = 1.5, color = "darkred"),
pairwise.comparisons = TRUE, results.subtitle = TRUE, sample.size.label = TRUE, mean.plotting = TRUE, # Set FALSE for the manuscript figure.
title = "MFE per BP 3'UTR distributions of the 3 translation behaviours")
# Plot the TOP local score boxplots
clTOP <- ggplot(featDF[featDF$len_5pUTR !=0,], aes(x = Cluster, y = TOP_localScore, fill = Cluster)) + theme_pubr() +
scale_fill_brewer(palette="Dark2") +
#ggtitle("TOP local score distributions of the 6 Mclust cluster") +
geom_boxplot(varwidth = TRUE, alpha = 0.5, notch = TRUE, outlier.shape = NA) +
geom_jitter(alpha=0.4, shape = 16, color = "grey2", position = position_jitter(width = 0.1, height = 0.05)) +
theme(legend.position = "none", axis.title.x=element_blank()) +
scale_x_discrete(limits = c("1","2","3","4","5","6")) +
ylab("TOP local score") + xlab("Cluster")
#stat_summary(fun.data = n_fun, geom = "text", hjust = 0.5, position = "fill") +
#stat_compare_means(comparisons = list(c(1, 2), c(1, 3), c(1, 4), c(1, 5), c(6, 2), c(6, 3), c(6, 4), c(6, 5), c(2, 4), c(3, 5)), method = "t.test", tip.length = 0, hide.ns = TRUE, size = 2.5)
clTOPa <- ggbetweenstats( # Group clusters
ggtheme = theme_pubr(),
data = featDF, ylab = "TOP local score",
x = Cluster, y = TOP_localScore,
notch = TRUE, point.jitter.width = 1,
type = "np", conf.level = 0.95, var.equal = FALSE,
point.args = list(position = ggplot2::position_jitterdodge(dodge.width = 0.2), alpha = 0.5, size = 4, stroke = 0),
k = 1, mean.point.args = list(size = 1.5, color = "darkred"),
pairwise.comparisons = TRUE, results.subtitle = TRUE, sample.size.label = TRUE, mean.plotting = TRUE, # Set FALSE for the manuscript figure.
title = "TOP local score distributions of the 6 MClust clusters")
trTOPa <- ggbetweenstats( # Group translation
ggtheme = theme_ggstatsplot(),
data = featDF, ylab = "TOP local score",
x = Translation, y = TOP_localScore,
notch = TRUE, point.jitter.width = 1,
type = "np", conf.level = 0.95, var.equal = FALSE,
point.args = list(position = ggplot2::position_jitterdodge(dodge.width = 0.2), alpha = 0.5, size = 4, stroke = 0),
k = 1, mean.point.args = list(size = 1.5, color = "darkred"),
pairwise.comparisons = TRUE, results.subtitle = TRUE, sample.size.label = TRUE, mean.plotting = TRUE, # Set FALSE for the manuscript figure.
title = "TOP local score distributions of the 3 translation behaviours")
# Plot the CAI index boxplots
clCAI <- ggplot(featDF, aes(x = Cluster, y = CAI, fill = Cluster)) + theme_pubr() +
scale_fill_brewer(palette="Dark2") +
coord_cartesian(ylim = c(0.65, 0.9)) +
#ggtitle("CAI distributions of the 6 Mclust cluster") +
geom_boxplot(varwidth = TRUE, alpha = 0.5, notch = TRUE, outlier.shape = NA) +
geom_jitter(alpha=0.4, shape = 16, color = "grey2", position = position_jitter(width = 0.1, height = 0.05)) +
theme(legend.position = "none", axis.title.x=element_blank()) +
scale_x_discrete(limits = c("1","2","3","4","5","6")) +
ylab("CAI") + xlab("Cluster")
#stat_summary(fun.data = n_fun, geom = "text", hjust = 0.5, position = "fill") +
#stat_compare_means(comparisons = list(c(1, 2), c(1, 3), c(1, 4), c(1, 5), c(6, 2), c(6, 3), c(6, 4), c(6, 5), c(2, 4), c(3, 5)), method = "t.test", tip.length = 0, hide.ns = TRUE, size = 2.5)
clCAIa <- ggbetweenstats( # Group clusters
ggtheme = theme_pubr(),
data = featDF, ylab = "CAI",
x = Cluster, y = CAI,
notch = TRUE, point.jitter.width = 1,
type = "np", conf.level = 0.95, var.equal = FALSE,
point.args = list(position = ggplot2::position_jitterdodge(dodge.width = 0.2), alpha = 0.5, size = 4, stroke = 0),
k = 2, mean.point.args = list(size = 1.5, color = "darkred"),
pairwise.comparisons = TRUE, results.subtitle = TRUE, sample.size.label = TRUE, mean.plotting = TRUE, # Set FALSE for the manuscript figure.
title = "CAI distributions of the 6 MClust clusters")
trCAIa <- ggbetweenstats( # Group translation
ggtheme = theme_ggstatsplot(),
data = featDF, ylab = "CAI",
x = Translation, y = CAI,
notch = TRUE, point.jitter.width = 1,
type = "np", conf.level = 0.95, var.equal = FALSE,
point.args = list(position = ggplot2::position_jitterdodge(dodge.width = 0.2), alpha = 0.5, size = 4, stroke = 0),
k = 2, mean.point.args = list(size = 1.5, color = "darkred"),
pairwise.comparisons = TRUE, results.subtitle = TRUE, sample.size.label = TRUE, mean.plotting = TRUE, # Set FALSE for the manuscript figure.
title = "CAI distribution of the 3 translation behaviours")
# Produce combined publication figures.
figureBoxClustP <- ggarrange(clCD, clGC, cl5pLEN, cl5pGC, cl5pMFE, cl5pMfeBP,
cl3pLEN, cl3pGC, cl3pMFE, cl3pMfeBP, clTOP,
clCAI,
labels = c("A", "B", "C", "D", "E" ,"F", "G", "H",
"I", "J", "K", "L"),
ncol = 2, nrow = 6)
analysisBoxClustI <- ggarrange(clCDa, clGCa, cl5pLENa, cl5pGCa, cl5pMFEa,
cl5pMfeBPa,
labels = c("A", "B", "C", "D", "E" ,"F"),
ncol = 2, nrow = 3)
analysisBoxClustII <- ggarrange(cl3pLENa, cl3pGCa, cl3pMFEa,
cl3pMfeBPa, clTOPa, clCAIa,
labels = c("G", "H", "I", "J", "K", "L"),
ncol =2, nrow = 3)
analysisBoxTranslI <- ggarrange(trCDa, trGCa, tr5pLENa, tr5pGCa, tr5pMFEa,
tr5pMfeBPa,
labels = c("A", "B", "C", "D", "E" ,"F"),
ncol = 2, nrow = 3)
analysisBoxTranslII <- ggarrange(tr3pLENa, tr3pGCa, tr3pMFEa,
tr3pMfeBPa, trTOPa, trCAIa,
labels = c("G", "H", "I", "J", "K", "L"),
ncol = 2, nrow = 3)
## Cluster Enrichements ------------------------------------
# Retrieve the gene names for each cluster from the features data frame.
genesClust1ENS <- as.vector(subset(featDF, featDF$Cluster == 1)$ensembl_gene_id)
genesClust2ENS <- as.vector(subset(featDF, featDF$Cluster == 2)$ensembl_gene_id)
genesClust3ENS <- as.vector(subset(featDF, featDF$Cluster == 3)$ensembl_gene_id)
genesClust4ENS <- as.vector(subset(featDF, featDF$Cluster == 4)$ensembl_gene_id)
genesClust5ENS <- as.vector(subset(featDF, featDF$Cluster == 5)$ensembl_gene_id)
genesClust6ENS <- as.vector(subset(featDF, featDF$Cluster == 6)$ensembl_gene_id)
genesTranslUP <- as.vector(subset(featDF, featDF$Translation == "Up")$ensembl_gene_id)
genesTranslDOWN <- as.vector(subset(featDF, featDF$Translation == "Down")$ensembl_gene_id)
genesTranslINTER <- as.vector(subset(featDF, featDF$Translation == "Inter")$ensembl_gene_id)
# GO enrichments
#Cluster1
egoClust1_MF <- enrichGO(gene = genesClust1ENS, OrgDb = org.Hs.eg.db, ont = "MF", pAdjustMethod = "BH", pvalueCutoff = 0.05, universe = univPPglu, keyType = "ENSEMBL", readable = TRUE)
barplot(egoClust1_MF, title = "Cluster1 GO enrichment MF", showCategory = 20)
egoClust1_BP <- enrichGO(gene = genesClust1ENS, OrgDb = org.Hs.eg.db, ont = "BP", pAdjustMethod = "BH", pvalueCutoff = 0.01, minGSSize = 5, universe = univPPglu, keyType = "ENSEMBL", readable = TRUE)
barplot(egoClust1_BP, showCategory = 30, font.size = 16) #title = "Cluster1 GO BP enrichment",
egoClust1_ALL <- enrichGO(gene = genesClust1ENS, OrgDb = org.Hs.eg.db, ont = "ALL", pAdjustMethod = "BH", pvalueCutoff = 0.05, universe = univPPglu, keyType = "ENSEMBL", pool = TRUE, readable = TRUE)
barplot(egoClust1_ALL, title = "Cluster1 ALL GO enrichment", showCategory = 20)
#Cluster6
egoClust6_MF <- enrichGO(gene = genesClust6ENS, OrgDb = org.Hs.eg.db, ont = "MF", pAdjustMethod = "BH", pvalueCutoff = 0.05, universe = univPPglu, keyType = "ENSEMBL", readable = TRUE)
barplot(egoClust6_MF, title = "Cluster6 GO enrichment MF", showCategory = 20)
egoClust6_BP <- enrichGO(gene = genesClust6ENS, OrgDb = org.Hs.eg.db, ont = "BP", pAdjustMethod = "BH", pvalueCutoff = 0.01, maxGSSize = 1000, universe = univPPglu, keyType = "ENSEMBL", readable = TRUE)
barplot(egoClust6_BP, showCategory = 30, font.size = 18) # title = "Cluster6 GO BP enrichment",
egoClust6_ALL <- enrichGO(gene = genesClust6ENS, OrgDb = org.Hs.eg.db, ont = "ALL", pAdjustMethod = "BH", pvalueCutoff = 0.05, universe = univPPglu, keyType = "ENSEMBL", pool = TRUE, readable = TRUE)
barplot(egoClust6_ALL, title = "Cluster6 ALL GO enrichment", showCategory = 20)
#Cluster4
egoClust4_MF <- enrichGO(gene = genesClust4ENS, OrgDb = org.Hs.eg.db, ont = "MF", pAdjustMethod = "BH", pvalueCutoff = 0.05, universe = univPPglu, keyType = "ENSEMBL", readable = TRUE)
barplot(egoClust4_MF, title = "Cluster4 GO enrichment MF", showCategory = 20)
egoClust4_BP <- enrichGO(gene = genesClust4ENS, OrgDb = org.Hs.eg.db, ont = "BP", pAdjustMethod = "BH", pvalueCutoff = 0.05, minGSSize = 6, maxGSSize = 1000, universe = univPPglu, keyType = "ENSEMBL", readable = TRUE)
barplot(egoClust4_BP, showCategory = 30, font.size = 18) # title = "Cluster4 GO BP enrichment",
egoClust4_ALL <- enrichGO(gene = genesClust4ENS, OrgDb = org.Hs.eg.db, ont = "ALL", pAdjustMethod = "BH", pvalueCutoff = 0.05, universe = univPPglu, keyType = "ENSEMBL", pool = TRUE, readable = TRUE)
barplot(egoClust4_ALL, title = "Cluster4 ALL GO enrichment", showCategory = 20)
#Cluster5
egoClust5_MF <- enrichGO(gene = genesClust5ENS, OrgDb = org.Hs.eg.db, ont = "MF", pAdjustMethod = "BH", pvalueCutoff = 0.05, universe = univPPglu, keyType = "ENSEMBL", readable = TRUE)
barplot(egoClust5_MF, title = "Cluster5 GO enrichment MF", showCategory = 20)
egoClust5_BP <- enrichGO(gene = genesClust5ENS, OrgDb = org.Hs.eg.db, ont = "BP", pAdjustMethod = "BH", pvalueCutoff = 0.05, minGSSize = 5, universe = univPPglu, keyType = "ENSEMBL", readable = TRUE)
barplot(egoClust5_BP, showCategory = 20, font.size = 14) # title = "Cluster5 GO BP enrichment",
egoClust5_ALL <- enrichGO(gene = genesClust5ENS, OrgDb = org.Hs.eg.db, ont = "ALL", pAdjustMethod = "BH", pvalueCutoff = 0.05, universe = univPPglu, keyType = "ENSEMBL", pool = TRUE, readable = TRUE)
barplot(egoClust5_ALL, title = "Cluster5 ALL GO enrichment", showCategory = 20)
#Cluster2
egoClust2_MF <- enrichGO(gene = genesClust2ENS, OrgDb = org.Hs.eg.db, ont = "MF", pAdjustMethod = "BH", pvalueCutoff = 0.05, universe = univPPglu, keyType = "ENSEMBL", readable = TRUE)
barplot(egoClust2_MF, title = "Cluster2 GO enrichment MF", showCategory = 20)
egoClust2_BP <- enrichGO(gene = genesClust2ENS, OrgDb = org.Hs.eg.db, ont = "BP", pAdjustMethod = "BH", pvalueCutoff = 0.1, minGSSize = 5, maxGSSize = 1000, keyType = "ENSEMBL", readable = TRUE)
barplot(egoClust2_BP, title = "Cluster2 GO BP enrichment", showCategory = 20)
egoClust2_ALL <- enrichGO(gene = genesClust2ENS, OrgDb = org.Hs.eg.db, ont = "ALL", pAdjustMethod = "BH", pvalueCutoff = 0.05, universe = univPPglu, keyType = "ENSEMBL", pool = TRUE, readable = TRUE)
barplot(egoClust2_ALL, title = "Cluster2 ALL GO enrichment", showCategory = 20)
#Cluster3
egoClust3_MF <- enrichGO(gene = genesClust3ENS, OrgDb = org.Hs.eg.db, ont = "MF", pAdjustMethod = "BH", pvalueCutoff = 0.05, universe = univPPglu, keyType = "ENSEMBL", readable = TRUE)
barplot(egoClust3_MF, title = "Cluster3 GO enrichment MF", showCategory = 20)
egoClust3_BP <- enrichGO(gene = genesClust3ENS, OrgDb = org.Hs.eg.db, ont = "BP", pAdjustMethod = "BH", pvalueCutoff = 0.1, minGSSize = 5, maxGSSize = 1000, universe = univPPglu, keyType = "ENSEMBL", readable = TRUE)
barplot(egoClust3_BP, title = "Cluster3 GO BP enrichment", showCategory = 20)
egoClust3_ALL <- enrichGO(gene = genesClust3ENS, OrgDb = org.Hs.eg.db, ont = "ALL", pAdjustMethod = "BH", pvalueCutoff = 0.05, universe = univPPglu, keyType = "ENSEMBL", pool = TRUE, readable = TRUE)
barplot(egoClust3_ALL, title = "Cluster3 ALL GO enrichment", showCategory = 20)
#Translation UP
egoTranslUP_MF <- enrichGO(gene = genesTranslUP, OrgDb = org.Hs.eg.db, ont = "MF", pAdjustMethod = "BH", pvalueCutoff = 0.05, universe = univPPglu, keyType = "ENSEMBL", readable = TRUE)
barplot(egoTranslUP_MF, title = "TranslUP GO enrichment MF", showCategory = 20)
egoTranslUP_BP <- enrichGO(gene = genesTranslUP, OrgDb = org.Hs.eg.db, ont = "BP", pAdjustMethod = "BH", pvalueCutoff = 0.05, universe = univPPglu, keyType = "ENSEMBL", readable = TRUE)
barplot(egoTranslUP_BP, title = "TranslUP GO BP enrichment", showCategory = 20)