Last updated: 2019-05-30
Checks: 6 0
Knit directory: gtex-gwas-hki/
This reproducible R Markdown analysis was created with workflowr (version 1.3.0). The Checks tab describes the reproducibility checks that were applied when the results were created. The Past versions tab lists the development history.
Great! Since the R Markdown file has been committed to the Git repository, you know the exact version of the code that produced these results.
Great job! The global environment was empty. Objects defined in the global environment can affect the analysis in your R Markdown file in unknown ways. For reproduciblity it’s best to always run the code in an empty environment.
The command set.seed(20190328)
was run prior to running the code in the R Markdown file. Setting a seed ensures that any results that rely on randomness, e.g. subsampling or permutations, are reproducible.
Great job! Recording the operating system, R version, and package versions is critical for reproducibility.
Nice! There were no cached chunks for this analysis, so you can be confident that you successfully produced the results during this run.
Great! You are using Git for version control. Tracking code development and connecting the code version to the results is critical for reproducibility. The version displayed above was the version of the Git repository at the time these results were generated.
Note that you need to be careful to ensure that all relevant files for the analysis have been committed to Git prior to generating the results (you can use wflow_publish
or wflow_git_commit
). workflowr only checks the R Markdown file, but you know if there are other scripts or data files that it depends on. Below is the status of the Git repository when the results were generated:
Ignored files:
Ignored: .DS_Store
Ignored: .Rhistory
Ignored: .Rproj.user/
Ignored: .httr-oauth
Ignored: analysis/.DS_Store
Ignored: analysis/.Rhistory
Ignored: analysis/logs/log4j.spark.log
Ignored: derby.log
Ignored: docs/.DS_Store
Ignored: docs/figure/.DS_Store
Ignored: docs/figure/FTO-BMI-region.Rmd/.DS_Store
Ignored: docs/figure/height-UKB-vs-GIANT-finemapping.Rmd/.DS_Store
Ignored: figures/.DS_Store
Ignored: logs/log4j.spark.log
Ignored: logs/log4j.spark.log.2019-05-10
Ignored: logs/log4j.spark.log.2019-05-13
Ignored: logs/log4j.spark.log.2019-05-14
Ignored: logs/log4j.spark.log.2019-05-15
Ignored: logs/log4j.spark.log.2019-05-17
Ignored: logs/log4j.spark.log.2019-05-22
Ignored: logs/log4j.spark.log.2019-05-23
Ignored: logs/log4j.spark.log.2019-05-24
Note that any generated files, e.g. HTML, png, CSS, etc., are not included in this status report because it is ok for generated content to have uncommitted changes.
These are the previous versions of the R Markdown and HTML files. If you’ve configured a remote Git repository (see ?wflow_git_remote
), click on the hyperlinks in the table below to view them.
File | Version | Author | Date | Message |
---|---|---|---|---|
Rmd | ddcbbb2 | HKI imac 012 | 2019-05-28 | enloc vs coloc |
html | ddcbbb2 | HKI imac 012 | 2019-05-28 | enloc vs coloc |
Rmd | d962ff4 | HKI imac 012 | 2019-05-24 | enloc vs coloc |
html | 2452565 | HKI imac 012 | 2019-05-24 | enloc vs coloc |
Rmd | 9fba350 | HKI imac 012 | 2019-05-24 | enloc vs coloc |
print(getwd())
[1] "/Users/haky/Github/gtex-gwas-hki"
# install.packages("bigrquery")
suppressPackageStartupMessages(library(bigrquery))
Warning: package 'bigrquery' was built under R version 3.5.2
# Script with ancillary functions to perform queries to BigQuery
suppressPackageStartupMessages(source("code/BigQuery.R", chdir = TRUE))
Warning: package 'ggplot2' was built under R version 3.5.2
Warning: package 'tibble' was built under R version 3.5.2
Warning: package 'tidyr' was built under R version 3.5.2
Warning: package 'purrr' was built under R version 3.5.2
Warning: package 'stringr' was built under R version 3.5.2
Warning: package 'forcats' was built under R version 3.5.2
##library(tidyverse)
library(readxl)
Warning: package 'readxl' was built under R version 3.5.2
extdata.dir = "~/Desktop/local-analysis/gtex-gwas/data/"
library(sparklyr)
Warning: package 'sparklyr' was built under R version 3.5.2
Attaching package: 'sparklyr'
The following object is masked from 'package:purrr':
invoke
sc <- spark_connect(master = "local")
theme_set(theme_bw(base_size=15))
phenoname = 'UKB_50_Standing_height'
## query enloc/coloc prob
# query <- 'SELECT tissue, phenotype, gene_id, max(rcp) as maxrcp FROM {enloc_tbl$dataset_name}.{enloc_tbl$table_name} where phenotype="{phenoname}" group by tissue, phenotype, gene_id limit 10' %>% glue::glue()
query <- 'SELECT coloc.PP_H4_abf,coloc.tissue, coloc.phenotype, coloc.gene_id,enloc.max_rcp,enloc.nindep FROM `gtex-awg-im.GTEx_V8_COLOC.coloc_with_enloc_priors` as coloc INNER JOIN
(SELECT tissue, phenotype, gene_id, max(rcp) as max_rcp, count(*) as nindep FROM `gtex-awg-im.GTEx_V8_ENLOC.enloc_all_results` WHERE phenotype="UKB_50_Standing_height" group by tissue, phenotype, gene_id) as enloc
ON coloc.tissue=enloc.tissue and coloc.phenotype=enloc.phenotype and coloc.gene_id = enloc.gene_id WHERE enloc.max_rcp>0.5 OR coloc.PP_H4_abf>0.5 '
df <- query_exec(query, project = multixcan_tbl$project, max_pages = Inf, use_legacy_sql = F) %>% suppressMessages()
Auto-refreshing stale OAuth token.
18.0 gigabytes processed
# df %>% ggplot(aes(max_rcp, PP_H4_abf)) + geom_point()
pp <- df %>% ggplot(aes(max_rcp, PP_H4_abf))+ geom_hline(yintercept=0.5,col='gray',size=2,alpha=.5) + geom_vline(xintercept = 0.5,col='gray',size=2,alpha=.5) + geom_point(size=4,alpha=.3) + theme_bw(base_size = 20) +xlim(0,1) + ylim(0,1) + xlab("UK Height ENLOC coloc prob") + ylab("UK Height COLOC coloc prob")
print(pp)
Warning: Removed 3 rows containing missing values (geom_point).
## ggsave(paste0(extdata.dir,"figures/height_fine_giant_uk_ALL.png"),width=8,height=8)
tempo_tabla <- df %>% mutate(enloc_uk = max_rcp>0.25, coloc_uk = PP_H4_abf>0.25) %>% select(enloc_uk, coloc_uk) %>% table()
pp + annotate("text",x=0.125,y=0.625,label=tempo_tabla[1,2],size=10) + annotate("text",x=0.625,y=0.125,label=tempo_tabla[2,1],size=10) + annotate("text",x=0.625,y=0.625,label=tempo_tabla[2,2],size=10)
Warning: Removed 3 rows containing missing values (geom_point).
tempo_tabla <- df %>% filter(nindep==1) %>% mutate(enloc_uk = max_rcp>0.25, coloc_uk = PP_H4_abf>0.25) %>% select(enloc_uk, coloc_uk) %>% table()
pp <- df %>% filter(nindep>1) %>% ggplot(aes(max_rcp, PP_H4_abf))+geom_hline(yintercept=0.5,col='gray',size=2,alpha=.5) + geom_vline(xintercept = 0.5,col='gray',size=2,alpha=.5) + geom_point(size=4,alpha=.3) + theme_bw(base_size = 20) +xlim(0,1) + ylim(0,1) + xlab("UK Height ENLOC coloc prob") + ylab("UK Height COLOC coloc prob")
pp + annotate("text",x=0.125,y=0.625,label=tempo_tabla[1,2],size=10) + annotate("text",x=0.625,y=0.125,label=tempo_tabla[2,1],size=10) + annotate("text",x=0.625,y=0.625,label=tempo_tabla[2,2],size=10) + ggtitle("colocs vs enloc uk height single eqtl")
tempo_tabla <- df %>% filter(nindep>1) %>% mutate(enloc_uk = max_rcp>0.25, coloc_uk = PP_H4_abf>0.25) %>% select(enloc_uk, coloc_uk) %>% table()
pp <- df %>% filter(nindep>1) %>% ggplot(aes(max_rcp, PP_H4_abf))+geom_hline(yintercept=0.5,col='gray',size=2,alpha=.5) + geom_vline(xintercept = 0.5,col='gray',size=2,alpha=.5) + geom_point(size=4,alpha=.3) + theme_bw(base_size = 20) +xlim(0,1) + ylim(0,1) + xlab("UK Height ENLOC coloc prob") + ylab("UK Height COLOC coloc prob")
pp + annotate("text",x=0.125,y=0.625,label=tempo_tabla[1,2],size=10) + annotate("text",x=0.625,y=0.125,label=tempo_tabla[2,1],size=10) + annotate("text",x=0.625,y=0.625,label=tempo_tabla[2,2],size=10) + ggtitle("colocs vs enloc uk height multiple eqtls")
sessionInfo()
R version 3.5.1 (2018-07-02)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS High Sierra 10.13.6
Matrix products: default
BLAS: /Library/Frameworks/R.framework/Versions/3.5/Resources/lib/libRblas.0.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.5/Resources/lib/libRlapack.dylib
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] patchwork_0.0.1 sparklyr_1.0.0 readxl_1.3.1 forcats_0.4.0
[5] stringr_1.4.0 dplyr_0.8.1 purrr_0.3.2 readr_1.3.1
[9] tidyr_0.8.3 tibble_2.1.1 ggplot2_3.1.1 tidyverse_1.2.1
[13] bigrquery_1.1.0
loaded via a namespace (and not attached):
[1] Rcpp_1.0.1 lubridate_1.7.4 lattice_0.20-38 forge_0.2.0
[5] assertthat_0.2.1 rprojroot_1.3-2 digest_0.6.18 R6_2.4.0
[9] cellranger_1.1.0 plyr_1.8.4 backports_1.1.4 evaluate_0.13
[13] httr_1.4.0 pillar_1.4.0 rlang_0.3.4 curl_3.3
[17] lazyeval_0.2.2 rstudioapi_0.10 whisker_0.3-2 rmarkdown_1.12
[21] labeling_0.3 config_0.3 r2d3_0.2.3 htmlwidgets_1.3
[25] bit_1.1-14 munsell_0.5.0 broom_0.5.2 compiler_3.5.1
[29] modelr_0.1.4 xfun_0.6 pkgconfig_2.0.2 askpass_1.1
[33] base64enc_0.1-3 htmltools_0.3.6 openssl_1.3 tidyselect_0.2.5
[37] workflowr_1.3.0 crayon_1.3.4 dbplyr_1.4.0 withr_2.1.2
[41] rappdirs_0.3.1 grid_3.5.1 nlme_3.1-140 jsonlite_1.6
[45] gtable_0.3.0 DBI_1.0.0 git2r_0.25.2 magrittr_1.5
[49] scales_1.0.0 cli_1.1.0 stringi_1.4.3 fs_1.3.1
[53] xml2_1.2.0 ellipsis_0.1.0 generics_0.0.2 tools_3.5.1
[57] bit64_0.9-7 glue_1.3.1 hms_0.4.2 parallel_3.5.1
[61] yaml_2.2.0 colorspace_1.4-1 rvest_0.3.3 knitr_1.22
[65] haven_2.1.0