[53575d]: / README.org

Download this file

69 lines (47 with data), 1.5 kB

 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
#+TITLE: TreeWAS - Genetic risk profiles
#+AUTHOR: Adrian Cortes
#+email: adrcort@gmail.com

#+INFOJS_OPT: 

#+BABEL: :session *R* :cache yes :results output graphics :exports both :tangle yes 

#+EXPORT_SELECT_TAGS: export
#+EXPORT_EXCLUDE_TAGS: noexport
-----

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]].

* Demo

#+NAME: demo
#+BEGIN_SRC R

  library(TreeWASDir)

  HES.data <- load.HES.lk.data()
  pars <- load.pars()

  data <- HES.data$d
  res <- HES.data$res

  snp <- "rs4420638"
  SNP.IDX <- which(res$SNP %in% snp)

  ## Calculate the evidence that the SNP is
  ## associated with at least one term in the
  ## ontology
  lBF <- calc.lBF(
      pars       = pars,
      data.sub   = data[SNP.IDX,,]
  )
  cat("The Tree BF is ",round(lBF,2), "\n")

  ## Calculate the risk profile across the
  ## ontology
  pp <- marginal.posterior.profile(
      pars       = pars,
      data.sub   = data[SNP.IDX,,]
  )

  ## visualise the results. Return a plotly
  treePlot <- drawTree(
      tree           = pars$tree,
      pp             = pp,
      tree_title     = res[SNP.IDX,"SNP"],
      trim_tree_pp   = 0.25
  )

#+END_SRC


* Install

#+NAME: install repository
#+BEGIN_SRC R

  library(devtools)

  install_github("mcveanlab/TreeWASDir")

#+END_SRC