-
Notifications
You must be signed in to change notification settings - Fork 1
/
paper_figures.Rmd
3893 lines (3261 loc) · 145 KB
/
paper_figures.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: "Figures for Paper"
author: "Anna-Leigh Brown + Matteo Zanovello + Oscar Wilkins + Matthew Keuss"
date: "06/10/2020"
output:
html_document:
code_folding: hide
toc: true
toc_float: true
knit: (function(inputFile, encoding) { rmarkdown::render(inputFile, encoding = encoding, output_file = file.path(dirname(inputFile), 'docs/index.html')) })
---
```{css, echo = FALSE}
h1, #TOC>ul>li {
color: #000000;
font-weight: bold;
}
h2, #TOC>ul>ul>li {
color: #41494D;
}
```
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE,warning=FALSE)
knitr::opts_chunk$set(
comment = '', fig.width = 9, fig.height = 9
)
if (!require("pacman")) install.packages("pacman")
library(pacman)
p_load("data.table",
"ggnewscale",
"tidyverse",
"ggplot2",
"rcompanion",
"lme4",
"ggpubr",
"forcats",
"scales",
"here",
"ggthemes",
"ggrepel",
"DESeq2",
"patchwork",
"rstatix",
"ggeasy")
```
# iPSC splicing
Read in the splicing results returned by MAJIQ and make a volcano plot, only highlight
genes of interest with a label.
```{r volcano_plots}
ipsc_splicing = fread(file.path(here::here(),"data","ipsc_splicing_results.csv"))
ipsc_de = fread(file.path(here::here(),"data","ipsc_differential_expression.csv"))
splicing_dots_tables <- ipsc_splicing %>%
mutate(junction_name = case_when(gene_name %in% c("UNC13A","AGRN",
"UNC13B","PFKP","SETD5",
"ATG4B","STMN2") &
p_d_psi_0_10_per_lsv_junction > 0.9 &
deltaPSI > 0 ~ gene_name,
T ~ "")) %>%
mutate(`Novel Junction` = de_novo_junctions == 0) %>%
mutate(log10_test_stat = -log10(1 - p_d_psi_0_10_per_lsv_junction)) %>%
mutate(log10_test_stat = ifelse(is.infinite(log10_test_stat), 16, log10_test_stat)) %>%
mutate(graph_alpha = ifelse(p_d_psi_0_10_per_lsv_junction > 0.9, 1, 0.2)) %>%
mutate(label_junction = case_when(gene_name %in% c("UNC13A","AGRN",
"UNC13B","PFKP","SETD5",
"ATG4B","STMN2") &
p_d_psi_0_10_per_lsv_junction > 0.9 &
deltaPSI > 0 ~ junction_name,
T ~ ""))
fig1a = ggplot() +
geom_point(data = splicing_dots_tables %>% filter(de_novo_junctions != 0),
aes(x = deltaPSI, y =log10_test_stat,
alpha = graph_alpha,,fill = "Annotated Junction"), pch = 21, size = 10) +
geom_point(data = splicing_dots_tables %>% filter(de_novo_junctions == 0),
aes(x = deltaPSI, y =log10_test_stat,
alpha = graph_alpha,fill = "Novel Junction"), pch = 21, size = 10) +
geom_text_repel(data = splicing_dots_tables[junction_name != ""],
aes(x = deltaPSI, y =log10_test_stat,
label = label_junction,
color = as.character(de_novo_junctions)), point.padding = 0.3,
nudge_y = 0.2,
min.segment.length = 0,
box.padding = 2,
size=6,show.legend = F) +
geom_hline(yintercept = -log10(1 - .9)) +
geom_vline(xintercept = -0,linetype="dotted") +
scale_fill_manual(name = "",
breaks = c("Annotated Junction", "Novel Junction"),
values = c("Annotated Junction" = "#648FFF", "Novel Junction" = "#fe6101") ) +
scale_color_manual(name = "",
breaks = c("0", "1"),
values = c("1" = "#648FFF", "0" = "#fe6101") ) +
guides(alpha = FALSE, size = FALSE) +
theme(legend.position = 'top') +
ggpubr::theme_pubr() +
xlab("delta PSI") +
ylab(expression(paste("-Lo", g[10], " Test Statistic"))) +
theme(text = element_text(size = 24)) +
theme(legend.text=element_text(size=22)) +
xlim(-1,1) +
scale_x_continuous(labels = scales::percent)
de_table = ipsc_de %>%
mutate(contains_cryptic = gene_name %in% splicing_dots_tables[cryptic_junction == T,unique(gene_name)]) %>%
mutate(contains_cryptic = as.character(as.numeric(contains_cryptic))) %>%
mutate(label_junction = case_when(gene_name %in% c("UNC13A","AGRN",
"UNC13B","PFKP","SETD5",
"ATG4B","STMN2","TARDBP") ~ gene_name,
T ~ "")) %>%
mutate(graph_alpha = ifelse(padj < 0.1, 1, 0.2)) %>%
mutate(y_data = -log10(padj))
fig1b = ggplot(data = de_table) +
geom_point(data = de_table %>% filter(contains_cryptic == "0"),
aes(x = log2FoldChange, y = -log10(padj),
alpha = graph_alpha,fill = "No Cryptic"), pch = 21, size = 10) +
geom_point(data = de_table %>% filter(contains_cryptic == "1"),
aes(x = log2FoldChange, y = -log10(padj),
alpha = graph_alpha,fill = "Contains Cryptic"), pch = 21, size = 10)+
geom_text_repel(data = de_table[label_junction != ""],max.overlaps = 500,
aes(x = log2FoldChange,
y = -log10(padj),
label = label_junction,
color = as.character(contains_cryptic)),
nudge_y = 5,
min.segment.length = 0,
box.padding = 4,
size=6,show.legend = F) +
scale_fill_manual(name = "",
breaks = c("No Cryptic", "Contains Cryptic"),
values = c("No Cryptic" = "#648FFF", "Contains Cryptic" = "#fe6101") ) +
scale_color_manual(name = "",
breaks = c("1", "0"),
values = c("1" = "#fe6101", "0" = "#648FFF") ) +
xlim(-7.5,7.5) +
ylab(expression(paste("-Lo", g[10], " P-value"))) +
guides(alpha = FALSE, size = FALSE) +
theme(legend.position = 'top') +
ggpubr::theme_pubr() +
xlab(expression(paste("Lo", g[2], " Fold Change"))) +
theme(text = element_text(size = 24)) +
theme(legend.text=element_text(size=22)) +
geom_hline(yintercept = -log10(0.1)) +
geom_vline(xintercept=c(0), linetype="dotted")
print(fig1a)
print(fig1b)
```
# UNC13A CE PSI across TDP-43 KD experiments
The 'C/G' tells which genotypes were supported by RNA-seq on rs12973192.
The SK-N-DZ cell lines are het, as is the WTC11 cell line. SH-SY5Y cells are homozygote for the major allele.
There was variability on the Klim hMN set on allelic expression.
```{r read in }
rel_rna_cryptic_amount = data.table::fread(file.path(here::here(),"data","kd_experiments_relative_rna_and_unc13a_cryptic_junction_counts.csv"))
rel_rna_cryptic_amount[,cryptic_psi_full := ( UNC13A_3prime +
UNC13A_5prime + UNC13A_5prime_2 +
UNC13A_5prime_3) / (UNC13A_annotated + UNC13A_3prime +
UNC13A_5prime + UNC13A_5prime_2 +
UNC13A_5prime_3)]
```
## barplot UNC13A CE PSI - full five
```{r}
rel_rna_cryptic_amount %>%
ggbarplot(,
x = "source",
add = c("mean_se","jitter"),
y = "cryptic_psi_full",
fill = 'condition',
color = 'condition',
position = position_dodge(0.8)) +
ggpubr::theme_pubr() +
scale_fill_manual(name = "",
values = c("#40B0A6","#E1BE6A")
) +
scale_color_manual(name = "",
values = c("#1C2617","#262114")
) +
ylab("UNC13A CE PSI") +
xlab("") +
guides(color = FALSE) +
scale_y_continuous(labels = scales::percent) +
theme(text = element_text(size = 20,family = 'sans'),
legend.text = element_text(size = 36,family = 'sans'),
axis.title.y = element_text(size = 28),
axis.text.y = element_text(size = 28))
```
## barplot UNC13B frameshift PSI
```{r}
rel_rna_cryptic_amount %>%
ggbarplot(,
x = "condition",
add = c("mean_se","jitter"),
y = "unc13b_nmd_exon_psi",
fill = 'condition',
color = 'condition',
position = position_dodge(0.8),facet.by = 'source') +
ggpubr::theme_pubr() +
scale_fill_manual(name = "",
values = c("#40B0A6","#E1BE6A")
) +
scale_color_manual(name = "",
values = c("#1C2617","#262114")
) +
ylab("UNC13B \nNMD Exon PSI") +
xlab("") +
guides(color = FALSE) +
theme(text = element_text(size = 20,family = 'sans'),
legend.text = element_text(size = 36,family = 'sans'),
axis.title.y = element_text(size = 28),
axis.text.y = element_text(size = 28)) +
facet_wrap(~source) +
stat_compare_means() +
scale_y_continuous(labels = scales::percent)
```
## TARDBP RNA and UNC13A Cryptic
```{r}
rel_rna_cryptic_amount %>%
filter(condition != "control") %>%
ggplot() +
geom_point(aes(x = TARDBP, y = cryptic_psi_full, fill = source),pch = 21,size = 4) +
stat_cor(aes(x = TARDBP, y = cryptic_psi_full),size = 12,method = 's',cor.coef.name = 'rho') +
geom_smooth(aes(x = TARDBP, y = cryptic_psi_full),color = "black",method = 'lm') +
ggpubr::theme_pubr() +
theme(text = element_text(size = 20)) +
scale_x_continuous(labels = scales::percent) +
ylab("UNC13A CE PSI") +
theme(legend.title=element_blank()) +
theme(legend.position = 'bottom') +
scale_y_continuous(labels = scales::percent)
```
## UNC13A RNA and UNC13A Cryptic
```{r}
rel_rna_cryptic_amount %>%
filter(condition != "control") %>%
ggplot() +
geom_point(aes(x = UNC13A, y = cryptic_psi_full, fill = source),pch = 21,size = 6) +
stat_cor(aes(x = UNC13A, y = cryptic_psi_full),size = 12,
method = 'spearman',
cor.coef.name = 'rho') +
geom_smooth(aes(x = UNC13A, y = cryptic_psi_full),color = "black",method = 'lm') +
ggpubr::theme_pubr() +
theme(text = element_text(size = 20)) +
scale_x_continuous(labels = scales::percent) +
scale_y_continuous(labels = scales::percent) +
ylab("UNC13A CE PSI") +
expand_limits(y = 1) +
theme(legend.title=element_blank()) +
theme(legend.position = 'bottom') +
theme(text = element_text(size = 18,family = 'sans'),
legend.text = element_text(size = 20,family = 'sans'),
axis.title = element_text(size = 32),
axis.text = element_text(size = 32))
```
## UNC13A RNA and UNC13A IR
```{r}
rel_rna_cryptic_amount %>%
filter(condition != "control") %>%
ggplot() +
geom_point(aes(x = UNC13A, y = normalized_unc13a_ir, fill = source),pch = 21,size = 4) +
stat_cor(aes(x = UNC13A, y = normalized_unc13a_ir),size = 12,cor.coef.name = 'rho',method = 's') +
geom_smooth(aes(x = UNC13A, y = normalized_unc13a_ir),color = "black",method = 'lm') +
ggpubr::theme_pubr() +
theme(text = element_text(size = 20)) +
scale_x_continuous(labels = scales::percent) +
ylab("UNC13A Normalized IR") +
theme(legend.title=element_blank()) +
theme(legend.position = 'bottom')
```
## TARDBP RNA and UNC13A IR
```{r}
rel_rna_cryptic_amount %>%
filter(condition != "control") %>%
ggplot() +
geom_point(aes(x = TARDBP, y = normalized_unc13a_ir, fill = source),pch = 21,size = 4) +
stat_cor(aes(x = TARDBP, y = normalized_unc13a_ir),size = 12) +
geom_smooth(aes(x = TARDBP, y = normalized_unc13a_ir),color = "black",method = 'lm') +
ggpubr::theme_pubr() +
theme(text = element_text(size = 20)) +
scale_x_continuous(labels = scales::percent) +
ylab("UNC13A Normalized IR") +
theme(legend.title=element_blank()) +
theme(legend.position = 'bottom')
```
## barplot UNC13A cryptic PSI
```{r}
rel_rna_cryptic_amount %>%
ggbarplot(,
x = "source",
add = c("mean_se","jitter"),
y = "cryptic_psi_full",
fill = 'condition',
color = 'condition',
position = position_dodge(0.8)) +
ggpubr::theme_pubr() +
scale_fill_manual(
values = c("#40B0A6","#E1BE6A")
) +
scale_color_manual(
values = c("#1C2617","#262114")
) +
ylab("UNC13A CE PSI") +
xlab("") +
guides(color = FALSE)
```
## barplot STMN2 cryptic PSI
```{r}
stmn2 = rel_rna_cryptic_amount %>%
ggbarplot(,
x = "source",
add = c("mean_se","jitter"),
y = "stmn_2_cryptic_psi",
fill = 'condition',
color = 'condition',
position = position_dodge(0.8)) +
ggpubr::theme_pubr() +
scale_fill_manual(
values = c("#40B0A6","#E1BE6A")
) +
scale_color_manual(
values = c("#1C2617","#262114")
) +
ylab("STMN2 Cryptic PSI") +
xlab("") +
guides(color = FALSE)
print(stmn2)
```
## barplot UNC13B normalized IR
```{r}
unc13b_ir = rel_rna_cryptic_amount %>%
ggbarplot(,
x = "source",
add = c("mean_se","jitter"),
y = "normalized_unc13b_ir",
fill = 'condition',
color = 'condition',
position = position_dodge(0.8)) +
ggpubr::theme_pubr() +
scale_fill_manual(
values = c("#40B0A6","#E1BE6A")
) +
scale_color_manual(
values = c("#1C2617","#262114")
) +
ylab("Normalized UNC13B \nIntron Retention Ratio") +
xlab("") +
guides(color = FALSE) +
theme(legend.position = "none") +
theme(text = element_text(size = 18)) +
guides(color = FALSE) +
theme(text = element_text(size = 20,family = 'sans'),
legend.text = element_text(size = 36,family = 'sans'),
axis.title.y = element_text(size = 28),
axis.text.y = element_text(size = 28))
print(unc13b_ir)
```
## barplot UNC13A normalized IR
```{r}
unc13a_ir = rel_rna_cryptic_amount %>%
ggbarplot(,
x = "source",
add = c("mean_se","jitter"),
y = "normalized_unc13a_ir",
fill = 'condition',
color = 'condition',
position = position_dodge(0.8)) +
ggpubr::theme_pubr() +
scale_fill_manual(
values = c("#40B0A6","#E1BE6A")
) +
scale_color_manual(
values = c("#1C2617","#262114")
) +
ylab("Normalized UNC13A \nIntron Retention Ratio") +
xlab("") +
theme(legend.position = "none") +
guides(color = FALSE) +
theme(text = element_text(size = 20,family = 'sans'),
legend.text = element_text(size = 36,family = 'sans'),
axis.title.y = element_text(size = 28),
axis.text.y = element_text(size = 28))
```
## barplot UNC13A normalized RNA Level
```{r}
text_table = fread(file.path(here::here(),"data","deseq2_cellline_fold_change.csv"))
rel_rna_cryptic_amount %>%
ggbarplot(,
x = "source",
add = c("mean_se","jitter"),
y = "UNC13A",
fill = 'condition',
color = 'condition',
position = position_dodge(0.8)) +
ggpubr::theme_pubr() +
scale_fill_manual(
values = c("#40B0A6","#E1BE6A")
) +
scale_color_manual(
values = c("#1C2617","#262114")
) +
ylab("UNC13A") +
xlab("") +
theme(legend.position = "none") +
guides(color = FALSE) +
theme(text = element_text(size = 20,family = 'sans'),
legend.text = element_text(size = 36,family = 'sans'),
axis.title.y = element_text(size = 28),
axis.text.y = element_text(size = 28)) +
scale_y_continuous(labels = scales::percent) +
geom_text(data = text_table[gene_name == "UNC13A"],aes(x = source, y= 1.35,label = padj_plot),size = 8) +
geom_text(data = text_table[gene_name == "UNC13A"],aes(x = source, y= 1.2,label = log2FoldChange_plot),size = 8)
```
## barplot UNC13B normalized RNA Level
```{r}
text_table = fread(file.path(here::here(),"data","deseq2_cellline_fold_change.csv"))
rel_rna_cryptic_amount %>%
left_join(text_table[,.(plot_name,source)]) %>%
unique() %>%
mutate(plot_name = fct_relevel(plot_name,"iPSC MN","SH-SY5Y","I3 Neurons","SK-N-DZ_a")) %>%
ggbarplot(,
x = "plot_name",
add = c("mean_se","jitter"),
y = "UNC13B",
fill = 'condition',
color = 'condition',
position = position_dodge(0.8)) +
ggpubr::theme_pubr() +
scale_fill_manual(
values = c("#40B0A6","#E1BE6A")
) +
scale_color_manual(
values = c("#1C2617","#262114")
) +
ylab("UNC13B") +
xlab("") +
theme(legend.position = "none") +
guides(color = FALSE) +
theme(text = element_text(size = 20,family = 'sans'),
legend.text = element_text(size = 36,family = 'sans'),
axis.title.y = element_text(size = 28),
axis.text.y = element_text(size = 28)) +
scale_y_continuous(labels = scales::percent,expand = expansion(mult = c(0, .1))) +
geom_text(data = text_table[gene_name == "UNC13B"],aes(x = plot_name, y= 1.35,label = padj_plot),size = 8) +
geom_text(data = text_table[gene_name == "UNC13B"],aes(x = plot_name, y= 1.2,label = log2FoldChange_plot),size = 8)
```
## barplot TARDBP normalized RNA Level
```{r}
text_table = fread(file.path(here::here(),"data","deseq2_cellline_fold_change.csv"))
rel_rna_cryptic_amount %>%
left_join(text_table[,.(plot_name,source)]) %>%
unique() %>%
mutate(plot_name = fct_relevel(plot_name,"iPSC MN","SH-SY5Y","I3 Neurons","SK-N-DZ_a")) %>%
ggbarplot(,
x = "plot_name",
add = c("mean_se","jitter"),
y = "TARDBP",
fill = 'condition',
color = 'condition',
position = position_dodge(0.8)) +
ggpubr::theme_pubr() +
scale_fill_manual(
values = c("#40B0A6","#E1BE6A")
) +
scale_color_manual(
values = c("#1C2617","#262114")
) +
ylab("TARDBP") +
xlab("") +
theme(legend.position = "none") +
guides(color = FALSE) +
theme(text = element_text(size = 20,family = 'sans'),
legend.text = element_text(size = 36,family = 'sans'),
axis.title.y = element_text(size = 28),
axis.text.y = element_text(size = 28)) +
scale_y_continuous(labels = scales::percent,expand = expansion(mult = c(0, .1))) +
geom_text(data = text_table[gene_name == "TARDBP"],aes(x = plot_name, y= 1.35,label = padj_plot),size = 8) +
geom_text(data = text_table[gene_name == "TARDBP"],aes(x = plot_name, y= 1.2,label = log2FoldChange_plot),size = 8)
```
## Scatterplot stmn2 normalized TARDBP
```{r}
rel_rna_cryptic_amount %>%
filter(condition != "control") %>%
ggplot() +
geom_point(aes(x = TARDBP, y = stmn_2_cryptic_psi, fill = source),pch = 21,size = 4) +
stat_cor(aes(x = TARDBP, y = stmn_2_cryptic_psi)) +
theme(legend.position = 'bottom')
```
## Scatterplot UNC13BIR normalized TARDBP
```{r}
rel_rna_cryptic_amount %>%
filter(condition != "control") %>%
ggplot() +
geom_point(aes(x = TARDBP, y = normalized_unc13b_ir, fill = source),pch = 21,size = 4) +
stat_cor(aes(x = TARDBP, y = normalized_unc13b_ir)) +
theme(legend.position = 'bottom')
```
## Scatterplot UNC13A-IR and UNC13A Crptic
```{r}
rel_rna_cryptic_amount %>%
filter(condition != "control") %>%
ggplot() +
geom_point(aes(x = cryptic_psi_full,
y = normalized_unc13a_ir, fill = source),pch = 21,size = 4) +
stat_cor(aes(x = cryptic_psi_full,
y = normalized_unc13a_ir)) +
theme(legend.position = 'bottom')
```
## Scatterplot UNC13B-IR and UNC13A Cryptic
```{r}
rel_rna_cryptic_amount %>%
filter(condition != "control") %>%
ggplot() +
geom_point(aes(x = cryptic_psi_full, y = normalized_unc13b_ir, fill = source),pch = 21,size = 4) +
stat_cor(aes(x = cryptic_psi_full, y = normalized_unc13b_ir)) +
theme(legend.position = 'bottom')+
facet_wrap(~source)
```
## scatterplot UNC13BIR and UNC13B NMD
```{r}
rel_rna_cryptic_amount %>%
filter(condition != "control") %>%
ggplot() +
geom_point(aes(x = unc13b_nmd_exon_psi, y = normalized_unc13b_ir, fill = source),pch = 21,size = 4) +
stat_cor(aes(x = unc13b_nmd_exon_psi, y = normalized_unc13b_ir)) +
theme(legend.position = 'bottom')+
facet_wrap(~source)
```
## scatterplot UNC13A CE and UNC13B NMD
```{r}
rel_rna_cryptic_amount %>%
filter(condition != "control") %>%
ggplot() +
geom_point(aes(x = cryptic_psi, y = normalized_unc13b_ir, fill = source),pch = 21,size = 4) +
stat_cor(aes(x = unc13b_nmd_exon_psi, y = normalized_unc13b_ir)) +
theme(legend.position = 'bottom')+
facet_wrap(~source)
```
# NMD experiment on SH-SY5Y cells - CHX
```{r}
std <- function(x) sd(x)/sqrt(length(x))
for_bar_plot_input <- fread(file.path(here::here(),"data","SY5Y_Tidy_4.csv"))
for_bar_plot <- data.frame(for_bar_plot_input)
for_bar_plot$Treatment <- factor(for_bar_plot$Treatment, levels = c("DMSO", "CHX"))
shapiro.test(filter(for_bar_plot, Treatment == "CHX" & Gene == "HNRNPL")$Value)
shapiro.test(filter(for_bar_plot, Treatment == "CHX" & Gene == "STMN2")$Value)
shapiro.test(filter(for_bar_plot, Treatment == "CHX" & Gene == "UNC13A")$Value)
shapiro.test(filter(for_bar_plot, Treatment == "CHX" & Gene == "UNC13B")$Value)
stattest <- for_bar_plot %>%
group_by(Gene) %>%
pairwise_t_test(Value ~ Treatment, ref.group = "DMSO", alternative = "greater") %>%
add_significance() %>%
add_xy_position(x="Treatment")
stattest
sum_for_bar_plot <- for_bar_plot %>%
group_by(Gene,Treatment) %>%
summarize(mean = mean(Value),sem = std(Value))
ggplot(sum_for_bar_plot) +
geom_col(aes(x = Gene, fill = Treatment, y = mean),position = "dodge2",color = 'black') +
scale_fill_manual(values = c("#F9AC66","#B4C640")) +
new_scale_fill() +
geom_errorbar(aes(x = Gene, ymin = mean - sem, ymax = mean + sem),
position = "dodge2",size = 1.8) +
geom_point(data = for_bar_plot, aes(x = Gene, fill = Treatment, y = Value),
pch = 21,
size = 4, stroke = 1.5,
position = position_jitterdodge(jitter.width = 0.2)) +
scale_fill_manual(values = c("#000000","#000000")) +
ggpubr::theme_pubr() +
theme(axis.ticks.length=unit(0.1,"inch"),
axis.line = element_line(colour = 'black', size = 1.5),
axis.ticks = element_line(colour = "black", size = 2))
```
# NMD experiment on SH-SY5Y cells - sTDP43+sUPF1
```{r}
for_bar_plot_sy_input <- fread(file.path(here::here(),"data","results_upf1.csv"))
for_bar_plot_sy_df <- data.frame(for_bar_plot_sy_input)
for_bar_plot_sy_df$Condition <- as.factor(for_bar_plot_sy_df$Condition)
#assess TDP-43 and UPF1 KD
for_bar_plot_sz <- for_bar_plot_sy_df %>%
filter(Gene == "TDP43" & (Condition == "siTDP43+siCTRL" | Condition == "siTDP43+siUPF1" | Condition == "Non-treated"))
shapiro.test(filter(for_bar_plot_sz, Condition == "siTDP43+siCTRL" & Gene == "TDP43")$Value)
shapiro.test(filter(for_bar_plot_sz, Condition == "siTDP43+siUPF1" & Gene == "TDP43")$Value)
stattest_sz <- for_bar_plot_sz %>%
pairwise_t_test(Value ~ Condition, ref.group = "Non-treated", alternative = "less") %>%
add_significance() %>%
add_xy_position(x="Condition")
stattest_sz
for_bar_plot_sx <- for_bar_plot_sy_df %>%
filter(Gene == "UPF1" & (Condition == "siTDP43+siCTRL" | Condition == "siTDP43+siUPF1"))
shapiro.test(filter(for_bar_plot_sx, Condition == "siTDP43+siUPF1" & Gene == "UPF1")$Value)
stattest_sx <- for_bar_plot_sx %>%
pairwise_t_test(Value ~ Condition, ref.group = "siTDP43+siCTRL", alternative = "less") %>%
add_significance() %>%
add_xy_position(x="Condition")
stattest_sx
for_bar_plot_szx <- for_bar_plot_sy_df %>%
filter(Gene == "TDP43" & (Condition == "siTDP43+siCTRL" | Condition == "siTDP43+siUPF1" | Condition == "Non-treated")
| Gene == "UPF1" & (Condition == "siTDP43+siCTRL" | Condition == "siTDP43+siUPF1"))
#fix position of stats for plot
stattest_sx$xmin[1] <- 1.8
stattest_sx$xmax[1] <- 2.2
stattest_sx$y.position[1] <- 1.3
stattest_sz$xmin[1] <- 0.75
stattest_sz$xmin[2] <- 0.75
stattest_sz$xmax[1] <- 1
stattest_sz$xmax[2] <- 1.25
stattest_sz$y.position[1] <- 1.2
stattest_sz$y.position[2] <- 1.3
nmd_plotz = ggbarplot(for_bar_plot_szx,
x = 'Gene',
add = c("mean_se","jitter"),
y = 'Value',
color = 'Condition',
position = position_dodge(0.8),
dot.size = 10) +
scale_y_continuous() + ylab("Percent of transcript after UPF1 knockdown") + xlab("Gene") +
ggpubr::theme_pubr() + stat_pvalue_manual(stattest_sz) + stat_pvalue_manual(stattest_sx)
plot(nmd_plotz)
#assess rescue of NMD-sensitive transcripts after UPF1 inhibition
for_bar_plot_sy <- for_bar_plot_sy_df %>%
filter(Gene == "hnRNPL" | Gene == "STMN2" | Gene == "UNC13A" | Gene == "UNC13B")
shapiro.test(filter(for_bar_plot_sy, Condition == "siTDP43+siUPF1" & Gene == "hnRNPL")$Value)
shapiro.test(filter(for_bar_plot_sy, Condition == "siTDP43+siUPF1" & Gene == "STMN2")$Value)
shapiro.test(filter(for_bar_plot_sy, Condition == "siTDP43+siUPF1" & Gene == "UNC13A")$Value)
shapiro.test(filter(for_bar_plot_sy, Condition == "siTDP43+siUPF1" & Gene == "UNC13B")$Value)
stattest_sy <- for_bar_plot_sy %>%
group_by(Gene) %>%
pairwise_t_test(Value ~ Condition, ref.group = "siTDP43+siCTRL", alternative = "greater") %>%
add_significance() %>%
add_xy_position(x="Condition")
stattest_sy
nmd_plot = ggbarplot(for_bar_plot_sy,
x = 'Gene',
add = c("mean_se","jitter"),
y = 'Value',
color = 'Condition',
fill = "Condition",
position = position_dodge(0.8),
dot.size = 20,
size = 1.5) +
scale_y_continuous() +
ggpubr::theme_pubr() + ylab("Percent of transcript after UPF1 knockdown") + xlab("Gene") +
stat_pvalue_manual(stattest_sy, label="p.signif", x = "Gene") +
theme(axis.ticks.length=unit(0.1,"inch"),
axis.line = element_line(colour = 'black', size = 1.5),
axis.ticks = element_line(colour = "black", size = 2))+
scale_fill_manual(values = c("#fca361ff","#aac043ff")) +
scale_color_manual(values = c("#000000ff","#000000ff"))
plot(nmd_plot)
```
# lowdox + chx plot - from tapestation data
```{r}
lowdox_chx <- fread(file.path(here::here(),"data","band_plot.csv"))
lowdox_chx <- data.frame(lowdox_chx)
lowdox_chx$Condition <- factor(lowdox_chx$Condition, levels = c("Untreated", "Doxycycline", "DMSO", "CHX"))
lowdox_chx$Band <- factor(lowdox_chx$Band, levels = c("Proper", "Short", "Long"))
stattest <- lowdox_chx %>%
group_by(Band) %>%
pairwise_t_test(Value ~ Condition, ref.group = "CHX") %>%
add_significance() %>%
add_y_position(step.increase = 0.05) %>%
add_x_position()
stattest <- filter(stattest, Band == "Proper")
stattest
nmd_plot_chx <- ggplot(lowdox_chx, aes(x = Condition, y = Value, color = Band, fill = Band)) +
stat_summary(fun = mean, geom = "bar", aes(fill = Band), show.legend = F, position = position_dodge(width = 0.95)) +
geom_point(size = 0.9, position = position_dodge(width = 0.95), color = "#000000") +
stat_summary(fun.data = mean_se, geom = "errorbar", width = 0.2, show.legend = F, position = position_dodge(width = 0.95), color = "#000000") +
stat_pvalue_manual(stattest) +
theme_classic() + theme(text = element_text(size = 24)) +
scale_color_manual(values = c("#1576B8","#EB7F3F","#975452", "#000000")) +
scale_fill_manual(values = c("#1576B8","#EB7F3F","#975452", "#000000")) +
xlab("Condition") + ylab("PSI after treatment")
plot(nmd_plot_chx)
```
# iPSC protein abundance mass spec
```{r}
peptides = fread(file.path(here::here(),"data","peptide_abdundance.csv"))
peptides %>%
mutate(gene = fct_relevel(gene, "UNC13A","UNC13B")) %>%
ggbarplot(,
x = "condition",
add = c("mean_se"),
y = "protein",
fill = 'condition',
color = 'condition',
position = position_dodge(0.8),
facet.by = 'gene') +
ggpubr::theme_pubr() +
scale_fill_manual(
values = c("#40B0A6","#E1BE6A")
) +
scale_color_manual(
values = c("#1C2617","#262114")
) +
ylab("Protein abundance") +
xlab("") +
geom_jitter(pch = 21,height = 0,aes(fill = condition),size = 2) +
guides(color = FALSE) +
facet_wrap(~gene, scales = 'free') +
theme(legend.position = 'none') +
scale_y_continuous(labels = scientific) +
stat_compare_means(comparisons = list(c("Control","TDP-43 KD")),
label = 'p.signif',tip.length = 0,
size = 10)
```
# Patient summary statistics
```{r}
force_colors = c("#F8766D", "#A3A500", "#00BF7D", "#00B0F6", "#E76BF3")
names(force_colors) = c("Control","ALS \n non-TDP","ALS-TDP","FTLD \n non-TDP","FTLD-TDP")
clean_data_table = fread(file.path(here::here(),"data","nygc_junction_information.csv"))
clean_data_table = clean_data_table %>%
mutate(rs12973192 = fct_relevel(rs12973192,
"C/C", "C/G", "G/G")) %>%
mutate(number_g_alleles = as.numeric(rs12973192) - 1) %>%
mutate(unc13a_cryptic_leaf_psi = ifelse(is.na(unc13a_cryptic_leaf_psi),0,unc13a_cryptic_leaf_psi)) %>%
mutate(junction_reads_stmn2 = STMN2_annotated_leaf + STMN2_cryptic_leaf) %>%
mutate(junction_reads_unc13a = UNC13A_3prime_leaf + UNC13A_5prime_1_leaf + UNC13A_annotated_leaf) %>%
unique()
print(glue::glue("Number of unique patients: {clean_data_table[,length(unique(participant_id))]}"))
print(glue::glue("Number of unique tissue samples: {clean_data_table[,length(unique(sample))]}"))
print("Patients Per Disease Category")
clean_data_table[,length(unique(participant_id)),by = disease]
print("Tissues Per Disease Category")
clean_data_table[,length(unique(sample)),by = disease]
print("Number of patients per UNC13A SNP genotype")
unique(clean_data_table[,.(participant_id,rs12608932,rs12973192)]) %>% select(-participant_id) %>% table()
print("Number of tissues per disease")
clean_data_table[,.N,by = c("disease","tissue_clean")]
print("Number of partcipants by mutation and disease")
clean_data_table[,length(unique(participant_id)),by = c("mutations","disease")]
print(glue::glue("Number of patients per pathology:"))
clean_data_table[,length(unique(participant_id)),by = .(pathology)]
```
# UNC13A cryptic is an event that is specific to TDP-43 proteinopathy
FTLD-non-TDP are those with TAU and FUS aggregates
Non-tdp ALS are those with SOD1 or FUS mutations. The n's are quite low on this
unfortunately, only 8 ALS with SOD1 and 2 with FUS mutations.
First we look at detection rate in tissues affected by TDP-43 proteinopathy,
For FTLD this is frontal and temporal Cortices, and
for ALS this is lumbar, cervical, and thoracic spinal cord samples as well as
motor cortex. For controls we also take all 6 tissues,
frontal,temporal,motor cortices and the lumbar, cervical, and thoracic spinal cords.
(As a side note, once we do this the number of ALS-non-TDP drops down to 6 (2 FUS) because
the ALS sample tissues are not balanced and not every participant has samples in every tissue)
```{r Inclusion reads by if TDP-potential}
####Inclusion reads by if TDP-potential####
boxplot_table = clean_data_table %>%
mutate(across(UNC13A_3prime_leaf:UNC13A_annotated_leaf, ~ .x / library_size,.names = "{.col}_library_norm")) %>%
filter(!tissue_clean %in% c("Choroid","Liver")) %>%
dplyr::select(sample,participant_id,mutations,disease_group2,pathology,tissue_clean,contains("_library_norm")) %>%
melt() %>%
filter(grepl("_3prime|_5prime_1",variable)) %>%
group_by(sample) %>%
mutate(inclusion_reads = sum(value)) %>%
ungroup() %>%
unique() %>%
mutate(junction_name = case_when(variable == "UNC13A_3prime_leaf_library_norm" ~ " Novel Donor",
variable == "UNC13A_5prime_1_leaf_library_norm" ~ " Short Novel Acceptor",
variable == "UNC13A_5prime_2_leaf_library_norm"~ "Long Novel Acceptor")) %>%
mutate(disease_tissue = case_when((grepl("FTLD",disease_group2) & grepl("Cortex",tissue_clean)) ~ T,
(grepl("ALS",disease_group2) & grepl("Cord|Motor",tissue_clean)) ~ T,
(grepl("Occipital",tissue_clean)) ~ F,
(grepl("Control",disease_group2) & grepl("Cord|Cortex",tissue_clean)) ~ T,
TRUE ~ F)) %>%
mutate(tissue_clean = gsub("_"," ",tissue_clean))
melt_count = clean_data_table[,.(sample,UNC13A_3prime_leaf,UNC13A_5prime_1_leaf,UNC13A_5prime_2_leaf)] %>% data.table::melt() %>% setnames(.,"value","orig_count")
```
## Pecent of patients UNC13A detected
Looking at disease tissue only, so just taking the cord and motor cortex in ALS and the
frontal and temporal cortex of FTLD and then the cord and cortices in Controls.
```{r}
clean_data_table %>%
filter(disease_tissue == T) %>%
mutate(inclusion_reads = UNC13A_3prime_leaf + UNC13A_5prime_1_leaf) %>%
mutate(detected = inclusion_reads > 0) %>%
dplyr::select(participant_id,disease_group2,detected) %>%
unique() %>%
group_by(disease_group2) %>%
mutate(n_sample = n_distinct(participant_id)) %>%
mutate(n_sample_detected = sum(detected)) %>%
dplyr::select(disease_group2,n_sample,n_sample_detected) %>%
unique() %>%
mutate(detection_rate = n_sample_detected / n_sample) %>%
mutate(disease_group2 = gsub("Control"," Control",disease_group2)) %>%
mutate(detection_name = glue::glue("{disease_group2} \n ( {n_sample} )")) %>%
ggplot() +
geom_col(aes(x = detection_name, y = detection_rate)) +
ggpubr::theme_pubr() +
scale_y_continuous(lim = c(0,1),labels = scales::percent) +
ylab("Percent of Patients \n UNC13A Cryptic Detected") +
theme(text = element_text(size = 24)) +
xlab("N individuals")
```
## Effect of sequencing machine (read length) on CE discovery
```{r unc detection by sequencer }
# library size
#llumina HiSeq 2500 (125 bp paired end) or an Illumina NovaSeq (100 bp paired end).
unc13a_sequencing_platform <- clean_data_table %>%
filter(tissue_clean %in% c("Frontal_Cortex",
"Lumbar_Spinal_Cord",
"Cervical_Spinal_Cord",
"Motor_Cortex",
"Temporal_Cortex")) %>%
mutate(inclusion_reads = UNC13A_3prime_leaf + UNC13A_5prime_1_leaf) %>%
mutate(unc13a_detected = ifelse(inclusion_reads > 0, yes = "+", no = "-")) %>%
mutate(tissue = as.character(tissue)) %>%
filter(sequencing_platform != "") %>%
filter(disease_group2 %in% c("ALS-TDP","FTLD-TDP"))
quick_fisher = function(tbl){
if(length(unique(tbl$sequencing_platform)) < 2){
return(NA)
}
comparison_table = table(unc13a = tbl$unc13a_detected,
sequencing_platform = tbl$sequencing_platform)
p_value = fisher.test(comparison_table)$p.value
return(p_value)
}
unc13a_data_fisher = unc13a_sequencing_platform %>%
filter(tissue_clean != "Thoracic_Spinal_Cord") %>%
group_by(disease_group2,tissue_clean) %>%
nest() %>%
mutate(fisher_pvalue = map_dbl(data, quick_fisher))
unc13a_data_fisher$data = NULL
unc13a_sequencing_platform_pct = unc13a_sequencing_platform %>%
group_by(disease_group2,tissue_clean, sequencing_platform, unc13a_detected) %>% tally() %>%
spread(key = unc13a_detected, value = n,fill = 0) %>%
mutate(detection = `+` / ( `-` + `+`) ) %>%
mutate(total = ( `-` + `+`) ) %>%
mutate(plot_name = glue::glue("{sequencing_platform} \n ({total})")) %>%
left_join(unc13a_data_fisher)
unc13a_sequencing_platform_pct %>%
ggplot(aes(x = plot_name, y = detection )) +
geom_col(fill = "firebrick") +
labs(title = "UNC13A CE detection and sequencing platform",
y = "UNC13A CE detected",x = element_blank(), subtitle = "Fisher exact test") +
facet_wrap(~disease_group2 + tissue_clean,scales = 'free_x') +
scale_y_continuous(labels = scales::percent_format(accuracy = 1)) +
geom_text(aes(x = 1.5, y = 1.05, label = paste0("p = ", signif(fisher_pvalue,digits = 2) ) )) +
theme(legend.text = element_text(size = 15)) +
ggpubr::theme_pubr() +
scale_fill_manual(values = ("#b3251f"))
# scale_y_continuous(expand = c(0,0) )
```
## Sequencing platform and disease type
Were there systemic differences in sequence platform between ALS and FTD?
```{r platform_compare}
tmp = clean_data_table %>%
filter(tissue_clean %in% c("Frontal_Cortex",
"Lumbar_Spinal_Cord",