/
pQTLexampleplot.Rmd
164 lines (93 loc) · 5.63 KB
/
pQTLexampleplot.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
---
title: "pQTL not eQTL example"
author: "Briana Mittleman"
date: "6/27/2019"
output: html_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
```{r}
library(tidyverse)
```
Protien specific qtl example
```{r}
totQTL=read.table("../data/apaQTLs/Total_apaQTLs4pc_5fdr.txt", header = T, stringsAsFactors = F)
nucQTL=read.table("../data/apaQTLs/Nuclear_apaQTLs4pc_5fdr.txt", stringsAsFactors = F, header = T)
```
rs9820529
peak93951
```{r}
genohead=as.data.frame(read.table("../data/ExampleQTLPlots/genotypeHeader.txt", stringsAsFactors = F, header = F)[,10:128] %>% t())
colnames(genohead)=c("header")
genotype=as.data.frame(read.table("../data/ExampleQTLPlots/EIF2A_TotalPeaksGenotype.txt", stringsAsFactors = F, header = F) [,10:128] %>% t())
full_geno=bind_cols(Ind=genohead$header, dose=genotype$V1) %>% mutate(numdose=round(dose), genotype=ifelse(numdose==0, "TT", ifelse(numdose==1, "TA", "AA")))
RNAhead=as.data.frame(read.table("../data/molPhenos/RNAhead.txt", stringsAsFactors = F, header = F)[,5:73] %>% t())
RNApheno=as.data.frame(read.table("../data/molPhenos/RNA_EIF2a.txt", stringsAsFactors = F, header = F) [,5:73] %>% t())
full_pheno=bind_cols(Ind=RNAhead$V1, Expression=RNApheno$V1)
allRNA=full_geno %>% inner_join(full_pheno, by="Ind")
allRNA$genotype=as.factor(allRNA$genotype)
ggplot(allRNA, aes(x=genotype, y=Expression,group=genotype, fill=genotype)) + geom_boxplot() + geom_jitter()+scale_fill_brewer(palette = "Dark2") + labs(title="eQTL: EIF2A - rs9820529") + theme(legend.position = "bottom")
```
```{r}
prothead=as.data.frame(read.table("../data/molPhenos/ProtHead.txt", stringsAsFactors = F, header = F)[,5:66] %>% t())
protpheno=as.data.frame(read.table("../data/molPhenos/prot_EIF2A.txt", stringsAsFactors = F, header = F) [,5:66] %>% t())
full_phenoprot=bind_cols(Ind=prothead$V1, Expression=protpheno$V1)
allprot=full_geno %>% inner_join(full_phenoprot, by="Ind")
allprot$genotype=as.factor(allprot$genotype)
ggplot(allprot, aes(x=genotype, y=Expression,group=genotype, fill=genotype)) + geom_boxplot() + geom_jitter()+scale_fill_brewer(palette = "Dark2") + labs(title="pQTL: EIF2A - rs9820529", y="Protein Level")+ theme(legend.position = "bottom")
```
Ribo plot:
#ENSG00000144895
```{r}
ribohead=as.data.frame(read.table("../data/molPhenos/RiboHead.txt", stringsAsFactors = F, header = F)[,5:74] %>% t())
ribopheno=as.data.frame(read.table("../data/molPhenos/ribo_EIF2A.txt", stringsAsFactors = F, header = F) [,5:74] %>% t())
full_phenoribo=bind_cols(Ind=ribohead$V1, Expression=ribopheno$V1)
allribo=full_geno %>% inner_join(full_phenoribo, by="Ind")
allribo$genotype=as.factor(allribo$genotype)
ggplot(allribo, aes(x=genotype, y=Expression,group=genotype, fill=genotype)) + geom_boxplot() + geom_jitter()+scale_fill_brewer(palette = "Dark2") + labs(title="riboQTL: EIF2A - rs9820529", y="Ribo Level")+ theme(legend.position = "bottom")
```
Make Locus zoom files:
```{r}
prot_LZ=read.table("../data/locusZoom/Prot.EIF2A.nom.txt", stringsAsFactors = F, col.names = c("PeakID", "SNP", "Dist", "P","slope")) %>% select( SNP, P)
write.table(prot_LZ,"../data/locusZoom/ProtEIF2ALZ.txt", col.names = T, row.names = F, quote = F)
ribo_LZ=read.table("../data/locusZoom/Ribo.EIF2A.nom.txt", stringsAsFactors = F, col.names = c("PeakID", "SNP", "Dist", "P","slope")) %>% select( SNP, P)
write.table(ribo_LZ,"../data/locusZoom/RiboEIF2ALZ.txt", col.names = T, row.names = F, quote = F)
ribo_LZ=read.table("../data/locusZoom/RNA.EIF2A.nom.txt", stringsAsFactors = F, col.names = c("PeakID", "SNP", "Dist", "P","slope")) %>% select( SNP, P)
write.table(ribo_LZ,"../data/locusZoom/RNAEIF2ALZ.txt", col.names = T, row.names = F, quote = F)
```
Broader: Ask how many examples:
Ask for apaQTLs sig in P not in E
```{bash,eval=F}
mkdir ../data/pQTLoverlap
python apaInPandE.py
```
```{r}
apaQTL=read.table("../data/apaQTLs/Nuclear_apaQTLs4pc_5fdr.txt", stringsAsFactors = F, header = T)
apainE=read.table("../data/pQTLoverlap/NucAPAinExpression.txt", stringsAsFactors = F, col.names = c("Gene", 'sid','dist', 'Exppval', 'Eslope')) %>% select(Gene, sid, Exppval,Eslope)
apainP=read.table("../data/pQTLoverlap/NucAPAinProt.txt", stringsAsFactors = F, col.names = c("Gene", 'sid','dist', 'Protppval', 'Pslope')) %>% select(Gene, sid, Protppval ,Pslope)
#combine
allQTL=apaQTL %>% inner_join(apainE,by=c("Gene", "sid")) %>% inner_join(apainP, by=c("Gene","sid"))
#select sig in p not e
pnote=allQTL %>% filter(Exppval>.05) %>% filter(Protppval<.05) %>% select(Gene, sid) %>% unique()
```
add Ribo data.
```{bash,eval=F}
python apainRibo.py
```
```{r}
apainRibo=read.table("../data/pQTLoverlap/NucAPAinRibo.txt", stringsAsFactors = F, col.names = c("Gene", 'sid','dist', 'Riboppval', 'Riboslope')) %>% select(Gene, sid, Riboppval,Riboslope)
#combine
allQTL_withribo=apaQTL %>% inner_join(apainE,by=c("Gene", "sid")) %>% inner_join(apainP, by=c("Gene","sid")) %>% inner_join(apainRibo, by=c("Gene","sid"))
#select sig in p not e
pnoteorr=allQTL_withribo %>% filter(Exppval>.05) %>% filter(Protppval<.05) %>% filter(Riboppval<.05) %>% select(Gene, sid) %>% unique()
nrow(pnoteorr)
```
Make supplementary table:
```{r}
pnote_withR=allQTL_withribo %>% filter(Exppval>.05) %>% filter(Protppval<.05) %>% select(Gene, Loc, Peak, sid,bpval, slope, Exppval,Eslope, Protppval, Pslope, Riboppval, Riboslope)
colnames(pnote_withR)=c("Gene", "PAS_Loc", "PAS_ID", "SNP", "apa_pvalue","apa_EffectSize", "expression_pvalue","expresion_EffectSize", "protein_pvalue", "protein_EffectSize", "ribo_pvalue", "ribo_EffectSize")
```
```{r}
write.table(pnote_withR, file="../data/ExpressionIndependentapaQTLs.txt", col.names = T, row.names =F, quote = F)
```