-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathNanoImprint_2_newbedfiles.Rmd
More file actions
1011 lines (881 loc) · 52.3 KB
/
NanoImprint_2_newbedfiles.Rmd
File metadata and controls
1011 lines (881 loc) · 52.3 KB
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: "NanoImprint"
date: "`r format(Sys.time(), '%B %d, %Y')`"
output: html_document
---
reference genome T2T-CHM13v2.0
```{r include=FALSE}
library(readxl)
library(tidyverse, warning(F))
require(gridExtra)
library(ggplot2, warning(F))
library(edgeR, warning(F))
library(knitr)
library(kableExtra)
```
```{r echo=TRUE}
#import data
sample_df <- read.table("Your_file.methyl.filtered.bed", quote="\"", comment.char="")
hap1 <- read.table("Your_file_hap_1.methyl.filtered.bed", quote="\"", comment.char="")
hap2 <- read.table("Your_file_hap_2.methyl.filtered.bed", quote="\"", comment.char="")
#filter to only 5mC
sample_df<- sample_df[sample_df$V4== "m",]
hp1<- hap1[hap1$V4== "m",]
hp2<- hap2[hap2$V4== "m",]
```
```{r include=FALSE}
#import ctrls
ctrls= read_excel("ctrls_2.xlsx",1)
ctrls<- ctrls [, c(2:4)]
#dataset with selected columns + filtering
sorted_df <- sample_df[,c(2,5,11)]
colnames(sorted_df) <- c("start_position", "coverage", "methylation_frequency")
#dataset (hp1) with selected cloumns + filtering
hp1 <- hp1[,c(2,5,11)]
colnames(hp1) <- c("start_position", "coverage", "methylation_frequency")
#dataset (hp1) with selected cloumns + filtering
hp2 <- hp2[,c(2,5,11)]
colnames(hp2)<- c("start_position", "coverage", "methylation_frequency")
#Imprinted regions with T2T coordinates
PLAGL1_alt_TSS_DMR <- sorted_df %>% filter(between(start_position,145200200,145201432)) # MS-MLPA probe
PLAGL1_ctrl <- ctrls%>%filter(between(start_position,145200200,145201432))
#filter ctrl dataframe to rows where mean methylation frequency is between 40 and 60
PLAGL1_ctrl_filtered <- PLAGL1_ctrl %>% filter(between(methylation_frequency, 40, 60))
#filter dataframe to only include positions where the ctrl mean methylation is between 40 and 60 since these are most likely "imprinted" CpG positions
PLAGL1_alt_TSS_DMR_filtered <- PLAGL1_alt_TSS_DMR %>% semi_join(PLAGL1_ctrl_filtered, by = "start_position")
hp1_PLAGL1_alt_TSS_DMR <- hp1 %>% filter(between(start_position,145200200,145201432))
hp1_PLAGL1_alt_TSS_DMR_filtered<- hp1_PLAGL1_alt_TSS_DMR %>% semi_join(PLAGL1_ctrl_filtered, by = "start_position")
hp2_PLAGL1_alt_TSS_DMR <- hp2 %>% filter(between(start_position,145200200,145201432))
hp2_PLAGL1_alt_TSS_DMR_filtered<- hp2_PLAGL1_alt_TSS_DMR %>% semi_join(PLAGL1_ctrl_filtered, by = "start_position")
GRB10_alt_TSS_DMR<- sorted_df %>% filter(between(start_position,50943355,50944182)) # alders og vævs specifik
GRB10_ctrl <- ctrls %>% filter(between(start_position,50943355,50944182))
#filter ctrl dataframe to rows where mean methylation frequency is between 40 and 60
GRB10_ctrl_filtered <- GRB10_ctrl %>% filter(between(methylation_frequency, 40, 60))
#filter dataframe to only include positions where the ctrl mean methylation is between 40 and 60 since these are most likely "imprinted" CpG positions
GRB10_alt_TSS_DMR_filtered <- GRB10_alt_TSS_DMR %>% semi_join(GRB10_ctrl_filtered, by = "start_position")
hp1_GRB10_alt_TSS_DMR <- hp1 %>% filter(between(start_position,50943355,50944182))
hp1_GRB10_alt_TSS_DMR_filtered<- hp1_GRB10_alt_TSS_DMR %>% semi_join(GRB10_ctrl_filtered, by = "start_position")
hp2_GRB10_alt_TSS_DMR <- hp2 %>% filter(between(start_position,50943355,50944182))
hp2_GRB10_alt_TSS_DMR_filtered<- hp2_GRB10_alt_TSS_DMR %>% semi_join(GRB10_ctrl_filtered, by = "start_position")
MEST_alt_TSS_DMR<- sorted_df %>% filter(between(start_position,131804587,131807000))# MS-MLPA probe
MEST_ctrl <- ctrls %>% filter(between(start_position,131804587,131807000))
#filter ctrl dataframe to rows where mean methylation frequency is between 40 and 60
MEST_ctrl_filtered <- MEST_ctrl %>% filter(between(methylation_frequency, 40, 60))
#filter dataframe to only include positions where the ctrl mean methylation is between 40 and 60 since these are most likely "imprinted" CpG positions
MEST_alt_TSS_DMR_filtered <- MEST_alt_TSS_DMR %>% semi_join(MEST_ctrl_filtered, by = "start_position")
hp1_MEST_alt_TSS_DMR<- hp1 %>% filter(between(start_position,131804587,131807000))
hp1_MEST_alt_TSS_DMR_filtered <- hp1_MEST_alt_TSS_DMR %>% semi_join(MEST_ctrl_filtered, by = "start_position")
hp2_MEST_alt_TSS_DMR<- hp2 %>% filter(between(start_position,131804587,131807000))
hp2_MEST_alt_TSS_DMR_filtered <- hp2_MEST_alt_TSS_DMR %>% semi_join(MEST_ctrl_filtered, by = "start_position")
H19_IGF2_IG_DMR<- sorted_df %>% filter(between(start_position,2085438,2090906))# MS-MLPA probe
H19_ctrl <- ctrls%>% filter(between(start_position,2085438,2090906))
#filter ctrl dataframe to rows where mean methylation frequency is between 40 and 60
H19_ctrl_filtered <- H19_ctrl %>% filter(between(methylation_frequency, 40, 60))
#filter dataframe to only include positions where the ctrl mean methylation is between 40 and 60 since these are most likely "imprinted" CpG positions
H19_IGF2_IG_DMR_filtered <- H19_IGF2_IG_DMR %>% semi_join(H19_ctrl_filtered, by = "start_position")
hp1_H19_IGF2_IG_DMR<- hp1 %>% filter(between(start_position,2085438,2090906))
hp1_H19_IGF2_IG_DMR_filtered <- hp1_H19_IGF2_IG_DMR %>% semi_join(H19_ctrl_filtered, by = "start_position")
hp2_H19_IGF2_IG_DMR<- hp2 %>% filter(between(start_position,2085438,2090906))
hp2_H19_IGF2_IG_DMR_filtered <- hp2_H19_IGF2_IG_DMR %>% semi_join(H19_ctrl_filtered, by = "start_position")
KCNQ1OT1_TSS_DMR<- sorted_df %>% filter(between(start_position,2788106,2790240))# MS-MLPA probe
KCNQ_ctrl <- ctrls%>% filter(between(start_position,2788106,2790240))
#filter ctrl dataframe to rows where mean methylation frequency is between 40 and 60
KCNQ_ctrl_filtered <- KCNQ_ctrl %>% filter(between(methylation_frequency, 40, 60))
#filter dataframe to only include positions where the ctrl mean methylation is between 40 and 60 since these are most likely "imprinted" CpG positions
KCNQ1OT1_TSS_DMR_filtered <- KCNQ1OT1_TSS_DMR %>% semi_join(KCNQ_ctrl_filtered, by = "start_position")
hp1_KCNQ1OT1_TSS_DMR<- hp1 %>% filter(between(start_position,2788106,2790240))
hp1_KCNQ1OT1_TSS_DMR_filtered <- hp1_KCNQ1OT1_TSS_DMR %>% semi_join(KCNQ_ctrl_filtered, by = "start_position")
hp2_KCNQ1OT1_TSS_DMR<- hp2 %>% filter(between(start_position,2788106,2790240))
hp2_KCNQ1OT1_TSS_DMR_filtered <- hp2_KCNQ1OT1_TSS_DMR %>% semi_join(KCNQ_ctrl_filtered, by = "start_position")
#MEG3_DLK_IG_DMR<- sorted_df %>% filter(between(start_position,95044223,95046285))#
#MEG_DLK_ctrl <- ctrls%>% filter(between(start_position,95044223,95046285))
MEG3_TSS_DMR<- sorted_df %>% filter(between(start_position,95059075,95062529))# MS-MLPA probe
MEG3_ctrl <- ctrls%>% filter(between(start_position,95059075,95062529))
#filter ctrl dataframe to rows where mean methylation frequency is between 40 and 60
MEG3_ctrl_filtered <- MEG3_ctrl %>% filter(between(methylation_frequency, 40, 60))
#filter dataframe to only include positions where the ctrl mean methylation is between 40 and 60 since these are most likely "imprinted" CpG positions
MEG3_TSS_DMR_filtered <- MEG3_TSS_DMR %>% semi_join(MEG3_ctrl_filtered, by = "start_position")
hp1_MEG3_TSS_DMR<- hp1 %>% filter(between(start_position,95059075,95062529))
hp1_MEG3_TSS_DMR_filtered <- hp1_MEG3_TSS_DMR %>% semi_join(MEG3_ctrl_filtered, by = "start_position")
hp2_MEG3_TSS_DMR<- hp2 %>% filter(between(start_position,95059075,95062529))
hp2_MEG3_TSS_DMR_filtered <- hp2_MEG3_TSS_DMR %>% semi_join(MEG3_ctrl_filtered, by = "start_position")
MEG8_Int2_DMR <- sorted_df %>% filter(between(start_position,95140000,95140384))# MS-MLPA probe
MEG8_ctrl <- ctrls%>% filter(between(start_position,95140000,95140384))
#filter ctrl dataframe to rows where mean methylation frequency is between 40 and 60
MEG8_ctrl_filtered <- MEG8_ctrl %>% filter(between(methylation_frequency, 40, 60))
#filter dataframe to only include positions where the ctrl mean methylation is between 40 and 60 since these are most likely "imprinted" CpG positions
MEG8_Int2_DMR_filtered <- MEG8_Int2_DMR %>% semi_join(MEG8_ctrl_filtered, by = "start_position")
hp1_MEG8_Int2_DMR <- hp1 %>% filter(between(start_position,95140000,95140384))
hp1_MEG8_Int2_DMR_filtered <- hp1_MEG8_Int2_DMR %>% semi_join(MEG8_ctrl_filtered, by = "start_position")
hp2_MEG8_Int2_DMR <- hp2 %>% filter(between(start_position,95140000,95140384))
hp2_MEG8_Int2_DMR_filtered <- hp2_MEG8_Int2_DMR %>% semi_join(MEG8_ctrl_filtered, by = "start_position")
MAGEL2_TSS_DMR<- sorted_df %>% filter(between(start_position,21381784,21383056))# MS-MLPA probe
MAGEL2_ctrl <- ctrls%>% filter(between(start_position,21381784,21383056))
#filter ctrl dataframe to rows where mean methylation frequency is between 40 and 60
MAGEL2_ctrl_filtered <- MAGEL2_ctrl %>% filter(between(methylation_frequency, 40, 60))
#filter dataframe to only include positions where the ctrl mean methylation is between 40 and 60 since these are most likely "imprinted" CpG positions
MAGEL2_TSS_DMR_filtered <- MAGEL2_TSS_DMR %>% semi_join(MAGEL2_ctrl_filtered, by = "start_position")
hp1_MAGEL2_TSS_DMR<- hp1 %>% filter(between(start_position,21381784,21383056))
hp1_MAGEL2_TSS_DMR_filtered <- hp1_MAGEL2_TSS_DMR %>% semi_join(MAGEL2_ctrl_filtered, by = "start_position")
hp2_MAGEL2_TSS_DMR<- hp2 %>% filter(between(start_position,21381784,21383056))
hp2_MAGEL2_TSS_DMR_filtered <- hp2_MAGEL2_TSS_DMR %>% semi_join(MAGEL2_ctrl_filtered, by = "start_position")
SNURF_TSS_DMR<- sorted_df %>% filter(between(start_position,22691523,22693493))#MS-MLPA probe
SNURF_ctrl <- ctrls %>% filter(between(start_position,22691523,22693493))
#filter ctrl dataframe to rows where mean methylation frequency is between 40 and 60
SNURF_ctrl_filtered <- SNURF_ctrl %>% filter(between(methylation_frequency, 40, 60))
#filter dataframe to only include positions where the ctrl mean methylation is between 40 and 60 since these are most likely "imprinted" CpG positions
SNURF_TSS_DMR_filtered <- SNURF_TSS_DMR %>% semi_join(SNURF_ctrl_filtered, by = "start_position")
hp1_SNURF_TSS_DMR<- hp1 %>% filter(between(start_position,22691523,22693493))
hp1_SNURF_TSS_DMR_filtered <- hp1_SNURF_TSS_DMR %>% semi_join(SNURF_ctrl_filtered, by = "start_position")
hp2_SNURF_TSS_DMR<- hp2 %>% filter(between(start_position,22691523,22693493))
hp2_SNURF_TSS_DMR_filtered <- hp2_SNURF_TSS_DMR %>% semi_join(SNURF_ctrl_filtered, by = "start_position")
PEG3_TSS_DMR <- sorted_df %>% filter(between(start_position,59932193,59936667)) #MS-MLPA probe
PEG3_ctrl <- ctrls%>% filter(between(start_position,59932193,59936667))
#filter ctrl dataframe to rows where mean methylation frequency is between 40 and 60
PEG3_ctrl_filtered <- PEG3_ctrl %>% filter(between(methylation_frequency, 40, 60))
#filter dataframe to only include positions where the ctrl mean methylation is between 40 and 60 since these are most likely "imprinted" CpG positions
PEG3_TSS_DMR_filtered <- PEG3_TSS_DMR %>% semi_join(PEG3_ctrl_filtered, by = "start_position")
hp1_PEG3_TSS_DMR <- hp1 %>% filter(between(start_position,59932193,59936667))
hp1_PEG3_TSS_DMR_filtered <- hp1_PEG3_TSS_DMR %>% semi_join(PEG3_ctrl_filtered, by = "start_position")
hp2_PEG3_TSS_DMR <- hp2 %>% filter(between(start_position,59932193,59936667))
hp2_PEG3_TSS_DMR_filtered <- hp2_PEG3_TSS_DMR %>% semi_join(PEG3_ctrl_filtered, by = "start_position")
GNAS_NESP_TSS_DMR <- sorted_df %>% filter(between(start_position,60622124,60626697))#MS-MLPA probe
GNAS_NESP_ctrl <- ctrls %>% filter(between(start_position,60622124,60626697))
#filter ctrl dataframe to rows where mean methylation frequency is between 40 and 60
GNAS_NESP_ctrl_filtered <- GNAS_NESP_ctrl %>% filter(between(methylation_frequency, 40, 60))
#filter dataframe to only include positions where the ctrl mean methylation is between 40 and 60 since these are most likely "imprinted" CpG positions
GNAS_NESP_TSS_DMR_filtered <- GNAS_NESP_TSS_DMR %>% semi_join(GNAS_NESP_ctrl_filtered, by = "start_position")
hp1_GNAS_NESP_TSS_DMR <- hp1 %>% filter(between(start_position,60622124,60626697))
hp1_GNAS_NESP_TSS_DMR_filtered <- hp1_GNAS_NESP_TSS_DMR %>% semi_join(GNAS_NESP_ctrl_filtered, by = "start_position")
hp2_GNAS_NESP_TSS_DMR <- hp2 %>% filter(between(start_position,60622124,60626697))
hp2_GNAS_NESP_TSS_DMR_filtered <- hp2_GNAS_NESP_TSS_DMR %>% semi_join(GNAS_NESP_ctrl_filtered, by = "start_position")
GNAS_AS1_TSS_DMR <- sorted_df %>% filter(between(start_position,60633713,60636097))#MS-MLPA probe
GNAS_AS_ctrl <- ctrls %>% filter(between(start_position,60633713,60636097))
#filter ctrl dataframe to rows where mean methylation frequency is between 40 and 60
GNAS_AS_ctrl_filtered <- GNAS_AS_ctrl %>% filter(between(methylation_frequency, 40, 60))
#filter dataframe to only include positions where the ctrl mean methylation is between 40 and 60 since these are most likely "imprinted" CpG positions
GNAS_AS1_TSS_DMR_filtered <- GNAS_AS1_TSS_DMR %>% semi_join(GNAS_AS_ctrl_filtered, by = "start_position")
hp1_GNAS_AS1_TSS_DMR <- hp1 %>% filter(between(start_position,60633713,60636097))
hp1_GNAS_AS1_TSS_DMR_filtered <- hp1_GNAS_AS1_TSS_DMR %>% semi_join(GNAS_AS_ctrl_filtered, by = "start_position")
hp2_GNAS_AS1_TSS_DMR <- hp2 %>% filter(between(start_position,60633713,60636097))
hp2_GNAS_AS1_TSS_DMR_filtered <- hp2_GNAS_AS1_TSS_DMR %>% semi_join(GNAS_AS_ctrl_filtered, by = "start_position")
GNASXL_Ex1_DMR <- sorted_df %>% filter(between(start_position,60637080,60639527))#MS-MLPA probe
GNASXL_ctrl <- ctrls %>% filter(between(start_position,60637080,60639527))
#filter ctrl dataframe to rows where mean methylation frequency is between 40 and 60
GNASXL_ctrl_filtered <- GNASXL_ctrl %>% filter(between(methylation_frequency, 40, 60))
#filter dataframe to only include positions where the ctrl mean methylation is between 40 and 60 since these are most likely "imprinted" CpG positions
GNASXL_Ex1_DMR_filtered <- GNASXL_Ex1_DMR %>% semi_join(GNASXL_ctrl_filtered, by = "start_position")
hp1_GNASXL_Ex1_DMR <- hp1 %>% filter(between(start_position,60637080,60639527))
hp1_GNASXL_Ex1_DMR_filtered <- hp1_GNASXL_Ex1_DMR %>% semi_join(GNASXL_ctrl_filtered, by = "start_position")
hp2_GNASXL_Ex1_DMR <- hp2 %>% filter(between(start_position,60637080,60639527))
hp2_GNASXL_Ex1_DMR_filtered <- hp2_GNASXL_Ex1_DMR %>% semi_join(GNASXL_ctrl_filtered, by = "start_position")
GNAS_AB_TSS_DMR<- sorted_df %>% filter(between(start_position,60671509,60673270))#MS-MLPA probe
GNASAB_ctrl <- ctrls %>% filter(between(start_position,60671509,60673270))
#filter ctrl dataframe to rows where mean methylation frequency is between 40 and 60
GNASAB_ctrl_filtered <- GNASAB_ctrl %>% filter(between(methylation_frequency, 40, 60))
#filter dataframe to only include positions where the ctrl mean methylation is between 40 and 60 since these are most likely "imprinted" CpG positions
GNAS_AB_TSS_DMR_filtered <- GNAS_AB_TSS_DMR %>% semi_join(GNASAB_ctrl_filtered, by = "start_position")
hp1_GNAS_AB_TSS_DMR<- hp1 %>% filter(between(start_position,60671509,60673270))
hp1_GNAS_AB_TSS_DMR_filtered <- hp1_GNAS_AB_TSS_DMR %>% semi_join(GNASAB_ctrl_filtered, by = "start_position")
hp2_GNAS_AB_TSS_DMR<- hp2 %>% filter(between(start_position,60671509,60673270))
hp2_GNAS_AB_TSS_DMR_filtered <- hp2_GNAS_AB_TSS_DMR %>% semi_join(GNASAB_ctrl_filtered, by = "start_position")
#make table
#mean methylation is only calculated from positions where the controls have a mean methylation between 40 and 60
df<- data.frame(
ID = c("TNDM","SRS","SRS","SRS/BWS", "SRS/BWS", "TS14/KOS14", "TS14/KOS14", "PWS/AS", "PWS/AS","MLID", "PHP", "PHP", "PHP", "PHP"),
Chr = c("6q24","7p12","7q32","11p15", "11p15","14q32","14q32", "15q11", "15q11","19q13", "20q13","20q13","20q13","20q13"),
DMR.official.name = c("PLAGL1:alt-TSS-DMR","GRB10:alt-TSS-DMR","MEST:alt-TSS-DMR"
,"H19/IGF2:IG-DMR", "KCNQ1OT1:TSS-DMR","MEG3:TSS-DMR","MEG8:Int2-DMR",
"MAGEL2:TSS-DMR", "SNURF:TSS-DMR","PEG3:TSS-DMR","GNAS-NESP:TSS-DMR","GNAS-AS1:TSS-DMR","GNASXL:Ex1-DMR","GNAS A/B:TSS-DMR"),
Genomic.coordinates = c("145199654-145201464",
"50942206-50944802",
"131804002-131808268",
"2085259-2091187",
"2788057-2790367",
"95059075-95062529",
"95139836-95140514",
"21381699-21383303",
"22691523-22693495",
"59932193-59936971",
"60622124-60626697",
"60633713-60636097",
"60636969-60639527",
"60671329-60673270"),
CpGs = c(nrow(PLAGL1_alt_TSS_DMR_filtered), nrow(GRB10_alt_TSS_DMR_filtered), nrow(MEST_alt_TSS_DMR_filtered),
nrow(H19_IGF2_IG_DMR_filtered),nrow(KCNQ1OT1_TSS_DMR_filtered),
nrow(MEG3_TSS_DMR_filtered),nrow(MEG8_Int2_DMR_filtered), nrow(MAGEL2_TSS_DMR_filtered),
nrow(SNURF_TSS_DMR_filtered),nrow(PEG3_TSS_DMR_filtered),nrow(GNAS_NESP_TSS_DMR_filtered),
nrow(GNAS_AS1_TSS_DMR_filtered),nrow(GNASXL_Ex1_DMR_filtered), nrow(GNAS_AB_TSS_DMR_filtered)),
Mean.coverage= c(mean(PLAGL1_alt_TSS_DMR$coverage),
mean(GRB10_alt_TSS_DMR$coverage),
mean(MEST_alt_TSS_DMR$coverage),
mean(H19_IGF2_IG_DMR$coverage),
mean(KCNQ1OT1_TSS_DMR$coverage),
mean(MEG3_TSS_DMR$coverage),
mean(MEG8_Int2_DMR$coverage),
mean(MAGEL2_TSS_DMR$coverage),
mean(SNURF_TSS_DMR$coverage),
mean(PEG3_TSS_DMR$coverage),
mean(GNAS_NESP_TSS_DMR$coverage),
mean(GNAS_AS1_TSS_DMR$coverage),
mean(GNASXL_Ex1_DMR$coverage),
mean(GNAS_AB_TSS_DMR$coverage)),
hp1.mean.coverage= c(mean(hp1_PLAGL1_alt_TSS_DMR$coverage),
mean(hp1_GRB10_alt_TSS_DMR$coverage),
mean(hp1_MEST_alt_TSS_DMR$coverage),
mean(hp1_H19_IGF2_IG_DMR$coverage),
mean(hp1_KCNQ1OT1_TSS_DMR$coverage),
mean(hp1_MEG3_TSS_DMR$coverage),
mean(hp1_MEG8_Int2_DMR$coverage),
mean(hp1_MAGEL2_TSS_DMR$coverage),
mean(hp1_SNURF_TSS_DMR$coverage),
mean(hp1_PEG3_TSS_DMR$coverage),
mean(hp1_GNAS_NESP_TSS_DMR$coverage),
mean(hp1_GNAS_AS1_TSS_DMR$coverage),
mean(hp1_GNASXL_Ex1_DMR$coverage),
mean(hp1_GNAS_AB_TSS_DMR$coverage)),
hp2.mean.coverage= c(mean(hp2_PLAGL1_alt_TSS_DMR$coverage),
mean(hp2_GRB10_alt_TSS_DMR$coverage),
mean(hp2_MEST_alt_TSS_DMR$coverage),
mean(hp2_H19_IGF2_IG_DMR$coverage),
mean(hp2_KCNQ1OT1_TSS_DMR$coverage),
mean(hp2_MEG3_TSS_DMR$coverage),
mean(hp2_MEG8_Int2_DMR$coverage),
mean(hp2_MAGEL2_TSS_DMR$coverage),
mean(hp2_SNURF_TSS_DMR$coverage),
mean(hp2_PEG3_TSS_DMR$coverage),
mean(hp2_GNAS_NESP_TSS_DMR$coverage),
mean(hp2_GNAS_AS1_TSS_DMR$coverage),
mean(hp2_GNASXL_Ex1_DMR$coverage),
mean(hp2_GNAS_AB_TSS_DMR$coverage)),
Mean.methylation= c(mean(PLAGL1_alt_TSS_DMR_filtered$methylation_frequency),
mean(GRB10_alt_TSS_DMR_filtered$methylation_frequency),
mean(MEST_alt_TSS_DMR_filtered$methylation_frequency),
mean(H19_IGF2_IG_DMR_filtered$methylation_frequency),
mean(KCNQ1OT1_TSS_DMR_filtered$methylation_frequency),
mean(MEG3_TSS_DMR_filtered$methylation_frequency),
mean(MEG8_Int2_DMR_filtered$methylation_frequency),
mean(MAGEL2_TSS_DMR_filtered$methylation_frequency),
mean(SNURF_TSS_DMR_filtered$methylation_frequency),
mean(PEG3_TSS_DMR_filtered$methylation_frequency),
mean(GNAS_NESP_TSS_DMR_filtered$methylation_frequency),
mean(GNAS_AS1_TSS_DMR_filtered$methylation_frequency),
mean(GNASXL_Ex1_DMR_filtered$methylation_frequency),
mean(GNAS_AB_TSS_DMR_filtered$methylation_frequency)),
Mean.hp1=c(mean(hp1_PLAGL1_alt_TSS_DMR_filtered$methylation_frequency),
mean(hp1_GRB10_alt_TSS_DMR_filtered$methylation_frequency),
mean(hp1_MEST_alt_TSS_DMR_filtered$methylation_frequency),
mean(hp1_H19_IGF2_IG_DMR_filtered$methylation_frequency),
mean(hp1_KCNQ1OT1_TSS_DMR_filtered$methylation_frequency),
mean(hp1_MEG3_TSS_DMR_filtered$methylation_frequency),
mean(hp1_MEG8_Int2_DMR_filtered$methylation_frequency),
mean(hp1_MAGEL2_TSS_DMR_filtered$methylation_frequency),
mean(hp1_SNURF_TSS_DMR_filtered$methylation_frequency),
mean(hp1_PEG3_TSS_DMR_filtered$methylation_frequency),
mean(hp1_GNAS_NESP_TSS_DMR_filtered$methylation_frequency),
mean(hp1_GNAS_AS1_TSS_DMR_filtered$methylation_frequency),
mean(hp1_GNASXL_Ex1_DMR_filtered$methylation_frequency),
mean(hp1_GNAS_AB_TSS_DMR_filtered$methylation_frequency)),
Mean.hp2=c(mean(hp2_PLAGL1_alt_TSS_DMR_filtered$methylation_frequency),
mean(hp2_GRB10_alt_TSS_DMR_filtered$methylation_frequency),
mean(hp2_MEST_alt_TSS_DMR_filtered$methylation_frequency),
mean(hp2_H19_IGF2_IG_DMR_filtered$methylation_frequency),
mean(hp2_KCNQ1OT1_TSS_DMR_filtered$methylation_frequency),
mean(hp2_MEG3_TSS_DMR_filtered$methylation_frequency),
mean(hp2_MEG8_Int2_DMR_filtered$methylation_frequency),
mean(hp2_MAGEL2_TSS_DMR_filtered$methylation_frequency),
mean(hp2_SNURF_TSS_DMR_filtered$methylation_frequency),
mean(hp2_PEG3_TSS_DMR_filtered$methylation_frequency),
mean(hp2_GNAS_NESP_TSS_DMR_filtered$methylation_frequency),
mean(hp2_GNAS_AS1_TSS_DMR_filtered$methylation_frequency),
mean(hp2_GNASXL_Ex1_DMR_filtered$methylation_frequency),
mean(hp2_GNAS_AB_TSS_DMR_filtered$methylation_frequency)))
colnames(df) <- c("Imprinting disorder","Chr", "DMR Official name", "Genomic coordinates", "Number CpGs","Mean coverage","HP1 mean coverage", "HP2 mean coverage", "Mean methylation (%)", "HP1 mean methylation (%)","HP2 mean methylation (%)")
df$"Mean coverage" <- round(df$"Mean coverage", 0)
df$"HP1 mean coverage" <- round(df$"HP1 mean coverage", 0)
df$"HP2 mean coverage" <- round(df$"HP2 mean coverage", 0)
df$"Mean methylation (%)" <- round(df$"Mean methylation", 1)
df$"HP1 mean methylation (%)" <- round(df$"HP1 mean methylation", 1)
df$"HP2 mean methylation (%)" <- round(df$"HP2 mean methylation", 1)
df <- df %>%
mutate(across(everything(), as.character)) %>%
kable("html", escape = FALSE) %>%
kable_styling() %>%
column_spec(9, color = ifelse(df$"Mean methylation" < 30 | df$"Mean methylation" > 75, "red", "black"),
bold = ifelse(df$"Mean methylation" < 30 | df$"Mean methylation" > 75, TRUE, FALSE))
```
```{r echo=FALSE}
df
```
```{r include=FALSE}
plagl1 <- ggplot(data = PLAGL1_alt_TSS_DMR,aes(x= start_position, group = 1, se=F)) +
geom_smooth(aes(y=methylation_frequency), colour="black", se=F) +
geom_point(aes(y = methylation_frequency), colour = "black", alpha=0.3) +
geom_ribbon(data=PLAGL1_ctrl, aes(ymin=methylation_frequency - sd,
ymax= methylation_frequency + sd), alpha=0.2)+
geom_ribbon(data=PLAGL1_ctrl, aes(ymin=methylation_frequency - 1.5*sd,
ymax= methylation_frequency + 0.1*sd), alpha=0.1)+
ylab("Methylation frequency (%)") +
xlab("Chr6 position") +
ggtitle ("Unphased: PLAGL1:alt-TSS-DMR") +
coord_cartesian(xlim= c(145200200,145201432), ylim = c(-5,105), expand=F)+
theme_light()+
theme(text = element_text(size = 15))
grb10 <- ggplot(data = GRB10_alt_TSS_DMR,aes(x= start_position, group = 1, se=F)) +
geom_smooth(aes(y=methylation_frequency), colour="black", se=F) +
geom_point(aes(y = methylation_frequency), colour = "black", alpha=0.3) +
geom_ribbon(data=GRB10_ctrl, aes(ymin=methylation_frequency - sd,
ymax= methylation_frequency + sd), alpha=0.2)+
geom_ribbon(data=GRB10_ctrl, aes(ymin=methylation_frequency - 1.5*sd,
ymax= methylation_frequency + 1.5*sd), alpha=0.1)+
ylab("Methylation frequency (%)") +
xlab("Chr7 position") +
ggtitle ("Unphased: GRB10:alt-TSS-DMR") +
coord_cartesian(xlim= c(50943355,50944182), ylim = c(-5,105), expand=F)+
theme_light()+
theme(text = element_text(size = 15))
mest <- ggplot(data = MEST_alt_TSS_DMR,aes(x= start_position, group = 1, se=F)) +
geom_smooth(aes(y=methylation_frequency), colour="black", se=F) +
geom_point(aes(y = methylation_frequency), colour = "black", alpha=0.3) +
geom_ribbon(data=MEST_ctrl, aes(ymin=methylation_frequency - sd,
ymax= methylation_frequency + sd), alpha=0.2)+
geom_ribbon(data=MEST_ctrl, aes(ymin=methylation_frequency - 1.5*sd,
ymax= methylation_frequency + 1.5*sd), alpha=0.1)+
ylab("Methylation frequency (%)") +
xlab("Chr7 position") +
ggtitle ("Unphased: MEST:alt-TSS-DMR") +
coord_cartesian(xlim= c(131804587,131807000), ylim = c(-5,105), expand=F)+
theme_light()+
theme(text = element_text(size = 15))
h19 <- ggplot(data = H19_IGF2_IG_DMR,aes(x= start_position, y=methylation_frequency, group = 1)) +
geom_smooth(aes(y=methylation_frequency), colour="black", se=F) +
geom_point(aes(y = methylation_frequency), colour = "black", alpha=0.3) +
geom_ribbon(data=H19_ctrl, aes(ymin=methylation_frequency - sd,
ymax= methylation_frequency + sd), alpha=0.2)+
geom_ribbon(data=H19_ctrl, aes(ymin=methylation_frequency - 1.5*sd,
ymax= methylation_frequency + 1.5*sd), alpha=0.1)+
ylab("Methylation frequency (%)") +
xlab("Chr11 position") +
ggtitle ("Unphased: H19/IGF2:IG-DMR") +
coord_cartesian(xlim= c(2085438,2090906), ylim = c(-5,105), expand=F)+
theme_light()+
theme(text = element_text(size = 15))
kcnq1 <- ggplot(data = KCNQ1OT1_TSS_DMR,aes(x= start_position, group = 1, se=F)) +
geom_smooth(aes(y=methylation_frequency), colour="black", se=F) +
geom_point(aes(y = methylation_frequency), colour = "black", alpha=0.3) +
geom_ribbon(data=KCNQ_ctrl, aes(ymin=methylation_frequency - sd,
ymax= methylation_frequency + sd), alpha=0.2)+
geom_ribbon(data=KCNQ_ctrl, aes(ymin=methylation_frequency - 1.5*sd,
ymax= methylation_frequency + 1.5*sd), alpha=0.1)+
ylab("Methylation frequency (%)") +
xlab("Chr11 position") +
ggtitle ("Unphased: KCNQ1OT1:TSS-DMR")+
coord_cartesian(xlim= c(2788106,2790240), ylim = c(-5,105), expand=F)+
theme_light()+
theme(text = element_text(size = 15))
meg3 <- ggplot(data = MEG3_TSS_DMR,aes(x= start_position, group = 1, se=F)) +
geom_smooth(aes(y=methylation_frequency), colour="black", se=F) +
geom_point(aes(y = methylation_frequency), colour = "black", alpha=0.3) +
geom_ribbon(data=MEG3_ctrl, aes(ymin=methylation_frequency - sd,
ymax= methylation_frequency + sd), alpha=0.2)+
geom_ribbon(data=MEG3_ctrl, aes(ymin=methylation_frequency - 1.5*sd,
ymax= methylation_frequency + 1.5*sd), alpha=0.1)+
ylab("Methylation frequency (%)") +
xlab("Chr14 position") +
ggtitle ("Unphased: MEG3:TSS-DMR")+
coord_cartesian(xlim= c(95059075,95062529), ylim = c(-5,105), expand=F)+
theme_light()+
theme(text = element_text(size = 15))
meg8 <- ggplot(data = MEG8_Int2_DMR,aes(x= start_position, group = 1, se=F)) +
geom_smooth(aes(y=methylation_frequency), colour="black", se=F) +
geom_point(aes(y = methylation_frequency), colour = "black", alpha=0.3) +
geom_ribbon(data=MEG8_ctrl, aes(ymin=methylation_frequency - sd,
ymax= methylation_frequency + sd), alpha=0.2)+
geom_ribbon(data=MEG8_ctrl, aes(ymin=methylation_frequency - 1.5*sd,
ymax= methylation_frequency + 1.5*sd), alpha=0.1)+
ylab("Methylation frequency (%)") +
xlab("Chr14 position") +
ggtitle ("Unphased: MEG8:Int2-DMR")+
coord_cartesian(xlim= c(95140029,95140384), ylim = c(-5,105), expand=F)+
theme_light()+
theme(text = element_text(size = 15))
magel2 <- ggplot(data = MAGEL2_TSS_DMR,aes(x= start_position, group = 1, se=F)) +
geom_smooth(aes(y=methylation_frequency), colour="black", se=F) +
geom_point(aes(y = methylation_frequency), colour = "black", alpha=0.3) +
geom_ribbon(data=MAGEL2_ctrl, aes(ymin=methylation_frequency - sd,
ymax= methylation_frequency + sd), alpha=0.2)+
geom_ribbon(data=MAGEL2_ctrl, aes(ymin=methylation_frequency - 1.5*sd,
ymax= methylation_frequency + 1.5*sd), alpha=0.1)+
ylab("Methylation frequency (%)") +
xlab("Chr15 position") +
ggtitle ("Unphased: MAGEL2:TSS-DMR")+
coord_cartesian(xlim= c(21381784,21383056), ylim = c(-5,105), expand=F)+
theme_light()+
theme(text = element_text(size = 15))
snurf <- ggplot(data = SNURF_TSS_DMR,aes(x= start_position, group = 1, se=F)) +
geom_smooth(aes(y=methylation_frequency), colour="black", se=F) +
geom_point(aes(y = methylation_frequency), colour = "black", alpha=0.3) +
geom_ribbon(data=SNURF_ctrl, aes(ymin=methylation_frequency - sd,
ymax= methylation_frequency + sd), alpha=0.2)+
geom_ribbon(data=SNURF_ctrl, aes(ymin=methylation_frequency - 1.5*sd,
ymax= methylation_frequency + 1.5*sd), alpha=0.1)+
ylab("Methylation frequency (%)") +
xlab("Chr15 position") +
ggtitle ("Unphased: SNURF:TSS-DMR")+
coord_cartesian(xlim= c(22691523,22693493), ylim = c(-5,105), expand=F)+
theme_light()+
theme(text = element_text(size = 15))
peg3 <- ggplot(data = PEG3_TSS_DMR,aes(x= start_position, group = 1, se=F)) +
geom_smooth(aes(y=methylation_frequency), colour="black", se=F) +
geom_point(aes(y = methylation_frequency), colour = "black", alpha=0.3) +
geom_ribbon(data=PEG3_ctrl, aes(ymin=methylation_frequency - sd,
ymax= methylation_frequency + sd), alpha=0.2)+
geom_ribbon(data=PEG3_ctrl, aes(ymin=methylation_frequency - 1.5*sd,
ymax= methylation_frequency + 1.5*sd), alpha=0.1)+
ylab("Methylation frequency (%)") +
xlab("Chr19 position") +
ggtitle ("Unphased: PEG3:TSS-DMR")+
coord_cartesian(xlim= c(59932193,59936667), ylim = c(-5,105), expand=F)+
theme_light()+
theme(text = element_text(size = 15))
gnasnesp <- ggplot(data = GNAS_NESP_TSS_DMR,aes(x= start_position, group = 1, se=F)) +
geom_smooth(aes(y=methylation_frequency), colour="black", se=F) +
geom_point(aes(y = methylation_frequency), colour = "black", alpha=0.3) +
geom_ribbon(data=GNAS_NESP_ctrl, aes(ymin=methylation_frequency - sd,
ymax= methylation_frequency + sd), alpha=0.2)+
geom_ribbon(data=GNAS_NESP_ctrl, aes(ymin=methylation_frequency - 1.5*sd,
ymax= methylation_frequency + 1.5*sd), alpha=0.1)+
ylab("Methylation frequency (%)") +
xlab("Chr20 position") +
ggtitle ("Unphased: GNAS-NESP:TSS-DMR")+
coord_cartesian(xlim= c(60622124,60626697), ylim = c(-5,105), expand=F)+
theme_light()+
theme(text = element_text(size = 15))
gnas1 <- ggplot(data = GNAS_AS1_TSS_DMR,aes(x= start_position, group = 1, se=F)) +
geom_smooth(aes(y=methylation_frequency), colour="black", se=F) +
geom_point(aes(y = methylation_frequency), colour = "black", alpha=0.3) +
geom_ribbon(data=GNAS_AS_ctrl, aes(ymin=methylation_frequency - sd,
ymax= methylation_frequency + sd), alpha=0.2)+
geom_ribbon(data=GNAS_AS_ctrl, aes(ymin=methylation_frequency - 1.5*sd,
ymax= methylation_frequency + 1.5*sd), alpha=0.1)+
ylab("Methylation frequency (%)") +
xlab("Chr20 position") +
ggtitle ("Unphased: GNAS-AS1:TSS-DMR")+
coord_cartesian(xlim= c(60633713,60636097), ylim = c(-5,105), expand=F)+
theme_light()+
theme(text = element_text(size = 15))
gnasxl <- ggplot(data = GNASXL_Ex1_DMR,aes(x= start_position, group = 1, se=F)) +
geom_smooth(aes(y=methylation_frequency), colour="black", se=F) +
geom_point(aes(y = methylation_frequency), colour = "black", alpha=0.3) +
geom_ribbon(data=GNASXL_ctrl, aes(ymin=methylation_frequency - sd,
ymax= methylation_frequency + sd), alpha=0.2)+
geom_ribbon(data=GNASXL_ctrl, aes(ymin=methylation_frequency - 1.5*sd,
ymax= methylation_frequency + 1.5*sd), alpha=0.1)+
ylab("Methylation frequency (%)") +
xlab("Chr20 position") +
ggtitle ("Unphased: GNASXL:Ex1-DMR")+
coord_cartesian(xlim= c(60637080,60639527), ylim = c(-5,105), expand=F)+
theme_light()+
theme(text = element_text(size = 15))
gnasab <- ggplot(data = GNAS_AB_TSS_DMR,aes(x= start_position, group = 1, se=F)) +
geom_smooth(aes(y=methylation_frequency), colour="black", se=F) +
geom_point(aes(y = methylation_frequency), colour = "black", alpha=0.3) +
geom_ribbon(data=GNASAB_ctrl, aes(ymin=methylation_frequency - sd,
ymax= methylation_frequency + sd), alpha=0.2)+
geom_ribbon(data=GNASAB_ctrl, aes(ymin=methylation_frequency - 1.5*sd,
ymax= methylation_frequency + 1.5*sd), alpha=0.1)+
ylab("Methylation frequency (%)") +
xlab("Chr20 position") +
ggtitle ("Unphased: GNAS A/B:TSS-DMR")+
coord_cartesian(xlim= c(60671509,60673270), ylim = c(-5,105), expand=F)+
theme_light()+
theme(text = element_text(size = 15))
# Check if any data frames are empty
if(nrow(hp1_PLAGL1_alt_TSS_DMR) > 0 && nrow(hp2_PLAGL1_alt_TSS_DMR) > 0) {
# Create the plot
plagl1_hp <- ggplot() +
geom_smooth(data = hp1_PLAGL1_alt_TSS_DMR, aes(x = start_position, y = methylation_frequency), colour = "red", se = F) +
geom_point(data = hp1_PLAGL1_alt_TSS_DMR, aes(x = start_position, y = methylation_frequency), colour = "red", alpha = 0.3) +
geom_smooth(data = hp2_PLAGL1_alt_TSS_DMR , aes(x = start_position, y = methylation_frequency), colour = "blue", se = F) +
geom_point(data = hp2_PLAGL1_alt_TSS_DMR, aes(x = start_position, y = methylation_frequency), colour = "blue", alpha = 0.3) +
ylab("Methylation frequency (%)") +
xlab("Chr6 position") +
ggtitle("Phased: PLAGL1:alt-TSS-DMR ") +
coord_cartesian(xlim = c(145200200, 145201432), ylim = c(-5, 105), expand = F) +
theme_light()+
theme(text = element_text(size = 15))
} else {
# Create the plot without data
plagl1_hp <- ggplot() +
ylab("Methylation frequency (%)") +
xlab("Chr6 position") +
ggtitle("Phased: PLAGL1:alt-TSS-DMR ") +
coord_cartesian(xlim = c(145200200, 145201432), ylim = c(-5, 105), expand = F) +
theme_light() +
theme(text = element_text(size = 15)) +
geom_blank()
}
# Check if any data frames are empty
if(nrow(hp1_GRB10_alt_TSS_DMR) > 0 && nrow(hp2_GRB10_alt_TSS_DMR) > 0) {
grb10_hp <- ggplot() +
geom_smooth(data = hp1_GRB10_alt_TSS_DMR, aes(x = start_position, y = methylation_frequency), colour = "red", se = F) +
geom_point(data = hp1_GRB10_alt_TSS_DMR, aes(x = start_position, y = methylation_frequency), colour = "red", alpha = 0.3) +
geom_smooth(data = hp2_GRB10_alt_TSS_DMR , aes(x = start_position, y = methylation_frequency), colour = "blue", se = F) +
geom_point(data = hp2_GRB10_alt_TSS_DMR, aes(x = start_position, y = methylation_frequency), colour = "blue", alpha = 0.3) +
ylab("Methylation frequency (%)") +
xlab("Chr7 position") +
ggtitle ("Phased: GRB10:alt-TSS-DMR") +
coord_cartesian(xlim= c(50943355,50944182), ylim = c(-5,105), expand=F)+
theme_light()+
theme(text = element_text(size = 15))
} else {
# Create the plot without data
grb10_hp <- ggplot() +
ylab("Methylation frequency (%)") +
xlab("Chr7 position") +
ggtitle ("Phased: GRB10:alt-TSS-DMR") +
coord_cartesian(xlim= c(50943355,50944182), ylim = c(-5,105), expand=F)+
theme_light() +
theme(text = element_text(size = 15)) +
geom_blank()
}
# Check if any data frames are empty
if(nrow(hp1_MEST_alt_TSS_DMR) > 0 && nrow(hp2_MEST_alt_TSS_DMR) > 0) {
mest_hp <- ggplot() +
geom_smooth(data = hp1_MEST_alt_TSS_DMR, aes(x = start_position, y = methylation_frequency), colour = "red", se = F) +
geom_point(data = hp1_MEST_alt_TSS_DMR, aes(x = start_position, y = methylation_frequency), colour = "red", alpha = 0.3) +
geom_smooth(data = hp2_MEST_alt_TSS_DMR , aes(x = start_position, y = methylation_frequency), colour = "blue", se = F) +
geom_point(data = hp2_MEST_alt_TSS_DMR, aes(x = start_position, y = methylation_frequency), colour = "blue", alpha = 0.3) +
ylab("Methylation frequency (%)") +
xlab("Chr7 position") +
ggtitle ("Phased: MEST:alt-TSS-DMR") +
coord_cartesian(xlim= c(131804587,131807000), ylim = c(-5,105), expand=F)+
theme_light()+
theme(text = element_text(size = 15))
} else {
# Create the plot without data
mest_hp <- ggplot() +
ylab("Methylation frequency (%)") +
xlab("Chr7 position") +
ggtitle ("Phased: MEST:alt-TSS-DMR") +
coord_cartesian(xlim= c(131804587,131807000), ylim = c(-5,105), expand=F)+
theme_light()+
theme(text = element_text(size = 15)) +
geom_blank()
}
# Check if any data frames are empty
if(nrow(hp1_H19_IGF2_IG_DMR) > 0 && nrow(hp2_H19_IGF2_IG_DMR) > 0) {
h19_hp <- ggplot() +
geom_smooth(data = hp1_H19_IGF2_IG_DMR, aes(x = start_position, y = methylation_frequency), colour = "red", se = F) +
geom_point(data = hp1_H19_IGF2_IG_DMR, aes(x = start_position, y = methylation_frequency), colour = "red", alpha = 0.3) +
geom_smooth(data = hp2_H19_IGF2_IG_DMR , aes(x = start_position, y = methylation_frequency), colour = "blue", se = F) +
geom_point(data = hp2_H19_IGF2_IG_DMR, aes(x = start_position, y = methylation_frequency), colour = "blue", alpha = 0.3) +
ylab("Methylation frequency (%)") +
xlab("Chr11 position") +
ggtitle ("Phased: H19/IGF2:IG-DMR") +
coord_cartesian(xlim= c(2085438,2090906), ylim = c(-5,105), expand=F)+
theme_light()+
theme(text = element_text(size = 15))
} else {
# Create the plot without data
h19_hp <- ggplot() +
ylab("Methylation frequency (%)") +
xlab("Chr11 position") +
ggtitle ("Phased: H19/IGF2:IG-DMR") +
coord_cartesian(xlim= c(2085438,2090906), ylim = c(-5,105), expand=F)+
theme_light()+
theme(text = element_text(size = 15)) +
geom_blank()
}
# Check if any data frames are empty
if(nrow(hp1_KCNQ1OT1_TSS_DMR) > 0 && nrow(hp2_KCNQ1OT1_TSS_DMR) > 0) {
kcnq1_hp <- ggplot() +
geom_smooth(data = hp1_KCNQ1OT1_TSS_DMR, aes(x = start_position, y = methylation_frequency), colour = "red", se = F) +
geom_point(data = hp1_KCNQ1OT1_TSS_DMR, aes(x = start_position, y = methylation_frequency), colour = "red", alpha = 0.3) +
geom_smooth(data = hp2_KCNQ1OT1_TSS_DMR , aes(x = start_position, y = methylation_frequency), colour = "blue", se = F) +
geom_point(data = hp2_KCNQ1OT1_TSS_DMR, aes(x = start_position, y = methylation_frequency), colour = "blue", alpha = 0.3) +
ylab("Methylation frequency (%)") +
xlab("Chr11 position") +
ggtitle ("Phased: KCNQ1OT1:TSS-DMR")+
coord_cartesian(xlim= c(2788106,2790240), ylim = c(-5,105), expand=F)+
theme_light()+
theme(text = element_text(size = 15))
} else {
# Create the plot without data
kcnq1_hp <- ggplot() +
ylab("Methylation frequency (%)") +
xlab("Chr11 position") +
ggtitle ("Phased: KCNQ1OT1:TSS-DMR")+
coord_cartesian(xlim= c(2788106,2790240), ylim = c(-5,105), expand=F)+
theme_light()+
theme(text = element_text(size = 15)) +
geom_blank()
}
# Check if any data frames are empty
if(nrow(hp1_MEG3_TSS_DMR) > 0 && nrow(hp2_MEG3_TSS_DMR) > 0) {
meg3_hp <- ggplot() +
geom_smooth(data = hp1_MEG3_TSS_DMR, aes(x = start_position, y = methylation_frequency), colour = "red", se = F) +
geom_point(data = hp1_MEG3_TSS_DMR, aes(x = start_position, y = methylation_frequency), colour = "red", alpha = 0.3) +
geom_smooth(data = hp2_MEG3_TSS_DMR , aes(x = start_position, y = methylation_frequency), colour = "blue", se = F) +
geom_point(data = hp2_MEG3_TSS_DMR, aes(x = start_position, y = methylation_frequency), colour = "blue", alpha = 0.3) +
ylab("Methylation frequency (%)") +
xlab("Chr14 position") +
ggtitle ("Phased: MEG3:TSS-DMR")+
coord_cartesian(xlim= c(95059075,95062529), ylim = c(-5,105), expand=F)+
theme_light()+
theme(text = element_text(size = 15))
} else {
# Create the plot without data
meg3_hp <- ggplot() +
ylab("Methylation frequency (%)") +
xlab("Chr14 position") +
ggtitle ("Phased: MEG3:TSS-DMR")+
coord_cartesian(xlim= c(95059075,95062529), ylim = c(-5,105), expand=F)+
theme_light()+
theme(text = element_text(size = 15)) +
geom_blank()
}
# Check if any data frames are empty
if(nrow(hp1_MEG8_Int2_DMR) > 0 && nrow(hp2_MEG8_Int2_DMR) > 0) {
meg8_hp <- ggplot() +
geom_smooth(data = hp1_MEG8_Int2_DMR, aes(x = start_position, y = methylation_frequency), colour = "red", se = F) +
geom_point(data = hp1_MEG8_Int2_DMR, aes(x = start_position, y = methylation_frequency), colour = "red", alpha = 0.3) +
geom_smooth(data = hp2_MEG8_Int2_DMR , aes(x = start_position, y = methylation_frequency), colour = "blue", se = F) +
geom_point(data = hp2_MEG8_Int2_DMR, aes(x = start_position, y = methylation_frequency), colour = "blue", alpha = 0.3) +
ylab("Methylation frequency (%)") +
xlab("Chr14 position") +
ggtitle ("Phased: MEG8:Int2-DMR")+
coord_cartesian(xlim= c(95140029,95140384), ylim = c(-5,105), expand=F)+
theme_light()+
theme(text = element_text(size = 15))
} else {
# Create the plot without data
meg8_hp <- ggplot() +
ylab("Methylation frequency (%)") +
xlab("Chr14 position") +
ggtitle ("Phased: MEG8:Int2-DMR")+
coord_cartesian(xlim= c(95140029,95140384), ylim = c(-5,105), expand=F)+
theme_light()+
theme(text = element_text(size = 15)) +
geom_blank()
}
# Check if any data frames are empty
if(nrow(hp1_MAGEL2_TSS_DMR) > 0 && nrow(hp2_MAGEL2_TSS_DMR) > 0) {
magel2_hp <- ggplot() +
geom_smooth(data = hp1_MAGEL2_TSS_DMR, aes(x = start_position, y = methylation_frequency), colour = "red", se = F) +
geom_point(data = hp1_MAGEL2_TSS_DMR, aes(x = start_position, y = methylation_frequency), colour = "red", alpha = 0.3) +
geom_smooth(data = hp2_MAGEL2_TSS_DMR , aes(x = start_position, y = methylation_frequency), colour = "blue", se = F) +
geom_point(data = hp2_MAGEL2_TSS_DMR, aes(x = start_position, y = methylation_frequency), colour = "blue", alpha = 0.3) +
ylab("Methylation frequency (%)") +
xlab("Chr15 position") +
ggtitle ("Phased: MAGEL2:TSS-DMR")+
coord_cartesian(xlim= c(21381784,21383056), ylim = c(-5,105), expand=F)+
theme_light()+
theme(text = element_text(size = 15))
} else {
# Create the plot without data
magel2_hp <- ggplot() +
ylab("Methylation frequency (%)") +
xlab("Chr15 position") +
ggtitle ("Phased: MAGEL2:TSS-DMR")+
coord_cartesian(xlim= c(21381784,21383056), ylim = c(-5,105), expand=F)+
theme_light()+
theme(text = element_text(size = 15)) +
geom_blank()
}
# Check if any data frames are empty
if(nrow(hp1_SNURF_TSS_DMR) > 0 && nrow(hp2_SNURF_TSS_DMR) > 0) {
snurf_hp <- ggplot() +
geom_smooth(data = hp1_SNURF_TSS_DMR, aes(x = start_position, y = methylation_frequency), colour = "red", se = F) +
geom_point(data = hp1_SNURF_TSS_DMR, aes(x = start_position, y = methylation_frequency), colour = "red", alpha = 0.3) +
geom_smooth(data = hp2_SNURF_TSS_DMR , aes(x = start_position, y = methylation_frequency), colour = "blue", se = F) +
geom_point(data = hp2_SNURF_TSS_DMR, aes(x = start_position, y = methylation_frequency), colour = "blue", alpha = 0.3) +
ylab("Methylation frequency (%)") +
xlab("Chr15 position") +
ggtitle ("Phased: SNURF:TSS-DMR")+
coord_cartesian(xlim= c(22691523,22693493), ylim = c(-5,105), expand=F)+
theme_light()+
theme(text = element_text(size = 15))
} else {
# Create the plot without data
snurf_hp <- ggplot() +
ylab("Methylation frequency (%)") +
xlab("Chr15 position") +
ggtitle ("Phased: SNURF:TSS-DMR")+
coord_cartesian(xlim= c(22691523,22693493), ylim = c(-5,105), expand=F)+
theme_light()+
theme(text = element_text(size = 15)) +
geom_blank()
}
# Check if any data frames are empty
if(nrow(hp1_PEG3_TSS_DMR) > 0 && nrow(hp2_PEG3_TSS_DMR) > 0) {
peg3_hp <- ggplot() +
geom_smooth(data = hp1_PEG3_TSS_DMR, aes(x = start_position, y = methylation_frequency), colour = "red", se = F) +
geom_point(data = hp1_PEG3_TSS_DMR, aes(x = start_position, y = methylation_frequency), colour = "red", alpha = 0.3) +
geom_smooth(data = hp2_PEG3_TSS_DMR , aes(x = start_position, y = methylation_frequency), colour = "blue", se = F) +
geom_point(data = hp2_PEG3_TSS_DMR, aes(x = start_position, y = methylation_frequency), colour = "blue", alpha = 0.3) +
ylab("Methylation frequency (%)") +
xlab("Chr19 position") +
ggtitle ("Phased: PEG3:TSS-DMR")+
coord_cartesian(xlim= c(59932193,59936667), ylim = c(-5,105), expand=F)+
theme_light()+
theme(text = element_text(size = 15))
} else {
# Create the plot without data
peg3_hp <- ggplot() +
ylab("Methylation frequency (%)") +
xlab("Chr19 position") +
ggtitle ("Phased: PEG3:TSS-DMR")+
coord_cartesian(xlim= c(59932193,59936667), ylim = c(-5,105), expand=F)+
theme_light()+
theme(text = element_text(size = 15)) +
geom_blank()
}
# Check if any data frames are empty
if(nrow(hp1_GNAS_NESP_TSS_DMR) > 0 && nrow(hp2_GNAS_NESP_TSS_DMR) > 0) {
gnasnesp_hp <- ggplot() +
geom_smooth(data = hp1_GNAS_NESP_TSS_DMR, aes(x = start_position, y = methylation_frequency), colour = "red", se = F) +
geom_point(data = hp1_GNAS_NESP_TSS_DMR, aes(x = start_position, y = methylation_frequency), colour = "red", alpha = 0.3) +
geom_smooth(data = hp2_GNAS_NESP_TSS_DMR , aes(x = start_position, y = methylation_frequency), colour = "blue", se = F) +
geom_point(data = hp2_GNAS_NESP_TSS_DMR, aes(x = start_position, y = methylation_frequency), colour = "blue", alpha = 0.3) +
ylab("Methylation frequency (%)") +
xlab("Chr20 position") +
ggtitle ("Phased: GNAS-NESP:TSS-DMR")+
coord_cartesian(xlim= c(60622124,60626697), ylim = c(-5,105), expand=F)+
theme_light()+
theme(text = element_text(size = 15))
} else {
# Create the plot without data
gnasnesp_hp <- ggplot() +
ylab("Methylation frequency (%)") +
xlab("Chr20 position") +
ggtitle ("Phased: GNAS-NESP:TSS-DMR")+
coord_cartesian(xlim= c(60622124,60626697), ylim = c(-5,105), expand=F)+
theme_light()+
theme(text = element_text(size = 15)) +
geom_blank()
}
# Check if any data frames are empty
if(nrow(hp1_GNAS_AS1_TSS_DMR ) > 0 && nrow(hp2_GNAS_AS1_TSS_DMR) > 0) {
gnas1_hp <- ggplot() +
geom_smooth(data = hp1_GNAS_AS1_TSS_DMR, aes(x = start_position, y = methylation_frequency), colour = "red", se = F) +
geom_point(data = hp1_GNAS_AS1_TSS_DMR, aes(x = start_position, y = methylation_frequency), colour = "red", alpha = 0.3) +
geom_smooth(data = hp2_GNAS_AS1_TSS_DMR, aes(x = start_position, y = methylation_frequency), colour = "blue", se = F) +
geom_point(data = hp2_GNAS_AS1_TSS_DMR, aes(x = start_position, y = methylation_frequency), colour = "blue", alpha = 0.3) +
ylab("Methylation frequency (%)") +
xlab("Chr20 position") +
ggtitle ("Phased: GNAS-AS1:TSS-DMR")+
coord_cartesian(xlim= c(60633713,60636097), ylim = c(-5,105), expand=F)+
theme_light()+
theme(text = element_text(size = 15))
} else {
# Create the plot without data
gnas1_hp <- ggplot() +
ylab("Methylation frequency (%)") +
xlab("Chr20 position") +
ggtitle ("Phased: GNAS-AS1:TSS-DMR")+
coord_cartesian(xlim= c(60633713,60636097), ylim = c(-5,105), expand=F)+
theme_light()+
theme(text = element_text(size = 15)) +
geom_blank()
}
# Check if any data frames are empty
if(nrow(hp1_GNASXL_Ex1_DMR ) > 0 && nrow(hp2_GNASXL_Ex1_DMR) > 0) {
gnasxl_hp <- ggplot() +
geom_smooth(data = hp1_GNASXL_Ex1_DMR, aes(x = start_position, y = methylation_frequency), colour = "red", se = F) +
geom_point(data = hp1_GNASXL_Ex1_DMR, aes(x = start_position, y = methylation_frequency), colour = "red", alpha = 0.3) +
geom_smooth(data = hp2_GNASXL_Ex1_DMR, aes(x = start_position, y = methylation_frequency), colour = "blue", se = F) +
geom_point(data = hp2_GNASXL_Ex1_DMR, aes(x = start_position, y = methylation_frequency), colour = "blue", alpha = 0.3) +
ylab("Methylation frequency (%)") +
xlab("Chr20 position") +
ggtitle ("Phased: GNASXL:Ex1-DMR")+
coord_cartesian(xlim= c(60637080,60639527), ylim = c(-5,105), expand=F)+
theme_light()+
theme(text = element_text(size = 15))
} else {
# Create the plot without data
gnasxl_hp <- ggplot() +
ylab("Methylation frequency (%)") +
xlab("Chr20 position") +
ggtitle ("Phased: GNASXL:Ex1-DMR")+
coord_cartesian(xlim= c(60637080,60639527), ylim = c(-5,105), expand=F)+
theme_light()+
theme(text = element_text(size = 15)) +
geom_blank()
}
# Check if any data frames are empty
if(nrow(hp1_GNAS_AB_TSS_DMR ) > 0 && nrow(hp2_GNAS_AB_TSS_DMR) > 0) {
gnasab_hp <- ggplot() +
geom_smooth(data = hp1_GNAS_AB_TSS_DMR, aes(x = start_position, y = methylation_frequency), colour = "red", se = F) +
geom_point(data = hp1_GNAS_AB_TSS_DMR, aes(x = start_position, y = methylation_frequency), colour = "red", alpha = 0.3) +
geom_smooth(data = hp2_GNAS_AB_TSS_DMR, aes(x = start_position, y = methylation_frequency), colour = "blue", se = F) +
geom_point(data = hp2_GNAS_AB_TSS_DMR, aes(x = start_position, y = methylation_frequency), colour = "blue", alpha = 0.3) +
ylab("Methylation frequency (%)") +
xlab("Chr20 position") +
ggtitle ("Phased: GNAS A/B:TSS-DMR")+
coord_cartesian(xlim= c(60671509,60673270), ylim = c(-5,105), expand=F)+
theme_light()+
theme(text = element_text(size = 15))
} else {
# Create the plot without data
gnasab_hp <- ggplot() +
ylab("Methylation frequency (%)") +
xlab("Chr20 position") +
ggtitle ("Phased: GNAS A/B:TSS-DMR")+
coord_cartesian(xlim= c(60671509,60673270), ylim = c(-5,105), expand=F)+
theme_light()+
theme(text = element_text(size = 15)) +
geom_blank()
}
```
## Visualization of methylation at imprinted regions
In the left side each imprinted region is shown with methylation frequency (%). Grey shaded regions mark mean $\pm$ 1 SD (darker grey) and $\pm$ 1.5 SD (lighter grey) for control samples. Haplotype phased methylation frequencies for the regions are seen to the right. HP1 is **<span style="color:red">red</span>** and HP2 is **<span style="color:blue">blue</span>**. If plots are empty phasing was not successful.
### TNDM
```{r, fig.show="hold", out.width="50%", echo=FALSE, message=FALSE}
plagl1
plagl1_hp
```
### SRS
```{r, fig.show="hold", out.width="50%", echo=FALSE, message=FALSE}
grb10
grb10_hp
mest
mest_hp
```
### SRS/BWS
```{r, fig.show="hold", out.width="50%", echo=FALSE, message=FALSE}
h19
h19_hp
kcnq1
kcnq1_hp
```
### TS14/KOS14
```{r, fig.show="hold", out.width="50%", echo=FALSE, message=FALSE}
meg3
meg3_hp
meg8
meg8_hp
```
### PWS/AS
```{r, fig.show="hold", out.width="50%", echo=FALSE, message=FALSE}
magel2
magel2_hp
snurf
snurf_hp
```
### MLID
```{r, fig.show="hold", out.width="50%", echo=FALSE, message=FALSE}
peg3
peg3_hp
```
### PHP
```{r, fig.show="hold", out.width="50%", echo=FALSE, message=FALSE}