-
Notifications
You must be signed in to change notification settings - Fork 3
/
reproducibility_report.Rmd
executable file
·1373 lines (1210 loc) · 67.8 KB
/
reproducibility_report.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: GWAS SNPs impact shared regulatory pathways amongst multimorbid psychiatric disorders and cognitive functioning
author: "Evgeniia Golovina"
date: "22 October 2019"
output:
html_document: default
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE, message = FALSE)
# install.packages("pacman")
# load libraries
pacman::p_load(UpSetR, RColorBrewer, ggplot2, plyr, gridExtra, grid, ggpubr, reshape2, tidyr, dplyr,
KEGGREST)
# ADHD color: #701e7fff
# Anxiety color: #c51b8a
# BD color: #3182bd
# SCZ color: #238443
# UD color: #ec7014
# Cognition color: #feb24c
```
## Reporducibility report for "GWAS SNPs impact shared regulatory pathways amongst multimorbid psychiatric disorders and cognitive functioning" study.
This is a reproducibility report for "GWAS SNPs impact shared regulatory pathways amongst multimorbid psychiatric disorders and cognitive functioning" study.
Python (version 2.7.15), R (version 3.5.2) and RStudio (version 1.1.463) were used for data processing, analysis and visualisation.
1. Cell type- and tissue-specific Hi-C data is available on [GEO](https://www.ncbi.nlm.nih.gov/geo/) database (accessions: GSE63525, GSE35156, GSE43070, GSE77565, GSE105194, GSE105513, GSE105544, GSE52457, GSE105914, GSE105957, GSE87112).
2. RNA-seq and genotyping data (GTEx v7) are available via [dbGaP](https://www.ncbi.nlm.nih.gov/gap/) access (accession: phs000424.v7.p2).
3. Human genome build hg19 release 75 (GRCh37) (“Homo_sapiens.GRCh37.75.dna.primary_assembly.fa.gz”) was downloaded from ftp://ftp.ensembl.org/pub/release-75/fasta/homo_sapiens/dna/.
4. SNP genomic positions were obtained from ftp://ftp.ncbi.nih.gov/snp/organisms/human_9606_b151_GRCh37p13/.
5. Gene annotation for GENCODE v19 (“gencode.v19.transcripts.patched_contigs.gtf”) was downloaded from https://storage.googleapis.com/gtex_analysis_v7/reference/.
6. SNPs associated with ADHD, anxiety, BD, UD, SCZ and cognitive functioning were downloaded from the [GWAS Catalog](www.ebi.ac.uk/gwas/) on 07/12/2018 and 14/07/2018.
We modified UpSetR function accroding to these [instructions](https://www.r-bloggers.com/hacking-our-way-through-upsetr/)
### 1. Functional annotation of SNPs.
Functional annotation of SNPs was performed using [wANNOVAR](http://wannovar.wglab.org/) tool.
### 2. Identification of SNPs overlaps.
We intersected SNP sets to identify SNPs overlaps across psychiatric disorders and cognitive functioning.
```{r snps_overlap, fig.width=9, fig.height=7}
ADHD_snps <- readLines("data/snps/ADHD_snps.txt")
Anxiety_snps <- readLines("data/snps/Anx_snps.txt")
BD_snps <- readLines("data/snps/BD_snps.txt")
UD_snps <- readLines("data/snps/UD_snps.txt")
SCZ_snps <- readLines("data/snps/SCZ_snps.txt")
Cognition_snps <- readLines("data/snps/Cognition_snps.txt")
list_snps <- list("ADHD" = ADHD_snps, "BD" = BD_snps, "Anxiety" = Anxiety_snps, "SCZ" = SCZ_snps,
"UD" = UD_snps, "Cognition" = Cognition_snps)
#jpeg("figures/SNPs_overlaps.jpeg", units="in", width=9, height=6, res=300)
upset(fromList(list_snps), sets = c("Cognition","UD", "SCZ", "BD", "Anxiety", "ADHD"),
nintersects = NA, keep.order = TRUE, sets.x.label = "Number of SNPs",
mainbar.y.label = "Number of SNPs", point.size=4.5, text.scale = 2.2, group.by = "degree",
order.by = "degree", main.bar.color = "black",
sets.bar.color = c("#fec44f","#ec7014","#238443", "#3182bd", "#c51b8a", "#701e7fff"),
number.angles = 0)
#dev.off()
```
### 3. Identification of significant spatial eQTL SNP-gene interactions using CoDeS3D.
We run `python codes3d.py -i data/snps/86_gwas_attention_deficit_hyperactivity_disorder_snps_2018-12-08_1E-06.txt -o results/codes3d_output/ADHD/` to get regulatory interactions for ADHD.
We run `python codes3d.py -i data/snps/149_gwas_anxiety_snps_2018-12-08_1E-06.txt -o results/codes3d_output/anxiety/` to get regulatory interactions for anxiety.
We run `python codes3d.py -i data/snps/241_gwas_bipolar_disorder_snps_2018-12-08_1E-06.txt -o results/codes3d_output/BD/` to get regulatory interactions for BD.
We run `python codes3d.py -i data/snps/751_gwas_unipolar_depression_snps_2018-12-08_1E-06.txt -o results/codes3d_output/UD/` to get regulatory interactions for UD.
We run `python codes3d.py -i data/snps/957_gwas_schizophrenia_snps_2018-12-08_1E-06.txt -o results/codes3d_output/UD/` to get regulatory interactions for SCZ.
We run `python codes3d.py -i data/snps/825_gwas_cognition_2018-07-14_snps_1E-6.txt -o results/codes3d_output/UD/` to get regulatory interactions for cognitive functioning.
### 4. Identification of eQTL SNPs and eQTL overlaps.
We extracted eQTL SNPs list (the 1st column) from `results/codes3d_output/ADHD_significant_eqtls.txt`. Then, we removed the duplicates. We repeated these steps for other phenotypes.
To check the percentage of eQTL SNPs vs non-eQTL SNPs:
```{r eQTL_and_non-eQTL_SNPs}
x_order <- c('ADHD', 'Anxiety', 'BD', 'SCZ', 'UD', 'Cognition')
SNPs.df <- data.frame(
Category = rep(c("eQTL","non-eQTL"),each=6),
Phenotype = rep(x_order,2),
Number = c(62, 134, 150, 515, 593, 634, 23, 15, 88, 232, 256, 191),
Percentage = c(73, 90, 63, 69, 70, 77, 27, 10, 37, 31, 30, 23))
#jpeg("figures/eQTLs_and_noneQTLs.jpeg", units="in", width=8, height=5, res=300)
ggplot(SNPs.df, aes(x = factor(Phenotype, level = x_order), y = Percentage, fill = Category)) +
geom_bar(stat="identity", position = "dodge") + theme_classic() +
theme(plot.title = element_blank(),
axis.title.x = element_blank(),
legend.text=element_text(size=14),
legend.title=element_text(size=16),
legend.title.align = 0.5,
legend.position = "bottom",
legend.direction = "horizontal",
axis.text=element_text(size=14, colour = "black"),
axis.title=element_text(size=16, colour = "black")) +
labs(fill = "SNPs:") +
geom_text(aes(y = Percentage, label = paste0("n=", Number)),
position=position_dodge(width=0.9), vjust=-0.25, color = "black",
size = 5, fontface = 'italic') +
scale_fill_manual(values=c("#377eb8", "#B0B0B0"))
#dev.off()
```
### 5. Functional genome annotation of eQTL SNPs.
```{eQTL SNPs genome annotation}
# intergenic: dark gray #606060
# intronic: #377eb8
# exonic: #cc4546ff
# ncRNA: #984ea3
SNP_annotations <- read.table("data/snps/PD_vs_Cognition_SNP_annotations.txt", sep = "\t",
header=TRUE)
x_order <- c('ADHD', 'Anxiety', 'BD', 'SCZ', 'UD', 'Cognition')
# jpeg("figures/eQTL_SNPs_genome_annotation.jpeg", units="in", width=8, height=5, res=300)
ggplot(SNP_annotations, aes(x = factor(Phenotype, level = x_order),
y = Percentage, fill = Category)) +
geom_bar(stat="identity", position = "dodge") + theme_classic() +
theme(plot.title = element_blank(),
axis.title.x = element_blank(),
legend.position = "bottom",
legend.direction = "horizontal",
legend.text=element_text(size=14),
legend.title =element_text(size=16),
legend.title.align = 0.5,
axis.text=element_text(size=14, colour = "black"),
axis.title=element_text(size=16, colour = "black")) +
labs(fill = "eQTL SNPs:") +
geom_text(aes(y = Percentage, label = paste0(Percentage, "%")),
position=position_dodge(width=0.9), vjust=-0.25, color = "black", size = 3.5) +
scale_fill_manual(values=c("#ef8a62", "#404040", "#b2182b", "#1F78B4"))
#dev.off()
```
We performed functional genome annotation of <1Mb, >1Mb and interchromossomal eQTL SNP-eGene interactions for cognitive and psychiatric phenotypes.
```{r eQTL_SNPs_genome_annotation, fig.width=5, fig.height=4}
# intergenic: #404040
# intronic: #b2182b
# exonic: #ef8a62
# ncRNA: #1F78B4
snps_order <- c("intronic", "intergenic", "exonic", "ncRNA")
snps_col <- c("#b2182b", "#404040", "#ef8a62", "#1F78B4")
## ADHD
ADHD.bar <- data.frame(
category = rep(c("A_intronic", "B_intergenic", "C_exonic", "D_ncRNA"), each=3),
group = rep(c("< 1Mb", "≥ 1Mb", "inter-chrom"),2),
n = c(103, 22, 26, 45, 14, 23, 23, 26, 1, 7, 1, 1),
percentage = c(35.3, 7.5, 8.9, 15.4, 4.8, 7.9, 7.9, 8.9, 0.3, 2.4, 0.3, 0.3))
#tiff("figures/ADHD_eQTLs_genome_annotation.tiff", units="in", width=13, height=5, res=300)
ggplot(ADHD.bar, aes(x = group, y = percentage, fill = category)) +
geom_bar(stat="identity", position = "dodge") +
theme_classic() +
theme(plot.title = element_blank(),
axis.title.x = element_blank(),
legend.position = "none",
axis.text.x = element_blank(),
axis.ticks.x = element_blank(),
axis.text=element_text(size=18, color = "black"),
axis.title=element_text(size=19, color = "black")) +
scale_fill_manual(values=snps_col) +
labs(y = "Percentage") +
ylim(0, 37) +
geom_text(aes(y = percentage, label = paste0(percentage, "%")),
position=position_dodge(width=0.9), vjust=-0.25, color = "black", size = 2)
#dev.off()
## Anxiety
Anx.bar <- data.frame(
category = rep(c("A_intronic", "B_intergenic", "C_exonic", "D_ncRNA"), each=3),
group = rep(c("< 1Mb", "≥ 1Mb", "inter-chrom"),2),
n = c(406, 54, 96, 110, 37, 50, 47, 2, 8, 16, 4, 2),
percentage = c(48.8, 6.5, 11.5, 13.2, 4.4, 6.0, 5.6, 0.2, 1.0, 1.9, 0.5, 0.2))
#tiff("figures/Anx_eQTLs_genome_annotation.tiff", units="in", width=13, height=5, res=300)
ggplot(Anx.bar, aes(x = group, y = percentage, fill = category)) +
geom_bar(stat="identity", position = "dodge") +
theme_classic() +
theme(plot.title = element_blank(),
axis.title.x = element_blank(),
legend.position = "none",
axis.text.x = element_blank(),
axis.ticks.x = element_blank(),
axis.text=element_text(size=18, color = "black"),
axis.title=element_text(size=19, color = "black")) +
scale_fill_manual(values=snps_col) +
labs(y = "Percentage") +
ylim(0, 51) +
geom_text(aes(y = percentage, label = paste0(percentage, "%")),
position=position_dodge(width=0.9), vjust=-0.25, color = "black", size = 2)
#dev.off()
# BD
BD.bar <- data.frame(
category = rep(c("A_intronic", "B_intergenic", "C_exonic", "D_ncRNA"), each=3),
group = rep(c("< 1Mb", "≥ 1Mb", "inter-chrom"),2),
n = c(212, 43, 41, 144, 33, 45, 49, 26, 3, 17, 2, 3),
percentage = c(34.3, 7.0, 6.6, 23.3, 5.3, 7.3, 7.9, 4.2, 0.5, 2.8, 0.3, 0.5))
#tiff("figures/BD_eQTLs_genome_annotation.tiff", units="in", width=13, height=5, res=300)
ggplot(BD.bar, aes(x = group, y = percentage, fill = category)) +
geom_bar(stat="identity", position = "dodge") +
theme_classic() +
theme(plot.title = element_blank(),
axis.title.x = element_blank(),
legend.position = "none",
axis.text.x = element_blank(),
axis.ticks.x = element_blank(),
axis.text=element_text(size=18, color = "black"),
axis.title=element_text(size=19, color = "black")) +
scale_fill_manual(values=snps_col) +
labs(y = "Percentage") +
ylim(0, 36) +
geom_text(aes(y = percentage, label = paste0(percentage, "%")),
position=position_dodge(width=0.9), vjust=-0.25, color = "black", size = 2)
#dev.off()
# UD
UD.bar <- data.frame(
category = rep(c("A_intronic", "B_intergenic", "C_exonic", "D_ncRNA"), each=3),
group = rep(c("< 1Mb", "≥ 1Mb", "inter-chrom"),2),
n = c(663, 180, 185, 583, 304, 221, 125, 57, 17, 46, 32, 16),
percentage = c(27.3, 7.4, 7.6, 24.0, 12.5, 9.1, 5.1, 2.3, 0.7, 1.9, 1.3, 0.7))
#tiff("figures/UD_eQTLs_genome_annotation.tiff", units="in", width=13, height=5, res=300)
ggplot(UD.bar, aes(x = group, y = percentage, fill = category)) +
geom_bar(stat="identity", position = "dodge") +
theme_classic() +
theme(plot.title = element_blank(),
axis.title.x = element_blank(),
legend.position = "none",
axis.text.x = element_blank(),
axis.ticks.x = element_blank(),
axis.text=element_text(size=18, color = "black"),
axis.title=element_text(size=19, color = "black")) +
scale_fill_manual(values=snps_col) +
labs(y = "Percentage") +
ylim(0, 29) +
geom_text(aes(y = percentage, label = paste0(percentage, "%")),
position=position_dodge(width=0.9), vjust=-0.25, color = "black", size = 2)
#dev.off()
# SCZ
SCZ.bar <- data.frame(
category = rep(c("A_intronic", "B_intergenic", "C_exonic", "D_ncRNA"), each=3),
group = rep(c("< 1Mb", "≥ 1Mb", "inter-chrom"),2),
n = c(793, 176, 185, 762, 212, 189, 156, 66, 19, 142, 40, 27),
percentage = c(28.7, 6.4, 6.7, 27.5, 7.7, 6.8, 5.6, 2.4, 0.7, 5.1, 1.4, 1.0))
#tiff("figures/SCZ_eQTLs_genome_annotation.tiff", units="in", width=13, height=5, res=300)
ggplot(SCZ.bar, aes(x = group, y = percentage, fill = category)) +
geom_bar(stat="identity", position = "dodge") +
theme_classic() +
theme(plot.title = element_blank(),
axis.title.x = element_blank(),
legend.position = "none",
axis.text.x = element_blank(),
axis.ticks.x = element_blank(),
axis.text=element_text(size=18, color = "black"),
axis.title=element_text(size=19, color = "black")) +
scale_fill_manual(values=snps_col) +
labs(y = "Percentage") +
ylim(0, 31) +
geom_text(aes(y = percentage, label = paste0(percentage, "%")),
position=position_dodge(width=0.9), vjust=-0.25, color = "black", size = 2)
#dev.off()
# Cognition
Cognition.bar <- data.frame(
category = rep(c("A_intronic", "B_intergenic", "C_exonic", "D_ncRNA"), each=3),
group = rep(c("< 1Mb", "≥ 1Mb", "inter-chrom"),2),
n = c(895, 161, 222, 670, 171, 159, 160, 26, 22, 75, 14, 14),
percentage = c(34.6, 6.2, 8.6, 25.9, 6.6, 6.1, 6.2, 1.0, 0.8, 2.9, 0.5, 0.5))
#tiff("figures/Cognition_eQTLs_genome_annotation.tiff", units="in", width=13, height=5, res=300)
ggplot(Cognition.bar, aes(x = group, y = percentage, fill = category)) +
geom_bar(stat="identity", position = "dodge") +
theme_classic() +
theme(plot.title = element_blank(),
axis.title.x = element_blank(),
legend.position = "none",
axis.text.x = element_blank(),
axis.ticks.x = element_blank(),
axis.text=element_text(size=18, color = "black"),
axis.title=element_text(size=19, color = "black")) +
scale_fill_manual(values=snps_col) +
labs(y = "Percentage") +
ylim(0, 37) +
geom_text(aes(y = percentage, label = paste0(percentage, "%")),
position=position_dodge(width=0.9), vjust=-0.25, color = "black", size = 2)
#dev.off()
```
### 6. Identification of eQTL overlaps among psychiatric disorders and cognition.
```{r eQTL_SNP_overlaps, fig.width=9, fig.height=7}
ADHD_esnps <- readLines("data/snps/ADHD_eQTLs.txt")
Anxiety_esnps <- readLines("data/snps/Anx_eQTLs.txt")
BD_esnps <- readLines("data/snps/BD_eQTLs.txt")
UD_esnps <- readLines("data/snps/UD_eQTLs.txt")
SCZ_esnps <- readLines("data/snps/SCZ_eQTLs.txt")
Cognition_esnps <- readLines("data/snps/Cognition_eQTLs.txt")
list_esnps <- list("ADHD" = ADHD_esnps, "BD" = BD_esnps, "Anxiety" = Anxiety_esnps,
"SCZ" = SCZ_esnps, "UD" = UD_esnps, "Cognition" = Cognition_esnps)
#jpeg("figures/eQTL_SNPs_overlap_by_degree.jpeg", units="in", width=9, height=6, res=300)
upset(fromList(list_esnps), sets = c("Cognition","UD", "SCZ", "BD", "Anxiety", "ADHD"),
keep.order = TRUE, sets.x.label = "Number of eQTLs", mainbar.y.label = "Number of eQTLs",
point.size=4.5, nintersects = NA, text.scale = 2.2, group.by = "degree", order.by = "degree",
main.bar.color = "black",
sets.bar.color = c("#fec44f","#ec7014","#238443", "#3182bd", "#c51b8a", "#701e7fff"))
#dev.off()
```
### 7. Identification of eGene overlaps.
We extracted eGene list (the 4th column) from `results/codes3d_output/ADHD_significant_eqtls.txt`. Removed duplicates. Repeated this step for other phenotypes.
To check eGene overlaps among psychiatric disorders and cognition:
```{r eGenes_overlaps, fig.width=11, fig.height=7}
ADHD_egenes <- readLines("data/eGenes/ADHD_eGenes.txt")
Anxiety_egenes <- readLines("data/eGenes/Anx_eGenes.txt")
BD_egenes <- readLines("data/eGenes/BD_eGenes.txt")
UD_egenes <- readLines("data/eGenes/UD_eGenes.txt")
SCZ_egenes <- readLines("data/eGenes/SCZ_eGenes.txt")
Cognition_egenes <- readLines("data/eGenes/Cognition_eGenes.txt")
list_egenes <- list("ADHD" = ADHD_egenes, "BD" = BD_egenes, "Anxiety" = Anxiety_egenes,
"SCZ" = SCZ_egenes, "UD" = UD_egenes, "Cognition" = Cognition_egenes)
#jpeg("figures/eGenes_overlap_by_degree.jpeg", units="in", width=14, height=6, res=300)
upset(fromList(list_egenes), sets = c("Cognition","UD", "SCZ", "BD", "Anxiety", "ADHD"),
keep.order = TRUE, sets.x.label = "Number of eGenes", mainbar.y.label = "Number of eGenes",
point.size=3.5, nintersects = NA, main.bar.color = "black", text.scale = 1.7,
group.by = "degree", order.by = "degree",
sets.bar.color = c("#fec44f","#ec7014","#238443", "#3182bd", "#c51b8a", "#701e7fff"))
#dev.off()
```
### 8. Bootstrapping analysis of eGene overlaps.
We run `python data/scripts/bootstrap_eGenes.py` to perform boostrapping analysis of 57 eGene overlaps among psychiatric disorders and cognition. all_genes.txt contains the whole list of genes across the genome.
```{r bootstrapping_eGenes}
# Bootstrap tests against all genes in the genome show that the observed eGene overlaps are statistically significant (p < 0.001).
egene_bootstraps <- read.table("data/eGenes/statistics_egenes.txt", sep = "\t", header=TRUE)
egene_overlaps <- read.table("data/eGenes/PD_vs_Cognition_eGenes_overlaps.txt", sep = "\t",
header=TRUE)
#jpeg("figures/eGene_bootstrapping_and_actual_overlap.jpeg", units="in", width=11, height=7, res=300)
egene_boots <- ggplot(stack(egene_bootstraps),
aes(x = factor(ind, levels = rev(names(egene_bootstraps))),
y = values)) +
geom_boxplot(outlier.colour = "black",
outlier.alpha = 0.1,
outlier.fill = "red",
outlier.size = 0.5,
fill = "grey") +
scale_y_continuous(name = "Number of shared eGenes", limits = c(0, 390)) +
scale_x_discrete(name = "Bootstrapped eGene overlaps") +
geom_point(data=egene_overlaps, aes(x=Overlap, y=Number), colour = "blue") + theme_bw()
egene_boots + theme(axis.line.x = element_line(size = 0.5, colour = "black"),
axis.line.y = element_line(size = 0.5, colour = "black"),
axis.line = element_line(size=1, colour = "black"),
panel.grid = element_blank(),
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
panel.border = element_blank(),
panel.background = element_blank()) +
rotate_x_text(angle = 45)
#dev.off()
# Bootstrap tests against genes that were identified as interacting with the phenotype associated SNP containing fragments within the Hi-C libraries show that the observed eGene overlaps are statistically significant (p < 0.001).
hic_egene_bootstraps <- read.table("data/eGenes/statistics_hic_egenes.txt", sep = "\t", header=TRUE)
egene_overlaps <- read.table("data/eGenes/PD_vs_Cognition_eGenes_overlaps.txt", sep = "\t",
header=TRUE)
#jpeg("figures/hic_eGene_bootstrapping_with_actual_overlap.jpeg", units="in", width=11, height=7, res=300)
hic_egene_boots <- ggplot(stack(hic_egene_bootstraps),
aes(x = factor(ind, levels = rev(names(hic_egene_bootstraps))),
y = values)) +
geom_boxplot(outlier.colour = "black",
outlier.alpha = 0.1,
outlier.fill = "red",
outlier.size = 0.5,
fill = "grey") +
scale_y_continuous(name = "Number of shared eGenes", limits = c(0, 380)) +
scale_x_discrete(name = "Bootstrapped eGene overlaps") +
geom_point(data=egene_overlaps, aes(x=Overlap, y=Number), colour = "blue") + theme_bw()
hic_egene_boots + theme(axis.line.x = element_line(size = 0.5, colour = "black"),
axis.line.y = element_line(size = 0.5, colour = "black"),
axis.line = element_line(size=1, colour = "black"),
panel.grid = element_blank(),
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
panel.border = element_blank(),
panel.background = element_blank()) +
rotate_x_text(angle = 45)
#dev.off()
```
### 9. Analysis of 33 shared eGenes and LD analysis of eQTLs that impact on the expression of these 33 eGenes.
To get 33 shared eGenes run `python3 -c 'import sys;print("".join(sorted(set.intersection(*[set(open(a).readlines()) for a in sys.argv[1:]]))))' data/eGenes/ADHD_eGenes.txt data/eGenes/Anx_eGenes.txt data/eGenes/BD_eGenes.txt data/eGenes/UD_eGenes.txt data/eGenes/SCZ_eGenes.txt data/eGenes/Cognition_eGenes.txt`.
We extracted all eQTL SNPs from chr 3, 6 and 10 that regulate 33 shared eGenes ().
Perform LD analysis (R-squared and D-prime) using [LDlink](https://ldlink.nci.nih.gov/) (version 3.7).
```{r LD_analysis, echo=FALSE, results="hide", include=FALSE}
get_lower_tri<-function(ld_dt){
ld_dt[upper.tri(ld_dt)] <- NA
return(ld_dt)
}
get_upper_tri<-function(ld_dt){
ld_dt[lower.tri(ld_dt, diag=T)] <- NA
return(ld_dt)
}
## SNPs on Chr3
snps_chr3 <- readLines("results/LD/chr3_all_snps.txt")
# R2
# No LD info for rs13094915 --> removed from the analysis
ld_data_r_chr3 <- read.delim("results/LD/r2_all_chr3.txt", header = T)
lower_tri_r_chr3 <- get_lower_tri(ld_data_r_chr3)
snps_chr3_sorted <- lower_tri_r_chr3$RS_number
lower_ld_melted_r_chr3 <- melt(lower_tri_r_chr3, na.rm = F)
#tiff("figures/LD_R2_chr3.tiff", units="in", width=8, height=8, res=300)
ggplot(data = lower_ld_melted_r_chr3, aes(y=factor(RS_number, levels=lower_tri_r_chr3$RS_number),
x=variable, fill=value)) +
geom_tile(color='white') +
scale_fill_gradient2(low='white', high = 'red',space='Lab',
name= bquote('LD score '~(R^2)), na.value='transparent') +
scale_x_discrete("") +
scale_y_discrete("") +
theme_minimal() +
theme(axis.text.x = element_text(angle = 90)) +
coord_fixed()
#dev.off()
# D'
# No LD info for rs13094915 --> removed from the analysis
ld_data_d_chr3 <- read.delim("results/LD/d_prime_all_chr3.txt", header = T)
upper_tri_d_chr3 <- get_upper_tri(ld_data_d_chr3)
upper_tri_d_chr3$RS_number <- snps_chr3_sorted
upper_ld_melted_d_chr3 <- melt(upper_tri_d_chr3, na.rm = TRUE)
#tiff("PfiguresLD_D_chr3.tiff", units="in", width=8, height=8, res=300)
ggplot(data = upper_ld_melted_d_chr3, aes(y=factor(RS_number, levels=upper_tri_d_chr3$RS_number),
x=variable, fill=value)) +
geom_tile(color='white') +
scale_fill_gradient2(low='white', high = '#606060',space='Lab',
name="LD score (D')", na.value='transparent') +
scale_x_discrete("") +
scale_y_discrete("") +
theme_minimal() +
theme(axis.text.x = element_text(angle=90)) +
coord_fixed()
#dev.off()
## SNPs on Chr6
snps_chr6 <- readLines("results/LD/chr6_all_snps.txt")
# R2
# No LD info for rs78110044 and rs111639056 --> removed from the analysis
ld_data_r_chr6 <- read.delim("results/LD/r2_all_chr6.txt", header = T)
lower_tri_r_chr6 <- get_lower_tri(ld_data_r_chr6)
snps_chr6_sorted <- lower_tri_r_chr6$RS_number
lower_ld_melted_r_chr6 <- melt(lower_tri_r_chr6, na.rm = F)
#tiff("figures/LD_R2_chr6.tiff", units="in", width=15, height=15, res=300)
ggplot(data = lower_ld_melted_r_chr6, aes(y=factor(RS_number, levels=lower_tri_r_chr6$RS_number),
x=variable, fill=value)) +
geom_tile(color='white') +
scale_fill_gradient2(low='white', high = 'red',space='Lab',
name= bquote('LD score '~(R^2)), na.value='transparent') +
scale_x_discrete("") +
scale_y_discrete("") +
theme_minimal() +
theme(axis.text.x = element_text(angle = 90)) +
coord_fixed()
#dev.off()
# D'
# No LD info for rs78110044 and rs111639056 --> removed from the analysis
ld_data_d_chr6 <- read.delim("results/LD/d_prime_all_chr6.txt", header = T)
upper_tri_d_chr6 <- get_upper_tri(ld_data_d_chr6)
upper_tri_d_chr6$RS_number <- snps_chr6_sorted
upper_ld_melted_d_chr6 <- melt(upper_tri_d_chr6, na.rm = TRUE)
#tiff("figures/LD_D_chr6.tiff", units="in", width=15, height=15, res=300)
ggplot(data = upper_ld_melted_d_chr6, aes(y=factor(RS_number, levels=upper_tri_d_chr6$RS_number),
x=variable, fill=value)) +
geom_tile(color='white') +
scale_fill_gradient2(low='white', high = '#606060',space='Lab',
name="LD score (D')", na.value='transparent') +
scale_x_discrete("") +
scale_y_discrete("") +
theme_minimal() +
theme(axis.text.x = element_text(angle=90)) +
coord_fixed()
#dev.off()
## SNPs on Chr10
snps_chr10 <- readLines("results/LD/chr10_all_snps.txt")
# R2
ld_data_r_chr10 <- read.delim("results/LD/r2_all_chr10.txt", header = T)
lower_tri_r_chr10 <- get_lower_tri(ld_data_r_chr10)
snps_chr10_sorted <- lower_tri_r_chr10$RS_number
lower_ld_melted_r_chr10 <- melt(lower_tri_r_chr10, na.rm = F)
#tiff("figures/LD_R2_chr10.tiff", units="in", width=8, height=8, res=300)
ggplot(data = lower_ld_melted_r_chr10, aes(y=factor(RS_number, levels=lower_tri_r_chr10$RS_number),
x=variable, fill=value)) +
geom_tile(color='white') +
scale_fill_gradient2(low='white', high = 'red',space='Lab',
name= bquote('LD score '~(R^2)), na.value='transparent') +
scale_x_discrete("") +
scale_y_discrete("") +
theme_minimal() +
theme(axis.text.x = element_text(angle = 90)) +
coord_fixed()
#dev.off()
# D'
# No LD info for rs13094915 --> removed from the analysis
ld_data_d_chr10 <- read.delim("results/LD/d_prime_all_chr10.txt", header = T)
upper_tri_d_chr10 <- get_upper_tri(ld_data_d_chr10)
upper_tri_d_chr10$RS_number <- snps_chr10_sorted
upper_ld_melted_d_chr10 <- melt(upper_tri_d_chr10, na.rm = TRUE)
#tiff("figures/LD_D_chr10.tiff", units="in", width=8, height=8, res=300)
ggplot(data = upper_ld_melted_d_chr10, aes(y=factor(RS_number, levels=upper_tri_d_chr10$RS_number),
x=variable, fill=value)) +
geom_tile(color='white') +
scale_fill_gradient2(low='white', high = '#606060',space='Lab',
name="LD score (D')", na.value='transparent') +
scale_x_discrete("") +
scale_y_discrete("") +
theme_minimal() +
theme(axis.text.x = element_text(angle=90)) +
coord_fixed()
#dev.off()
```
### 10. Analysis of loss-of-function eQTLs. pLI method.
The analysis is done for ADHD. Repeat the code below for other phenotypes.
```{LoF analysis, echo=FALSE, results="hide"}
pacman::p_load(dplyr, ggplot2, RColorBrewer, "scales", ggrepel, ggbeeswarm, ggalt,
magrittr, tidybayes, tidyr)
table_in <- read.table(file=gzfile('results/pLI/gnomad.v2.1.1.lof_metrics.by_gene.txt.bgz', 'rt'),
header = TRUE, sep="\t")
table_in_pheno <- read.table(file="results/codes3d_output/ADHD_significant_eqtls.txt",
header = TRUE, sep="\t")
table_in_pheno_cistrans <- table_in_pheno %>%
mutate(cistrans=ifelse(SNP_Chromosome==Gene_Chromosome & cis_SNP.gene_interaction=="True", "cis",
ifelse(SNP_Chromosome==Gene_Chromosome &
cis_SNP.gene_interaction=="False", "trans_intra",
"trans_inter")))
Gene_list <- table_in_pheno_cistrans %>%
select(Gene_Name, cistrans) %>%
arrange(Gene_Name) %>%
distinct() %>%
rename(gene = Gene_Name)
table_in_pheno <- table_in %>%
select(gene, pLI) %>%
mutate(intolerant=ifelse(pLI>=0.9, "Intolerant", "Tolerant")) %>% #dichotomize the continuous variable - 0.9 and above is the threshold for "LoF intolerant"
mutate(intolerant=ifelse(is.na(intolerant),"nopli",intolerant)) %>% #change NA to a label on the plot I can control
full_join(Gene_list) %>% #merge sigeqtl and gnomad files, merge by gene name
mutate(cistrans=ifelse(is.na(cistrans),"noeQTL",cistrans)) %>% #change NA to a label on the plot I can control
mutate(cistrans=factor(cistrans, levels=c("noeQTL","cis","trans_intra","trans_inter"))) #This sets the order of the levels on the plots below
table_in_pheno2 <- table_in_pheno %>% #this part seems necessary as there are still some NAs after the first batch was removed. Bug in the is.na code???
mutate(intolerant=ifelse(is.na(intolerant),"nopli",intolerant)) %>% #change NA to a label on the plot I can control
mutate(intolerant=factor(intolerant, levels=c("nopli","Tolerant","Intolerant"))) #This sets the order of the levels on the plots below
cistrans_categories <- data.frame(cis="cis", trans_inter="trans\nInterchromosomal", trans_intra="trans\nIntrachromosomal", noeQTL="No eQTL")
cistrans_colours <- c(cis=brewer.pal(8,"Dark2")[1], trans_inter=brewer.pal(8,"Dark2")[3], trans_intra=brewer.pal(8,"Dark2")[2], noeQTL="black")
#both phenotypes in one facet plot
p_pheno_pLI <- ggplot(table_in_pheno, aes(x=factor(cistrans), y=pLI, fill=factor(cistrans),
color=factor(cistrans))) +
#facet_wrap(~cohesin_gene_list) +
geom_eye(scale="width", position = position_dodge(width = .3)) +
#geom_quasirandom(alpha = 0.3, width = 0.5, size = 1.5, dodge.width=.8) +
scale_color_manual(values=cistrans_colours, guide=FALSE) + #color of x-axis sep
scale_fill_manual(values=lapply(cistrans_colours,alpha, 0.5), labels=cistrans_categories) + #color of x-axis sep violin
stat_summary(aes(label=round(..y..,2)), fun.y=median, geom="text", size=14, hjust=-0.1,
vjust = 0.5, show.legend=FALSE, position = position_dodge(width = .55)) +
#add horizontal lines for pLI 0.9
geom_hline(aes(yintercept= as.numeric(0.9)), colour = "red", size = 2) +
annotate(geom="text", label="pLI=0.9", x=0, y=0.9, hjust=-0.2, vjust=-0.7, size=12) +
scale_x_discrete(labels=cistrans_categories) +
scale_y_continuous(limits=c(0,1)) +
theme_bw() +
theme(panel.border = element_rect(fill=NA, size=3),
axis.text=element_text(size=36, family="ArialMT"),
axis.title=element_text(size=42, family="ArialMT"),
axis.line = element_line(colour = 'black', size = 2),
plot.title = element_text(size=54, margin = margin(t = 0, r = 0, b = 30, l = 0),
hjust = 0.5, family="ArialMT"),
legend.title = element_text(colour="black", size = 36),
legend.text = element_text(colour="black", size = 24)) +
labs(x = "eQTL Distance", y="Probability of Loss-of-Function-Intolerance",
title = "gnomAD Loss-of-Function (LoF)-Intolerance", fill="eQTL Distance")
#ggsave("results/pLI/ADHD_pLI_cistrans.pdf", plot = p_pheno_pLI, width=40, height=20)
intolerant_colours <- c(Intolerant=brewer.pal(9,"Blues")[4], Tolerant=brewer.pal(9,"Blues")[8],
nopli="black")
intolerant_categories <- data.frame(Intolerant="Intolerant", Tolerant="Tolerant",
nopli="Missing pLI")
p_pheno_pLI_bar <- ggplot(table_in_pheno2, aes(x=factor(cistrans), fill=factor(intolerant))) +
geom_bar(position = "fill") +
scale_x_discrete(labels=cistrans_categories) +
scale_y_continuous(labels = scales::percent) +
scale_fill_manual(values=intolerant_colours, labels=intolerant_categories) +
theme_bw() +
theme(panel.border = element_rect(fill=NA, size=3),
axis.text=element_text(size=36, family="ArialMT"),
axis.title=element_text(size=42, family="ArialMT"),
axis.line = element_line(colour = 'black', size = 2),
plot.title = element_text(size=54, margin = margin(t = 0, r = 0, b = 30, l = 0),
hjust = 0.5, family="ArialMT"),
legend.title = element_text(colour="black", size = 36),
legend.text = element_text(colour="black", size = 24)) +
labs(x = "eQTL Distance", y="Proportion of Samples",
title = "gnomAD Loss-of-Function (LoF)-Intolerance", fill="gnomAD LoF\n(pLI > 0.9)")
#ggsave("resultspLI/ADHD_pLI_cistrans_intolerance_proportional_bars.pdf", plot = p_pheno_pLI_bar, width=40, height=20)
```
### 11. Gene Ontology (GO) analysis.
GO analysis was performed using g:GOSt module of the [g:Profiler](https://biit.cs.ut.ee/gprofiler/) tool.
### 12. Pathway analysis.
Pathway analysis was performed using Advaita Bio’s [iPathwayGuide](https://www.advaitabio.com/ipathwayguide) on 09/13/2019.
### 13. Identification of pathway overlaps.
```{r iPathways_overlap, fig.width=9, fig.height=7}
ADHD_ipaths <- readLines("data/iPathways/ADHD_KEGG.txt")
Anxiety_ipaths <- readLines("data/iPathways/Anx_KEGG.txt")
BD_ipaths <- readLines("data/iPathways/BD_KEGG.txt")
UD_ipaths <- readLines("data/iPathways/UD_KEGG.txt")
SCZ_ipaths <- readLines("data/iPathways/SCZ_KEGG.txt")
Cognition_ipaths <- readLines("data/iPathways/Cognition_KEGG.txt")
list_ipaths <- list("ADHD" = ADHD_ipaths, "BD" = BD_ipaths, "Anxiety" = Anxiety_ipaths,
"SCZ" = SCZ_ipaths, "UD" = UD_ipaths, "Cognition" = Cognition_ipaths)
#jpeg("figures/iPathways_overlap_by_degree_no-genes.jpeg", units="in", width=10, height=6, res=300)
upset(fromList(list_ipaths), sets = c("Cognition","UD", "SCZ", "BD", "Anxiety", "ADHD"),
keep.order = TRUE, sets.x.label = "Number of pathways", mainbar.y.label = "Number of pathways",
point.size=3.5, nintersects = NA, main.bar.color = "black", text.scale = 2.0,
group.by = "degree", order.by = "degree",
sets.bar.color = c("#fec44f","#ec7014","#238443", "#3182bd", "#c51b8a", "#701e7fff"))
#dev.off()
```
### 14. Identification of phenotype-specific and shared eGenes in 61 shared pathways.
```{r eGenes_in_shared_pathways, fig.width=7, fig.height=9}
egenes_in_paths <- read.table("results/Shared_and_unique_genes_in_shared_paths.txt", sep = "\t",
header=TRUE)
df <- melt(egenes_in_paths, id.var="Pathway")
#tiff("figures/shared_and_unique_genes_in_sh_paths.tiff", units="in", width=13, height=9, res=300)
ggplot(df, aes(x = Pathway, y = value, fill = variable)) +
geom_bar(stat = "identity") +
scale_fill_brewer(palette = "Paired",
labels = c("Total eGenes", "Shared eGenes", "Phenotype-specific eGenes")) +
theme_classic() +
theme(axis.line.x = element_line(size = 0.5, colour = "black"),
axis.line.y = element_line(size = 0.5, colour = "black"),
axis.line = element_line(size=1, colour = "black"),
axis.text.x = element_text(size = 10, colour = "black"),
axis.text.y = element_text(size = 10, colour = "black"),
axis.title.y = element_text(size = 10, colour = "black"),
panel.grid = element_blank(),
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
panel.border = element_blank(),
panel.background = element_blank(),
plot.title = element_blank(),
legend.title = element_blank(),
axis.title.x = element_blank(),
legend.position = "bottom",
legend.direction = "horizontal",
legend.text = element_text(size = 12, colour = "black")) +
rotate_x_text(angle = 90) +
labs(y = "Number of eGenes")
#dev.off()
```
### 15. Bootstrapping analysis of iPathways overlaps.
We run `python data/scripts/bootstrap_paths.py` to perform boostrapping analysis of 57 pathway overlaps among psychiatric disorders and cognition. KEGG_paths.txt contains the whole list of KEGG pathways in KEGG database.
```{r bootstrapping_paths}
path_bootstraps <- read.table("data/iPathways/statistics_paths.txt", sep = "\t", header=TRUE)
path_overlaps <- read.table("data/iPathways/PD_vs_Cognition_paths_overlaps.txt", sep = "\t",
header=TRUE)
#tiff("figures/paths_bootstrapping_with_actual_overlap.tiff", units="in", width=11, height=7, res=300)
path_boots <- ggplot(stack(path_bootstraps),
aes(x = factor(ind, levels = rev(names(path_bootstraps))), y = values)) +
geom_boxplot(outlier.colour = "black",
outlier.alpha = 0.1,
outlier.fill = "red",
outlier.size = 0.5,
fill = "grey") +
scale_y_continuous(name = "Number of shared pathways", limits = c(0, 390)) +
scale_x_discrete(name = "Bootstrapped pathway overlaps") +
geom_point(data=path_overlaps, aes(x=Overlap, y=Number), colour = "blue") +
theme_bw()
path_boots + theme(axis.line.x = element_line(size = 0.5, colour = "black"),
axis.line.y = element_line(size = 0.5, colour = "black"),
axis.line = element_line(size=1, colour = "black"),
panel.grid = element_blank(),
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
panel.border = element_blank(),
panel.background = element_blank()) +
rotate_x_text(angle = 45)
#dev.off()
## All KEGG paths
listDatabases()
pathways <- keggList("pathway")
#write.table(pathways, file="data/iPathways/KEGG_paths.txt", sep="\t", row.names=FALSE, col.names=FALSE)
```
### 16. Drug-gene interaction analysis.
This is the example for ADHD phenotype. We create the ADHD_output directory, and then run `python data/scripts/get_dgi_drug_targets.py -g data/results/codes3d_output/ADHD_significant_eqtls.txt -o data/results/DGIdb_output/ADHD_output` to query the [Drug Gene Interaction database (DGIdb)](http://www.dgidb.org/). Repeated this step for other phenotypes.
### 17. Identification of dGene overlaps.
```{r dGene_overlap, fig.width=9, fig.height=7}
ADHD_dgenes <- readLines("data/dGenes/ADHD_dGenes.txt")
Anxiety_dgenes <- readLines("data/dGenes/Anx_dGenes.txt")
BD_dgenes <- readLines("data/dGenes/BD_dGenes.txt")
UD_dgenes <- readLines("data/dGenes/UD_dGenes.txt")
SCZ_dgenes <- readLines("data/dGenes/SCZ_dGenes.txt")
Cognition_dgenes <- readLines("data/dGenes/Cognition_dGenes.txt")
list_dgenes <- list("ADHD" = ADHD_dgenes, "BD" = BD_dgenes, "Anxiety" = Anxiety_dgenes, "SCZ" = SCZ_dgenes, "UD" = UD_dgenes, "Cognition" = Cognition_dgenes)
#tiff("figures/dGenes_overlap_by_degree.tiff", units="in", width=13, height=6, res=300)
upset(fromList(list_dgenes), sets = c("Cognition","UD", "SCZ", "BD", "Anxiety", "ADHD"),
keep.order = TRUE, sets.x.label = "Number of dGenes",
mainbar.y.label = "Number of shared dGenes", point.size=3.5, nintersects = NA,
main.bar.color = "#A9A9A9", text.scale = 2.0, group.by = "degree", order.by = "degree",
sets.bar.color = c("#fec44f","#ec7014","#238443", "#3182bd", "#c51b8a", "#701e7fff"))
#dev.off()
```
### 18. Analysis of tissue-specificity among psychiatric disorders and cognition.
```{r tissue_specificity, fig.width=6, fig.height=8}
ADHD_tissues <- read.table("data/tissue_specificity/ADHD_tissue_specificity_new.txt", sep = "\t",
header=TRUE)
Anx_tissues <- read.table("data/tissue_specificity/Anx_tissue_specificity_new.txt", sep = "\t",
header=TRUE)
BD_tissues <- read.table("data/tissue_specificity/BD_tissue_specificity_new.txt", sep = "\t",
header=TRUE)
UD_tissues <- read.table("data/tissue_specificity/UD_tissue_specificity_new.txt", sep = "\t",
header=TRUE)
SCZ_tissues <- read.table("data/tissue_specificity/SCZ_tissue_specificity_new.txt", sep = "\t",
header=TRUE)
Cognition_tissues <- read.table("data/tissue_specificity/Cognition_tissue_specificity_new.txt",
sep = "\t", header=TRUE)
# Order by organismal systems
tissue_order = c('Adipose - Subcutaneous', 'Adipose - Visceral (Omentum)', 'Artery - Aorta',
'Artery - Coronary', 'Artery - Tibial', 'Heart - Atrial Appendage',
'Heart - Left Ventricle', 'Whole Blood', 'Colon - Sigmoid', 'Colon - Transverse',
'Esophagus - Gastroesophageal Junction', 'Esophagus - Mucosa',
'Esophagus - Muscularis', 'Liver', 'Small Intestine - Terminal Ileum', 'Stomach',
'Adrenal Gland', 'Pancreas', 'Pituitary', 'Thyroid', 'Breast - Mammary Tissue',
'Minor Salivary Gland', 'Skin - Not Sun Exposed (Suprapubic)',
'Skin - Sun Exposed (Lower leg)', 'Spleen', 'Muscle - Skeletal',
'Brain - Amygdala', 'Brain - Anterior cingulate cortex (BA24)',
'Brain - Caudate (basal ganglia)', 'Brain - Cerebellar Hemisphere',
'Brain - Cerebellum', 'Brain - Cortex', 'Brain - Frontal Cortex (BA9)',
'Brain - Hippocampus', 'Brain - Hypothalamus',
'Brain - Nucleus accumbens (basal ganglia)', 'Brain - Putamen (basal ganglia)',
'Brain - Spinal cord (cervical c-1)', 'Brain - Substantia nigra', 'Nerve - Tibial',
'Ovary', 'Prostate', 'Testis', 'Uterus', 'Vagina', 'Lung',
'Cells - EBV-transformed lymphocytes', 'Cells - Transformed fibroblasts')
## ADHD
#tiff("figures/ADHD_tissue_specificity.tiff", units="in", width=3, height=7, res=300)
ggplot(ADHD_tissues, aes(x=(factor(New_tissue, level = rev(tissue_order))), y=Number,
fill = Interactions)) +
geom_bar(stat = 'identity') +
theme_classic() +
theme(plot.title = element_blank(),
axis.title.x = element_blank(),
#axis.text.y = element_blank(), # without tissues labeles
axis.title.y = element_blank(),
legend.position = "none",
legend.direction = "horizontal",
legend.text=element_text(size=8),
legend.title =element_text(size=9),
axis.text=element_text(size=9, colour = "black"),
axis.title=element_text(size=9, colour = "black")) +
coord_flip() +
scale_y_continuous(limits = c(0, 80)) +
scale_fill_manual('eQTL-eGene interactions:', values = c("#ef8a62", "#b2182b", "#404040")) +
facet_wrap(~Phenotype, nrow=1)
#dev.off()
## Anxiety
#tiff("figures/Anx_tissue_specificity.tiff", units="in", width=3, height=7, res=300)
ggplot(Anx_tissues, aes(x=(factor(New_tissue, level = rev(tissue_order))), y=Number,
fill = Interactions)) +
geom_bar(stat = 'identity') +
theme_classic() +
theme(plot.title = element_blank(),
axis.title.x = element_blank(),
#axis.text.y = element_blank(), # without tissues labeles
axis.title.y = element_blank(),
legend.position = "none",
legend.direction = "horizontal",
legend.text=element_text(size=8),
legend.title =element_text(size=9),
axis.text=element_text(size=9, colour = "black"),
axis.title=element_text(size=9, colour = "black")) +
coord_flip() +
scale_y_continuous(limits = c(0, 210)) +
scale_fill_manual('eQTL-eGene interactions:', values = c("#ef8a62", "#b2182b", "#404040")) +
facet_wrap(~Phenotype, nrow=1)
#dev.off()
## BD
#tiff("figures/BD_tissue_specificity.tiff", units="in", width=7, height=7, res=300)
ggplot(BD_tissues, aes(x=(factor(New_tissue, level = rev(tissue_order))), y=Number,
fill = Interactions)) +
geom_bar(stat = 'identity') +
theme_classic() +
theme(plot.title = element_blank(),
axis.title.x = element_blank(),
#axis.text.y = element_blank(), # without tissues labeles
axis.title.y = element_blank(),
legend.position = "none",
legend.direction = "horizontal",
legend.text=element_text(size=8),
legend.title =element_text(size=9),
axis.text=element_text(size=9, colour = "black"),
axis.title=element_text(size=9, colour = "black")) +
coord_flip() +
scale_y_continuous(limits = c(0, 160)) +
scale_fill_manual('eQTL-eGene interactions:', values = c("#ef8a62", "#b2182b", "#404040")) +
facet_wrap(~Phenotype, nrow=1)
#dev.off()
## UD
#tiff("figures/UD_tissue_specificity.tiff", units="in", width=7, height=7, res=300)
ggplot(UD_tissues, aes(x=(factor(New_tissue, level = rev(tissue_order))), y=Number,
fill = Interactions)) +
geom_bar(stat = 'identity') +
theme_classic() +
theme(plot.title = element_blank(),
axis.title.x = element_blank(),
#axis.text.y = element_blank(), # without tissues labeles
axis.title.y = element_blank(),
legend.position = "none",
legend.direction = "horizontal",
legend.text=element_text(size=8),
legend.title =element_text(size=9),
axis.text=element_text(size=9, colour = "black"),
axis.title=element_text(size=9, colour = "black")) +
coord_flip() +
scale_y_continuous(limits = c(0, 620)) +
scale_fill_manual('eQTL-eGene interactions:', values = c("#ef8a62", "#b2182b", "#404040")) +
facet_wrap(~Phenotype, nrow=1)
#dev.off()
## SCZ
#tiff("figures/SCZ_tissue_specificity.tiff", units="in", width=7, height=7, res=300)
ggplot(SCZ_tissues, aes(x=(factor(New_tissue, level = rev(tissue_order))), y=Number,
fill = Interactions)) +
geom_bar(stat = 'identity') +
theme_classic() +
theme(plot.title = element_blank(),
axis.title.x = element_blank(),
#axis.text.y = element_blank(), # without tissues labeles
axis.title.y = element_blank(),
legend.position = "none",
legend.direction = "horizontal",
legend.text=element_text(size=8),
legend.title =element_text(size=9),
axis.text=element_text(size=9, colour = "black"),
axis.title=element_text(size=9, colour = "black")) +
coord_flip() +
scale_y_continuous(limits = c(0, 740)) +
scale_fill_manual('eQTL-eGene interactions:', values = c("#ef8a62", "#b2182b", "#404040")) +
facet_wrap(~Phenotype, nrow=1)
#dev.off()
## Cognition
#tiff("figures/Cognition_tissue_specificity.tiff", units="in", width=7, height=7, res=300)
ggplot(Cognition_tissues, aes(x=(factor(New_tissue, level = rev(tissue_order))), y=Number,
fill = Interactions)) +
geom_bar(stat = 'identity') +
theme_classic() +
theme(plot.title = element_blank(),
axis.title.x = element_blank(),
#axis.text.y = element_blank(), # without tissues labeles
axis.title.y = element_blank(),
legend.position = "none",
legend.direction = "horizontal",
legend.text=element_text(size=8),
legend.title =element_text(size=9),
axis.text=element_text(size=9, colour = "black"),
axis.title=element_text(size=9, colour = "black")) +
coord_flip() +
scale_y_continuous(limits = c(0, 580)) +
scale_fill_manual('eQTL-eGene interactions:', values = c("#ef8a62", "#b2182b", "#404040")) +
facet_wrap(~Phenotype, nrow=1)
#dev.off()
```
### 19. Correlation analysis between GTEx tissue sample size and number of eQTL-eGenes interactions.
```{r correlation_analysis, fig.width=5, fig.height=5}
ADHD_data <- read.table("data/correlation/ADHD_Correlation_analysis.txt", sep = "\t", header=TRUE)
Anx_data <- read.table("data/correlation/Anx_Correlation_analysis.txt", sep = "\t", header=TRUE)
BD_data <- read.table("data/correlation/BD_Correlation_analysis.txt", sep = "\t", header=TRUE)
UD_data <- read.table("data/correlation/UD_Correlation_analysis.txt", sep = "\t", header=TRUE)
SCZ_data <- read.table("data/correlation/SCZ_Correlation_analysis.txt", sep = "\t", header=TRUE)
Cognition_data <- read.table("data/correlation/Cognition_Correlation_analysis.txt", sep = "\t",
header=TRUE)
phe <- c("Cognition","UD", "SCZ", "BD", "Anx", "ADHD")
col <- c("#fec44f","#ec7014","#238443", "#3182bd", "#c51b8a", "#701e7fff")
### ADHD
## < 1Mb eQTL-eGenes interactions
#tiff("figures/ADHD_eGenes_correlation_analysis_less1Mb_with_line.tiff", units="in", width=6, height=6, res=300)
ggplot(ADHD_data, aes(x=Sample_size, y=less1Mb)) +
geom_point(size = 2.5, color="#701e7fff") +
geom_smooth(method=lm, se=T, linetype="solid", size=0.4, color="#701e7fff") +
theme_classic() +
scale_x_continuous(name="Sample size") + # Number of samples in GTEx tissues
scale_y_continuous(name="Number of eQTL-eGene interactions") +
theme(plot.title = element_blank(),
legend.position = "none",
axis.text=element_text(size=19, color = "black"),
axis.title=element_text(size=20, color = "black")) +
stat_cor(method = "pearson", size=8)
#dev.off()
## ≥ 1Mb eQTL-eGenes interactions
#tiff("figures/ADHD_eGenes_correlation_analysis_more1Mb_with_line.tiff", units="in", width=6, height=6, res=300)
ggplot(ADHD_data, aes(x=Sample_size, y=more1Mb)) +
geom_point(size = 2.5, color="#701e7fff") +
geom_smooth(method=lm, se=T, linetype="solid", size=0.4, color="#701e7fff") +
theme_classic() +
scale_x_continuous(name="Sample size") + # Number of samples in GTEx tissues
scale_y_continuous(name="Number of eQTL-eGene interactions") +
theme(plot.title = element_blank(),
legend.position = "none",
axis.text=element_text(size=19, color = "black"),
axis.title=element_text(size=20, color = "black")) +
stat_cor(method = "pearson", size=8)
#dev.off()
## interchromosomal eQTL-eGenes interactions
#tiff("figures/ADHD_eGenes_correlation_analysis_interchrom_with_line.tiff", units="in", width=6, height=6, res=300)