-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex_Thomas.Rmd
199 lines (140 loc) · 5.71 KB
/
index_Thomas.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
---
title: "eQTL Website"
---
New example!!!!
```{r init, include=FALSE}
library(tidyverse)
# import package to allow R data objects to be displayed as tables on HTML pages
library(DT)
```
## Regular Gene-SNP table
```{r include=FALSE}
# init. filepath
path_to_genes <- "website/data/plots/"
# init. genes names to store in DF
genes <- list.files(path_to_genes)
# init. DF with gene and SNP combos
df <- tibble(
gene = NA,
snp = NA
)
for (gene in genes) {
# init. vector of SNPs for each gene
snps <- list.files(str_c(path_to_genes, gene))
# init. temporary DF to store each gene-SNP combination
temp_df <- tibble(gene = gene, snp = snps)
# bind DF with temporary DF
df <- bind_rows(df, temp_df)
}
df <- df %>% filter(!is.na(gene))
# df <- df %>%
# filter(!is.na(gene)) %>%
# datatable(escape = F, style = "auto")
```
```{r display table, echo=FALSE, include=FALSE}
df_html <- df %>%
datatable(escape = F, style = "auto")
df_html
```
---
## LD Trait Association
TODO:
* load this table in a separate tab
* make a dropdown menu for `GWAS_Trait`
* select specific SNPs to view (from `Query`) -- optional for now
* make `R2` filterable (e.g., view everything between x and y)
* make hyperlink from the Feature-Selected table that shows the LDTrait records for the specific SNP (`Query`)
- filter for the SNP
```{r}
ld_trait_assoc <- read_tsv("./website/data/modeling_results/QTLs_LDtrait_association_ALLpopulation_r20.1.txt")
```
---
## Feature-Selected Model: Phenotype Rank-Normalized CPM
To-Do:
* convert numeric cols to scientific notation
* link the GTEx IGV browser to the table ("location=....")
```{r include=FALSE}
# read in feature selected rank-normalized CPM model
fs_rank_norm_cpm <- read_tsv("website/data/modeling_results/modeling_results_featureSelectedModel_phenotypeRankNormCPM.txt")
fs_rank_norm_cpm <- fs_rank_norm_cpm %>%
left_join(
df,
by = c("GENE" = "gene", "SNP" = "snp")
)
```
```{r echo=FALSE, warning=FALSE, message=FALSE}
# init. URL base
url_gene_base <- "https://www.genecards.org/cgi-bin/carddisp.pl?gene="
url_snp_base <- "https://www.ncbi.nlm.nih.gov/snp/"
# embed hyperlinks for each SNP and gene
mod_1 <- fs_rank_norm_cpm %>%
mutate(
gene = str_c("<a href=", url_gene_base, GENE, " target=_blank", ">", GENE, "</a>"),
snp = str_c("<a href=", url_snp_base, SNP, " target=_blank", ">", SNP, "</a>")
)
# create a `plots` column to store the plots
# mod_1 %>%
# knitr::kable(col.names = colnames(mod_1)) %>%
# mutate(plots = str_c("![Paired Plot CPM]('website/data/plots/", GENE, SNP, "pairedPlot_3donorColored_CPM.png')", sep = "/"))
fs_rank_norm_cpm %>%
mutate(
gene = str_c("<a href=", url_gene_base, GENE, " target=_blank", ">", GENE, "</a>"),
snp = str_c("<a href=", url_snp_base, SNP, " target=_blank", ">", SNP, "</a>"),
# plots = str_c("![Paired Plot CPM](website/data/plots", GENE, SNP, "pairedPlot_3donorColored_CPM.png)", sep = "/"),
# plots = str_c("<img src=website/data/plots/", GENE, SNP, "pairedPlot_3donorColored_CPM.png target=_blank>Paired Plot CPM</img>", sep = "/"),
plots = str_c("<a href=website/data/plots/", GENE, "/", SNP, "/", "pairedPlot_3donorColored_CPM.png target=_blank>Paired Plot CPM</a>"),
Actions = str_c("LDlink", "IGV Browser", sep = ", "),
# convert specific cols to sci notation
across(.cols = str_subset(colnames(.), "(pval|pperm|beta|_se)"),
.fns = ~ format(as.numeric(.x), scientific = TRUE, digits = 3))
) %>%
select(pair, snp, gene, plots, Actions, everything(), -c(GENE, SNP)) %>%
datatable(escape = F, style = "auto")
# options(scipen = 3)
```
![Paired Plot CPM](./website/data/plots/THUMPD2/rs6759076/pairedPlot_3donorColored_CPM.png)
reate mode 100644 website/example/ERAP2/rs10038651/ERAP2_rs10038651.html
create mode 100644 website/example/ERAP2/rs10038651/FRB_plot.pdf
create mode 100644 website/example/ERAP2/rs10038651/KRT_plot.pdf
create mode 100644 website/example/ERAP2/rs10038651/MEL_plot.pdf
create mode 100644 website/example/ERAP2/rs10038651/modeling_result_FRB.txt
create mode 100644 website/example/ERAP2/rs10038651/modeling_result_KRT.txt
create mode 100644 website/example/ERAP2/rs10038651/modeling_result_MEL.txt
create mode 100644 website/example/ERAP2/snps.txt
UMMSMAC-G7JPHWFY6Y:eQTL_website.github.io tjacob$
UMMSMAC-G7JPHWFY6Y:eQTL_website.github.io tjacob$ git push -u origin HEAD:main
Enter passphrase for key '/Users/tjacob/.ssh/id_ecdsa':
Enumerating objects: 79850, done.
Counting objects: 100% (79850/79850), done.
Delta compression using up to 12 threads
Compressing objects: 100% (67563/67563), done.
remote: fatal: pack exceeds maximum allowed size (2.00 GiB)
error: remote unpack failed: index-pack failed| 8.91 MiB/s
To github.com:garber-lab/eQTL_website.github.io.git
! [remote rejected] HEAD -> main (failed)
error: failed to push some refs to 'github.com:garber-lab/eQTL_website.github.io.git'
```{r}
list.files("website/data/plots/") %>% str_subset("^I")
```
---
## Feature-Selected Model: Phenotype CPM
```{r feature_selected_models, include=FALSE, eval=FALSE}
# read in different modeling results as tables
feat_select_CPM <- read_tsv("website/data/modeling_results/modeling_results_featureSelectedModel_phenotypeCPM.txt")
feat_select_CPM <- feat_select_CPM %>%
left_join(
df,
by = c("GENE" = "gene", "SNP" = "snp")
)
```
```{r include=FALSE, eval=FALSE}
# init. URL base
url_gene_base <- "https://www.ncbi.nlm.nih.gov/gene/?term="
url_snp_base <- "https://www.ncbi.nlm.nih.gov/snp/"
feat_select_CPM %>%
mutate(
GENE = str_c("<a href=", url_gene_base, GENE, " target=_blank", ">", GENE, "</a>"),
SNP = str_c("<a href=", url_snp_base, SNP, " target=_blank", ">", SNP, "</a>")
) %>%
datatable(escape = F, style = "auto")
```