-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathFine_Mapping.Functional.Rmd
329 lines (277 loc) · 12.9 KB
/
Fine_Mapping.Functional.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
---
title: "<center>Functional Fine-mapping</h1></center>"
author:
"<div class='container'>
<h3>Brian M. Schilder, Bioinformatician II<br>
Raj Lab<br>
Department of Neuroscience<br>
Icahn School of Medicine at Mount Sinai<br>
NYC, New York<br>
</h3>
<a href='https://github.com/RajLabMSSM/Fine_Mapping' target='_blank'><img src='./echolocatoR/images/echo_logo_sm.png'></a>
<a href='https://github.com/RajLabMSSM' target='_blank'><img src='./web/images/github.png'></a>
<a class='item' href='https://rajlabmssm.github.io/RajLab_website/' target='_blank'>
<img src='./web/images/brain-icon.png'>
<span class='caption'>RAJ LAB</span>
<a href='https://icahn.mssm.edu/' target='_blank'><img src='./web/images/sinai.png'></a>
</div>"
date: "<br>Most Recent Update:<br> `r Sys.Date()`"
output:
html_document:
theme: cerulean
highlight: zenburn
code_folding: show
toc: true
toc_float: true
smooth_scroll: true
number_sections: false
self_contained: true
css: ./web/css/style.css
editor_options:
chunk_output_type: inline
---
```{r setup, message=F, warning=F, dpi = 600, class.output = "pre"}
source("echolocatoR/R/MAIN.R")
```
# PAINTOR
## GWAS only
```{r PAINTOR - GWAS}
PAINTOR_results <- PAINTOR(GWAS_dataset_name="Nalls23andMe_2019",
eQTL_dataset_name=NA,
gene="LRRK2",
n_causal=5,
XGR_dataset=NA,
ROADMAP_search=c("monocyte","brain"),
chromatin_state="TssA",
no_annotations=T) #******
createDT(PAINTOR_results)
```
## GWAS + Epigenetic Annotations
```{r PAINTOR - GWAS + Epigenetic Annotations}
PAINTOR_results.roadmap <- PAINTOR(GWAS_dataset_name="Nalls23andMe_2019",
eQTL_dataset_name=NA,
gene="LRRK2",
n_causal=5,
XGR_dataset=NA,
ROADMAP_search=c("monocyte","brain"),
chromatin_state="TssA",
no_annotations=F)
createDT(PAINTOR_results.roadmap)
```
## GWAS + Fairfax eQTLs + Epigenetic Annotations
```{r PAINTOR - GWAS + Fairfax eQTLs + Epigenetic Annotations}
PAINTOR_results.FF <- PAINTOR(GWAS_dataset_name="Nalls23andMe_2019",
eQTL_dataset_name="Fairfax_2014",
gene="LRRK2",
n_causal=5,
XGR_dataset=NA,
ROADMAP_search =c("monocyte","brain"),
chromatin_state="TssA",
no_annotations=F)
createDT(PAINTOR_results.FF)
```
# QTL Boxplots
## Fairfax eQTL
- Below we take several SNPs of interest within the LRRK2 PD-associated locus:
+ The 2 lead GWAS SNPs identified in Nalls et al. (2019).
+ The Consensus SNP identified through the statistical fine-mapping pipeline.
- We then identify whether any of them have eQTLs in the [Fairfax et al. (2014)](https://science.sciencemag.org/content/343/6175/1246949) summary statistics.
+ *Fairfax, Benjamin P., Peter Humburg, Seiko Makino, Vivek Naranbhai, Daniel Wong, Evelyn Lau, Luke Jostins, et al. “Innate Immune Activity Conditions the Effect of Regulatory Variants upon Monocyte Gene Expression.” Science 343, no. 6175 (2014). https://doi.org/10.1126/science.1246949.*
```{r eQTL Boxplots - Fairfax}
# snp_list <- subset(merged_results, Gene=="LRRK2")$SNP %>% unique()
snp_list <- c("rs7294519", "rs11175620", "rs76904798")
merged_eQTL_data <- eQTL_boxplots(snp_list,
eQTL_SS_paths = file.path("Data/eQTL/Fairfax_2014",
c("CD14/LRRK2/LRRK2_Fairfax_CD14.txt",
"IFN/LRRK2/LRRK2_Fairfax_IFN.txt",
"LPS2/LRRK2/LRRK2_Fairfax_LPS2.txt",
"LPS24/LRRK2/LRRK2_Fairfax_LPS24.txt")),
expression_paths = file.path("Data/eQTL/Fairfax_2014",
c("CD14/CD14.47231.414.b.txt",
"IFN/IFN.47231.367.b.txt",
"LPS2/LPS2.47231.261.b.txt",
"LPS24/LPS24.47231.322.b.txt")),
genotype_path = "Data/eQTL/Fairfax_2014/geno.subset.txt",
probe_path = "Data/eQTL/Fairfax_2014/gene.ILMN.map",
.fam_path = "Data/eQTL/Fairfax_2014/volunteers_421.fam",
gene = "LRRK2",
show_plot = T,
SS_annotations = F,
interact = F)
```
# Colocalization
## Colocalization: MESA {.tabset .tabset-fade .tabset-pills}
```{r Colocalization - Nalls23andMe_2019 + MESA, results = 'asis', fig.height=7, fig.width=10, eval=F, include=F}
subpops <- c("CAU","AFA","HIS")
dataset2_pathList <- paste0("./Data/eQTL/MESA_",subpops,"/LRRK2_",subpops,"_MESA.txt")
colocalize_geneList(gene_list = c("LRRK2"),
dataset1_path = "./Data/GWAS/Nalls23andMe_2019/LRRK2/Multi-finemap/Multi-finemap_results.txt",
dataset2_pathList = dataset2_pathList,
dataset1_type = "cc",
dataset2_type = "quant",
shared_MAF = 1,
PP_threshold = .8,
save_results = T,
show_plot = T)
colocalize_geneList <- function(gene_list,
dataset1_path,
dataset2_pathList,
dataset1_type="cc",
dataset2_type = "quant",
shared_MAF=1,
PP_threshold=0.8,
save_results=T,
show_plot=T,
chrom_col = "chr",
position_col = "pos_snps",
snp_col="snps",
pval_col="pvalue",
effect_col="beta",
gene_col="gene_name",
stderr_col = "calculate",
tstat_col = "statistic"){
for(g in gene_list){
cat('\n')
cat("###", g, "\n")
for(d2 in dataset2_pathList){
comparison_name <- paste0(basename(dataset1_path),".vs.",basename(d2))
subset_DT <- extract_SNP_subset(gene = gene,
top_SNPs = top_SNPs,
fullSS_path = fullSS_path,
subset_path = subset_path,
force_new_subset = force_new_subset,
chrom_col = chrom_col,
position_col = position_col,
snp_col = snp_col,
pval_col = pval_col,
effect_col = effect_col,
stderr_col = stderr_col,
gene_col = gene_col,
tstat_col = tstat_col,
MAF_col = MAF_col,
freq_col = freq_col,
A1_col = A1_col,
A2_col = A2_col,
bp_distance = bp_distance,
superpopulation = superpopulation,
min_POS = min_POS,
max_POS = max_POS,
file_sep = file_sep,
query_by = query_by,
probe_path = probe_path
)
coloc_DT <- COLOC(
gene = g,
dataset1_path = dataset1_path,
dataset2_path = d2,
dataset1_type = dataset1_type,
dataset2_type = dataset2_type,
shared_MAF = shared_MAF,
PP_threshold = PP_threshold,
save_results = save_results,
show_plot = show_plot,
)
coloc_DT <- cbind(Comparison = comparison_name)
coloc_results[[dataset_name]]
}
cat("\n")
}
return(coloc_results %>% data.table::rbindlist())
}
```
## Colocalization: Fairfax {.tabset .tabset-fade .tabset-pills}
### Summarize
```{r Colocalization - Nalls23andMe_2019 + Fairfax, eval=F, include=F}
gather_ff_data <- function(gene_snp_df){
gene_list <- unique(gene_snp_df$Gene)
# Loop through genes
ff_summary <- lapply(gene_list, function(gene, gene_snp_df.=gene_snp_df){
printer("+ Gathering Fairfax eQTLS for LRRK2")
bp <- subset(gene_snp_df., Gene==gene)$POS[1]
# Loop through eQTL conditions
dat <- lapply(c("CD14","IFN","LPS2","LPS24"), function(condition, bp.=bp, gene.=gene){
printer("+",condition)
ff <- data.table::fread(file.path("./Data/eQTL/Fairfax_2014",condition,gene.,
paste0(gene.,"_Fairfax_",condition,".txt")), sep="\t") %>%
subset(POS==bp.) %>%
data.table::as.data.table() %>%
tibble::add_column(Condition=condition, .before =1) %>%
dplyr::rename(PROBE_ID=gene)
return(ff)
}) %>% data.table::rbindlist()
return(dat %>% tibble::add_column(Gene=gene, .before =1))
}) %>% data.table::rbindlist()
return(ff_summary)
}
gene_snp_df <- subset(merged_results, Gene=="LRRK2" & Support==2,
select = c("Gene","SNP","CHR","POS")) %>% unique()
createDT(gather_ff_data(gene_snp_df))
```
# Fine-mapping eQTLs
- AFR = AFA = African
- AMR = Ad Mixed American
- EAS = East Asian
- EUR = CAU = European
- SAS = South Asian
- HIS = Hispanic
## MESA {.tabset .tabset-fade .tabset-pills}
```{r eQTL - MESA (AFA), results = 'asis', fig.height=8, fig.width=7, eval=F, include=F}
gene_list <- c("LRRK2")
subpops <- c("CAU","AFA","HIS")
for(g in gene_list){
for(s in subpops){
dataset_name <- paste0("MESA_",s)
finemap_results[[dataset_name]] <- finemap_gene_list(
top_SNPs = Nalls_top_SNPs,
gene_list=c("LRRK2"),
superpopulation = s,
dataset_name = dataset_name,
finemap_method = c("SUSIE"),#c("SUSIE","ABF","FINEMAP"),
force_new_LD = T,
force_new_finemap = T,
force_new_subset = T,
dataset_type = "eQTL",
query_by = "fullSS",
file_sep = "\t",
# fullSS_path = Directory_info(dataset_name, "fullSumStats"),
fullSS_path = paste0("./Data/eQTL/MESA_",s,"/",g,"_MESA_",s,".txt"),
subset_path = "auto",
chrom_col = "chr", position_col = "pos_snps", snp_col="snps",
pval_col="pvalue", effect_col="beta", gene_col="gene_name",
stderr_col = "calculate", tstat_col = "statistic",
n_causal = 5,
download_reference = T,
remove_tmps = F)
}
}
```
## Fairfax (2014) {.tabset .tabset-fade .tabset-pills}
+ Use the Nalls et al. (2019) LRRK2 locus to query for SNPs in the eQTL data.
+ SS Files are SPACE-delimited (not tab-delimited)
```{r Fairfax, results = 'asis', fig.height=8, fig.width=7, eval=F, include=F}
FF_finemapping <- list()
# +++++++++++++++ CD14 Stimulation +++++++++++++++ #
dataset_name <- "Fairfax_2014_CD14"
FF_finemapping[[dataset_name]] <- finemap_gene_list(gene_list=c("LRRK2"),
superpopulation = "CAU",
dataset_name = dataset_name,
dataset_type = "eQTL",
top_SNPs = Nalls_top_SNPs,
query_by = "probes",
probe_path = "./Data/eQTL/Fairfax_2014/gene.ILMN.map",
file_sep = " ",
# fullSS_path = Directory_info(Data_dirs, dataset_name, "fullSumStats"),
fullSS_path = "./Data/eQTL/Fairfax_2014/CD14/LRRK2/LRRK2_Fairfax_CD14.txt",
subset_path = "auto",
chrom_col = "CHR", position_col = "POS", snp_col="SNP",
pval_col="p-value", effect_col="beta", gene_col="gene",
stderr_col = "calculate", tstat_col = "t-stat",
n_causal = 1,
force_new_subset = F,
LD_block = T)
```
# Session Information
```{r Session Information}
sessionInfo()
print(paste("susieR ", packageVersion("susieR")))
```