Last updated: 2017-03-03
Code version: 11b31d3
The following code reads in Vhat from the “nullish” z scores, and checks they exceed the lower bound from here. If not it replaces them with the lower bound.
source("../code/SumstatQuery.R")
##
# Load data for a random subset of eqtls
dat <- GetSS("null", "../data/MatrixEQTLSumStats.Portable.h5")
vhat = readRDS("../data/vhat.RDS")
vhat = ifelse(vhat<0, 0,vhat)
for(i in 1:(nrow(vhat)-1)){
for(j in (i+1):ncol(vhat)){
lb = 1-0.5*mean((dat$z[,i]-dat$z[,j])^2)
if(vhat[i,j]<lb){vhat[i,j]=lb} #set to lower bound if lower than lower bound
vhat[j,i] = vhat[i,j]
}
}
saveRDS(vhat,"../data/vhat.lb.RDS")
dimnames(vhat)=NULL #had to do this to make the figure nice
corrplot::corrplot(as.matrix(vhat),xlab="")
sessionInfo()
R version 3.3.2 (2016-10-31)
Platform: x86_64-apple-darwin13.4.0 (64-bit)
Running under: OS X El Capitan 10.11.6
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] RSQLite_1.1-2 rhdf5_2.18.0
loaded via a namespace (and not attached):
[1] workflowr_0.3.0 Rcpp_0.12.9 digest_0.6.12 rprojroot_1.2 DBI_0.5-1 backports_1.0.5 git2r_0.18.0
[8] magrittr_1.5 evaluate_0.10 stringi_1.1.2 zlibbioc_1.20.0 rstudioapi_0.6 rmarkdown_1.3 tools_3.3.2
[15] stringr_1.2.0 yaml_2.1.14 corrplot_0.77 memoise_1.0.0 htmltools_0.3.5 knitr_1.15.1
This R Markdown site was created with workflowr