-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsQTLs.Rmd
110 lines (66 loc) · 2.05 KB
/
sQTLs.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
---
title: "R Notebook"
output: html_notebook
---
```{r}
library(data.table)
library(ggplot2)
library(cowplot)
library(Hmisc)
```
```{r}
sQTLs_upstream <- fread("./sQTL/upstream_eqtl_results.txt")
sQTLs_downstream <- fread("./sQTL/downstream_eqtl_results.txt")
```
#####
```{r}
sQTL_up <- sQTLs_upstream[source=="All_sqtls.bed.hg19" , ]
sQTL_down <- sQTLs_downstream[source=="All_sqtls.bed.hg19" , ]
SNP_up <- sQTLs_upstream[source=="All_SNPs.bed.hg19" , ]
SNP_down <- sQTLs_downstream[source=="All_SNPs.bed.hg19", ]
sQTL_up[, pos:="upstream"]
sQTL_down[, pos:="downstream"]
SNP_up[, pos:="upstream"]
SNP_down[, pos:="downstream"]
sQTL_SNP_up <- merge(sQTL_up, SNP_up, by="bin")
sQTL_SNP_down <- merge(sQTL_down, SNP_down, by="bin")
sQTL_SNP_up[, adj_enchiment:=(enrichment.x/enrichment.y)]
sQTL_SNP_down[, adj_enchiment:=(enrichment.x/enrichment.y)]
```
```{r}
sQTL_SNP_down[, `eQTLs in bin overlapping G4s.x`/`eQTLs in bin.x`]
```
```{r}
#sQTL_SNP_up_bin <- sQTL_SNP_up[, binconf(`enrichment.x`, `enrichment.y`)]
#sQTL_SNP_down_bin <- sQTL_SNP_down[, binconf(`eQTLs in bin overlapping G4s.x`/`eQTLs in bin.x`, `G4 bps in window.x`/`bps in bin.x`)]
#sQTL_SNP_up <- cbind(sQTL_SNP_up, sQTL_SNP_up_bin)
#sQTL_SNP_down <- cbind(sQTL_SNP_down, sQTL_SNP_down_bin)
```
```{r}
head(sQTLs_upstream[source=="All_sqtls.bed.hg19", ])
```
```{r}
```
```{r}
norm_sQTL_up <- ggplot(sQTL_SNP_up, aes(bin, adj_enchiment)) +
geom_point( ) +
geom_smooth(method="loess") +
xlim(c(-500,50)) +
ylim(c(0.75,2)) +
xlab("Window position (25-nt)") +
ylab("Adjusted sQTL enrichment over G4s")+
geom_hline(yintercept=1, linetype="dashed", color = "red") +
theme_bw()
norm_sQTL_down <- ggplot(sQTL_SNP_down, aes(bin, adj_enchiment) ) +
geom_point( ) +
geom_smooth() +
xlim(c(-50,500)) +
ylim(c(0.75,2)) +
xlab("Window position (25-nt)") +
ylab("Adjusted sQTL enrichment over G4s")+
geom_hline(yintercept=1, linetype="dashed", color = "red") +
theme_bw()
```
```{r, fig.height=4, fig.width=7}
plot_grid(norm_sQTL_up, norm_sQTL_down, nrow=1)
```