|
a |
|
b/README.org |
|
|
1 |
#+TITLE: TreeWAS - Genetic risk profiles |
|
|
2 |
#+AUTHOR: Adrian Cortes |
|
|
3 |
#+email: adrcort@gmail.com |
|
|
4 |
|
|
|
5 |
#+INFOJS_OPT: |
|
|
6 |
|
|
|
7 |
#+BABEL: :session *R* :cache yes :results output graphics :exports both :tangle yes |
|
|
8 |
|
|
|
9 |
#+EXPORT_SELECT_TAGS: export |
|
|
10 |
#+EXPORT_EXCLUDE_TAGS: noexport |
|
|
11 |
----- |
|
|
12 |
|
|
|
13 |
This repository contains R code to perform TreeWAS analysis and infer genetic risk profiles across UK Biobank phenotype data sets. For a description of the method see preprint [[https://www.biorxiv.org/content/early/2018/07/23/374207][here]]. |
|
|
14 |
|
|
|
15 |
* Demo |
|
|
16 |
|
|
|
17 |
#+NAME: demo |
|
|
18 |
#+BEGIN_SRC R |
|
|
19 |
|
|
|
20 |
library(TreeWASDir) |
|
|
21 |
|
|
|
22 |
HES.data <- load.HES.lk.data() |
|
|
23 |
pars <- load.pars() |
|
|
24 |
|
|
|
25 |
data <- HES.data$d |
|
|
26 |
res <- HES.data$res |
|
|
27 |
|
|
|
28 |
snp <- "rs4420638" |
|
|
29 |
SNP.IDX <- which(res$SNP %in% snp) |
|
|
30 |
|
|
|
31 |
## Calculate the evidence that the SNP is |
|
|
32 |
## associated with at least one term in the |
|
|
33 |
## ontology |
|
|
34 |
lBF <- calc.lBF( |
|
|
35 |
pars = pars, |
|
|
36 |
data.sub = data[SNP.IDX,,] |
|
|
37 |
) |
|
|
38 |
cat("The Tree BF is ",round(lBF,2), "\n") |
|
|
39 |
|
|
|
40 |
## Calculate the risk profile across the |
|
|
41 |
## ontology |
|
|
42 |
pp <- marginal.posterior.profile( |
|
|
43 |
pars = pars, |
|
|
44 |
data.sub = data[SNP.IDX,,] |
|
|
45 |
) |
|
|
46 |
|
|
|
47 |
## visualise the results. Return a plotly |
|
|
48 |
treePlot <- drawTree( |
|
|
49 |
tree = pars$tree, |
|
|
50 |
pp = pp, |
|
|
51 |
tree_title = res[SNP.IDX,"SNP"], |
|
|
52 |
trim_tree_pp = 0.25 |
|
|
53 |
) |
|
|
54 |
|
|
|
55 |
#+END_SRC |
|
|
56 |
|
|
|
57 |
|
|
|
58 |
* Install |
|
|
59 |
|
|
|
60 |
#+NAME: install repository |
|
|
61 |
#+BEGIN_SRC R |
|
|
62 |
|
|
|
63 |
library(devtools) |
|
|
64 |
|
|
|
65 |
install_github("mcveanlab/TreeWASDir") |
|
|
66 |
|
|
|
67 |
#+END_SRC |
|
|
68 |
|