Last updated: 2020-08-19
Checks: 6 1
Knit directory: causal-TWAS/
This reproducible R Markdown analysis was created with workflowr (version 1.6.2). The Checks tab describes the reproducibility checks that were applied when the results were created. The Past versions tab lists the development history.
The R Markdown file has unstaged changes. To know which version of the R Markdown file created these results, you’ll want to first commit it to the Git repo. If you’re still working on the analysis, you can ignore this warning. When you’re finished, you can run wflow_publish
to commit the R Markdown file and build the HTML.
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(20191103)
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 job! Using relative paths to the files within your workflowr project makes it easier to run your code on other machines.
Great! You are using Git for version control. Tracking code development and connecting the code version to the results is critical for reproducibility.
The results in this page were generated with repository version 846fb96. See the Past versions tab to see a history of the changes made to the R Markdown and HTML files.
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: .Rhistory
Ignored: .Rproj.user/
Ignored: code/workflow/.ipynb_checkpoints/
Ignored: data/
Unstaged changes:
Modified: analysis/simulation-susieI-ukbchr17to22-gtex.adipose.Rmd
Modified: code/run_test_susieI.R
Modified: code/workflow/workflow-susieI-20200813.ipynb
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 repository in which changes were made to the R Markdown (analysis/simulation-susieI-ukbchr17to22-gtex.adipose.Rmd
) and HTML (docs/simulation-susieI-ukbchr17to22-gtex.adipose.html
) files. If you’ve configured a remote Git repository (see ?wflow_git_remote
), click on the hyperlinks in the table below to view the files as they were in that past version.
File | Version | Author | Date | Message |
---|---|---|---|---|
Rmd | 846fb96 | simingz | 2020-08-14 | susieI |
html | 846fb96 | simingz | 2020-08-14 | susieI |
Rmd | fd909a1 | simingz | 2020-08-14 | susieI |
Test susieI for ukb chr 17 to chr 22 combined. SNPs are downsampled to 1/10, eQTLs defined by FUSION-TWAS (Adipose/GTEx) lasso effect size > 0 were kept, p= 86k, n = 20k.
susieI is an iterative version of susie, learning parameters (prior weights
) iteratively using the top region from mr.ash for genes only.
library(mr.ash.alpha)
library(data.table)
suppressMessages({library(plotly)})
library(tidyr)
library(plyr)
library(stringr)
library(kableExtra)
source("analysis/summarize_twas_plots.R")
simdatadir <- "~/causalTWAS/simulations/simulation_ashtest_20200721/"
outputdir <- "~/causalTWAS/simulations/simulation_susieI_20200813/"
susiedir <- "~/causalTWAS/simulations/simulation_susieI_20200813/"
tag <- '20200813-1-1'
Niter <- 10
rpipf <- paste0(outputdir, tag, "-mr.ash.rPIP.txt")
a <- read.table(rpipf, header = T)
a.c <- a[a$nCausal > 0, ]
ax <- pretty(0:max(a$rPIP), n = 30)
par(mfrow=c(2,1))
h1 <- hist(a$rPIP, breaks = 100, xlab = "PIP", main = "PIP distribution-all", col = "grey"); grid()
h2 <- hist(a.c$rPIP, breaks = h1$breaks, xlab = "PIP", main = "PIP distribution-causal", col = "salmon");grid()
Version | Author | Date |
---|---|---|
846fb96 | simingz | 2020-08-14 |
rpipf <- "~/causalTWAS/simulations/simulation_ashtest_20200721/20200721-1-1-mr.ash2s.lassoes-es.rPIP.txt"
a <- read.table(rpipf, header = T)
a.c <- a[a$nCausal > 0 ,]
ax <- pretty(0:max(a$rPIP), n = 30) # Make a neat vector for the breakpoints
par(mfrow=c(2,1))
h1 <- hist(a$rPIP, breaks = 100, xlab = "PIP", main = "PIP distribution-all", col = "grey"); grid()
h2 <- hist(a.c$rPIP, breaks = h1$breaks, xlab = "PIP", main = "PIP distribution-causal", col = "salmon");grid()
Version | Author | Date |
---|---|---|
846fb96 | simingz | 2020-08-14 |
Regions: We use regional PIP of both SNP and gene from mr.ash2s > 0.3 , and also require at least one causal gene or SNP is present, also, at least one gene.
Prior change for each iteration:
load(paste0(outputdir, tag, ".susieIres.Rd"))
df <- cbind(prior.gene_rec, prior.SNP_rec)
rownames(df) <- paste("Iteration", 1:Niter)
colnames(df) <- c("Prior.gene", "Prior.SNP")
df
Prior.gene Prior.SNP
Iteration 1 4.287261e-02 0.9571274
Iteration 2 6.954929e-03 0.9930451
Iteration 3 1.351683e-03 0.9986483
Iteration 4 2.713631e-04 0.9997286
Iteration 5 5.482880e-05 0.9999452
Iteration 6 1.109243e-05 0.9999889
Iteration 7 2.244698e-06 0.9999978
Iteration 8 4.542679e-07 0.9999995
Iteration 9 9.193288e-08 0.9999999
Iteration 10 1.860504e-08 1.0000000
Results for each region:
regionlist <- readRDS(paste0(outputdir, tag, "_regionlist.rds"))
ng <- unlist(lapply(lapply(regionlist, '[[', "anno"), function(x) dim(x[x$type == "gene", , drop = F ])[1]))
ng.c <- unlist(lapply(lapply(regionlist, '[[', "anno"), function(x) dim(x[x$type == "gene" & x$ifcausal == 1, , drop = F])[1]))
ns.c <- unlist(lapply(lapply(regionlist, '[[', "anno"), function(x) dim(x[x$type == "SNP" & x$ifcausal == 1, , drop = F])[1]))
ngdf <- data.frame("ngene" = ng, "ncausalgene" = ng.c, "ncausalSNP" = ns.c)
for (i in Niter){
resf <- paste0(outputdir, tag, ".", i, ".susieIres.Rd")
load(resf)
ngdf[, paste("Prior.gene", i)] <- unlist(gene.rpiplist)
}
ngdf
ngene ncausalgene ncausalSNP Prior.gene 10
1 1 1 2 1.032077e-10
2 1 0 1 1.304694e-09
3 7 1 0 8.043942e-09
4 4 0 2 5.338542e-10
5 7 0 1 1.428272e-09
6 10 1 1 7.656938e-07
7 4 0 1 1.332010e-10
8 1 0 1 9.790813e-12
10 6 1 0 6.224828e-09
11 11 2 1 3.330455e-09
12 2 0 2 1.143951e-12
13 12 2 0 7.855562e-09
14 7 0 2 2.513161e-10
18 2 1 0 7.022337e-09
19 2 1 0 1.358569e-09
22 1 0 1 4.398703e-10
24 6 0 1 2.686760e-09
25 4 1 0 2.255832e-09
26 4 0 1 5.025149e-14
27 2 0 1 2.749126e-09
28 4 0 1 1.702461e-09
29 4 0 1 9.997704e-10
30 3 0 1 9.729382e-10
31 4 1 0 1.793812e-09
32 7 1 0 8.046979e-09
33 2 0 2 3.060114e-09
34 9 0 1 6.037589e-14
35 8 0 1 3.389231e-09
36 6 0 1 5.144224e-12
37 11 0 1 5.587082e-09
39 1 0 1 7.198771e-12
43 1 0 2 2.203294e-10
44 3 0 1 3.684302e-10
46 4 0 1 2.522228e-18
47 4 1 0 2.716907e-09
53 5 0 3 3.800506e-10
54 3 0 1 2.317636e-09
55 6 0 1 1.010353e-09
56 2 0 1 9.726544e-10
57 10 0 2 4.418013e-09
58 5 0 1 2.137974e-09
59 14 0 1 1.033099e-08
60 4 0 1 2.284047e-09
61 4 0 1 5.996312e-10
62 3 0 2 2.028332e-10
63 3 0 1 9.262371e-10
64 12 1 0 8.559334e-09
Shuffle genes to different regions.
Prior change for each iteration:
tag <- '20200813-1-1-shuffleg'
load(paste0(outputdir, tag, ".susieIres.Rd"))
df <- cbind(prior.gene_rec, prior.SNP_rec)
rownames(df) <- paste("Iteration", 1:Niter)
colnames(df) <- c("Prior.gene", "Prior.SNP")
df
Prior.gene Prior.SNP
Iteration 1 0.06123103 0.9387690
Iteration 2 0.02398287 0.9760171
Iteration 3 0.02227873 0.9777213
Iteration 4 0.02220286 0.9777971
Iteration 5 0.02219948 0.9778005
Iteration 6 0.02219933 0.9778007
Iteration 7 0.02219933 0.9778007
Iteration 8 0.02219933 0.9778007
Iteration 9 0.02219933 0.9778007
Iteration 10 0.02219933 0.9778007
Results for each region:
regionlist <- readRDS(paste0(outputdir, tag, "_regionlist.rds"))
ng <- unlist(lapply(lapply(regionlist, '[[', "anno"), function(x) dim(x[x$type == "gene", , drop = F ])[1]))
ng.c <- unlist(lapply(lapply(regionlist, '[[', "anno"), function(x) dim(x[x$type == "gene" & x$ifcausal == 1, , drop = F])[1]))
ns.c <- unlist(lapply(lapply(regionlist, '[[', "anno"), function(x) dim(x[x$type == "SNP" & x$ifcausal == 1, , drop = F])[1]))
ngdf <- data.frame("ngene" = ng, "ncausalgene" = ng.c, "ncausalSNP" = ns.c)
for (i in 1:Niter){
resf <- paste0(outputdir, tag, ".", i, ".susieIres.Rd")
load(resf)
ngdf[, paste("Prior.gene", i)] <- unlist(gene.rpiplist)
}
ngdf
ngene ncausalgene ncausalSNP Prior.gene 1 Prior.gene 2 Prior.gene 3
1 7 1 2 3.640772e-06 2.374692e-07 8.946192e-08
2 2 0 1 5.172067e-01 5.068131e-02 1.901263e-02
3 12 1 0 5.134364e-02 3.488501e-03 1.316602e-03
4 12 2 2 3.972331e-02 2.676677e-03 1.009835e-03
5 4 1 1 1.072053e-03 6.997004e-05 2.636060e-05
6 7 0 1 3.428273e-04 2.236700e-05 8.426433e-06
7 1 0 1 1.048032e-04 6.836104e-06 2.575375e-06
8 4 0 1 4.568247e-04 2.980264e-05 1.122767e-05
10 4 0 0 8.644879e-03 5.665639e-04 2.134865e-04
11 3 0 1 4.677641e-02 3.190439e-03 1.204330e-03
12 5 0 2 6.213836e-05 4.053107e-06 1.526931e-06
13 6 0 0 3.045126e-02 2.040523e-03 7.696418e-04
14 1 1 2 4.180617e-02 2.837295e-03 1.070782e-03
18 8 0 0 2.025237e-03 1.322451e-04 4.982321e-05
19 9 0 0 2.453778e-01 1.945630e-02 7.386114e-03
22 3 0 1 1.415094e-02 9.353656e-04 3.525864e-04
24 6 0 1 2.882048e-02 1.904373e-03 7.178662e-04
25 2 1 0 1.978178e-02 1.295218e-03 4.880060e-04
26 6 1 1 8.219039e-06 5.360880e-07 2.019608e-07
27 6 0 1 1.841520e-02 1.211739e-03 4.566756e-04
28 4 0 1 1.818182e-02 1.206410e-03 4.548334e-04
29 4 1 1 7.903698e-03 5.184353e-04 1.953585e-04
30 11 2 1 2.700498e-02 1.800193e-03 6.788365e-04
31 2 0 0 9.661836e-03 6.359350e-04 2.396711e-04
32 4 0 0 6.902375e-03 4.524640e-04 1.704942e-04
33 14 0 2 2.722003e-03 1.778702e-04 6.701451e-05
34 4 0 1 6.669268e-09 4.350017e-10 1.638784e-10
35 1 0 1 4.587156e-03 3.004849e-04 1.132230e-04
36 1 0 1 5.745820e-05 3.747834e-06 1.411926e-06
37 1 0 1 5.494505e-03 3.602283e-04 1.357395e-04
39 4 0 1 6.290717e-05 4.103240e-06 1.545818e-06
43 4 0 2 1.703180e-02 1.127440e-03 4.250160e-04
44 3 0 1 4.462480e-04 2.911312e-05 1.096791e-05
46 3 0 1 5.181058e-11 3.379335e-12 1.273099e-12
47 1 0 0 6.821373e-03 4.476233e-04 1.686778e-04
53 3 0 3 1.090432e-03 7.116088e-05 2.680909e-05
54 2 0 1 1.652893e-02 1.095015e-03 4.128073e-04
55 5 0 1 7.515356e-03 4.922952e-04 1.854973e-04
56 4 1 1 6.822762e-03 4.463276e-04 1.681669e-04
57 11 0 2 2.857178e-02 1.902394e-03 7.173381e-04
58 10 1 1 9.999774e-01 9.996534e-01 9.990802e-01
59 7 1 1 1.749496e-01 1.230379e-02 4.641869e-03
60 2 1 1 2.687543e-01 8.095902e-04 3.051513e-04
61 2 0 1 2.204919e-02 1.467468e-03 5.533302e-04
62 10 0 2 8.621726e-03 5.659487e-04 2.132695e-04
63 7 0 1 1.519468e-01 9.621419e-03 3.600205e-03
64 4 0 0 1.757789e-02 1.151651e-03 4.339492e-04
Prior.gene 4 Prior.gene 5 Prior.gene 6 Prior.gene 7 Prior.gene 8
1 8.296021e-08 8.267128e-08 8.265842e-08 8.265785e-08 8.265782e-08
2 1.762498e-02 1.756333e-02 1.756059e-02 1.756047e-02 1.756046e-02
3 1.221014e-03 1.216766e-03 1.216577e-03 1.216568e-03 1.216568e-03
4 9.365040e-04 9.332450e-04 9.331000e-04 9.330935e-04 9.330932e-04
5 2.444485e-05 2.435972e-05 2.435593e-05 2.435576e-05 2.435575e-05
6 7.814040e-06 7.786826e-06 7.785615e-06 7.785561e-06 7.785559e-06
7 2.388208e-06 2.379890e-06 2.379520e-06 2.379504e-06 2.379503e-06
8 1.041169e-05 1.037543e-05 1.037382e-05 1.037375e-05 1.037374e-05
10 1.979730e-04 1.972836e-04 1.972529e-04 1.972516e-04 1.972515e-04
11 1.116902e-03 1.113016e-03 1.112843e-03 1.112836e-03 1.112835e-03
12 1.415961e-06 1.411029e-06 1.410810e-06 1.410800e-06 1.410800e-06
13 7.137449e-04 7.112607e-04 7.111502e-04 7.111453e-04 7.111450e-04
14 9.930394e-04 9.895843e-04 9.894306e-04 9.894237e-04 9.894234e-04
18 4.620237e-05 4.604147e-05 4.603430e-05 4.603399e-05 4.603397e-05
19 6.851600e-03 6.827838e-03 6.826781e-03 6.826734e-03 6.826732e-03
22 3.269703e-04 3.258319e-04 3.257812e-04 3.257790e-04 3.257789e-04
24 6.657124e-04 6.633947e-04 6.632915e-04 6.632869e-04 6.632867e-04
25 4.525421e-04 4.509661e-04 4.508960e-04 4.508929e-04 4.508927e-04
26 1.872831e-07 1.866309e-07 1.866018e-07 1.866005e-07 1.866005e-07
27 4.234936e-04 4.220190e-04 4.219534e-04 4.219504e-04 4.219503e-04
28 4.217920e-04 4.203236e-04 4.202583e-04 4.202554e-04 4.202552e-04
29 1.811626e-04 1.805318e-04 1.805037e-04 1.805024e-04 1.805024e-04
30 6.295280e-04 6.273367e-04 6.272392e-04 6.272349e-04 6.272347e-04
31 2.222567e-04 2.214828e-04 2.214484e-04 2.214469e-04 2.214468e-04
32 1.581049e-04 1.575543e-04 1.575298e-04 1.575288e-04 1.575287e-04
33 6.214440e-05 6.192798e-05 6.191834e-05 6.191792e-05 6.191790e-05
34 1.519685e-10 1.514392e-10 1.514156e-10 1.514146e-10 1.514145e-10
35 1.049953e-04 1.046297e-04 1.046134e-04 1.046127e-04 1.046127e-04
36 1.309313e-06 1.304753e-06 1.304550e-06 1.304541e-06 1.304541e-06
37 1.258757e-04 1.254374e-04 1.254179e-04 1.254170e-04 1.254170e-04
39 1.433474e-06 1.428482e-06 1.428260e-06 1.428250e-06 1.428250e-06
43 3.941388e-04 3.927667e-04 3.927056e-04 3.927029e-04 3.927027e-04
44 1.017082e-05 1.013539e-05 1.013382e-05 1.013375e-05 1.013374e-05
46 1.180575e-12 1.176464e-12 1.176281e-12 1.176273e-12 1.176272e-12
47 1.564208e-04 1.558761e-04 1.558519e-04 1.558508e-04 1.558508e-04
53 2.486075e-05 2.477417e-05 2.477031e-05 2.477014e-05 2.477014e-05
54 3.828177e-04 3.814850e-04 3.814257e-04 3.814230e-04 3.814229e-04
55 1.720176e-04 1.714186e-04 1.713919e-04 1.713907e-04 1.713907e-04
56 1.559461e-04 1.554031e-04 1.553789e-04 1.553778e-04 1.553778e-04
57 6.652314e-04 6.629158e-04 6.628127e-04 6.628081e-04 6.628079e-04
58 9.990082e-01 9.990047e-01 9.990046e-01 9.990045e-01 9.990045e-01
59 4.304767e-03 4.289786e-03 4.289119e-03 4.289089e-03 4.289088e-03
60 2.829805e-04 2.819952e-04 2.819514e-04 2.819494e-04 2.819493e-04
61 5.131365e-04 5.113503e-04 5.112708e-04 5.112673e-04 5.112671e-04
62 1.977724e-04 1.970837e-04 1.970530e-04 1.970517e-04 1.970516e-04
63 3.337509e-03 3.325839e-03 3.325320e-03 3.325297e-03 3.325296e-03
64 4.024152e-04 4.010138e-04 4.009515e-04 4.009487e-04 4.009486e-04
Prior.gene 9 Prior.gene 10
1 8.265782e-08 8.265782e-08
2 1.756046e-02 1.756046e-02
3 1.216568e-03 1.216568e-03
4 9.330932e-04 9.330932e-04
5 2.435575e-05 2.435575e-05
6 7.785559e-06 7.785559e-06
7 2.379503e-06 2.379503e-06
8 1.037374e-05 1.037374e-05
10 1.972515e-04 1.972515e-04
11 1.112835e-03 1.112835e-03
12 1.410800e-06 1.410800e-06
13 7.111450e-04 7.111450e-04
14 9.894234e-04 9.894234e-04
18 4.603397e-05 4.603397e-05
19 6.826732e-03 6.826732e-03
22 3.257789e-04 3.257789e-04
24 6.632867e-04 6.632867e-04
25 4.508927e-04 4.508927e-04
26 1.866005e-07 1.866005e-07
27 4.219503e-04 4.219503e-04
28 4.202552e-04 4.202552e-04
29 1.805024e-04 1.805024e-04
30 6.272347e-04 6.272347e-04
31 2.214468e-04 2.214468e-04
32 1.575287e-04 1.575287e-04
33 6.191790e-05 6.191790e-05
34 1.514145e-10 1.514145e-10
35 1.046127e-04 1.046127e-04
36 1.304541e-06 1.304541e-06
37 1.254170e-04 1.254170e-04
39 1.428250e-06 1.428250e-06
43 3.927027e-04 3.927027e-04
44 1.013374e-05 1.013374e-05
46 1.176272e-12 1.176272e-12
47 1.558508e-04 1.558508e-04
53 2.477013e-05 2.477013e-05
54 3.814229e-04 3.814229e-04
55 1.713907e-04 1.713907e-04
56 1.553778e-04 1.553778e-04
57 6.628079e-04 6.628079e-04
58 9.990045e-01 9.990045e-01
59 4.289088e-03 4.289088e-03
60 2.819493e-04 2.819493e-04
61 5.112671e-04 5.112671e-04
62 1.970516e-04 1.970516e-04
63 3.325296e-03 3.325296e-03
64 4.009486e-04 4.009486e-04
sessionInfo()
R version 3.5.1 (2018-07-02)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Scientific Linux 7.4 (Nitrogen)
Matrix products: default
BLAS/LAPACK: /software/openblas-0.2.19-el7-x86_64/lib/libopenblas_haswellp-r0.2.19.so
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
[3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
[5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=en_US.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] kableExtra_1.1.0 stringr_1.4.0 plyr_1.8.6
[4] tidyr_0.8.3 plotly_4.9.2.9000 ggplot2_3.3.1
[7] data.table_1.12.7 mr.ash.alpha_0.1-34
loaded via a namespace (and not attached):
[1] tidyselect_1.1.0 purrr_0.3.4 lattice_0.20-38
[4] colorspace_1.3-2 vctrs_0.3.1 generics_0.0.2
[7] htmltools_0.3.6 viridisLite_0.3.0 yaml_2.2.0
[10] rlang_0.4.6 later_0.7.5 pillar_1.4.4
[13] glue_1.4.1 withr_2.1.2 lifecycle_0.2.0
[16] munsell_0.5.0 gtable_0.2.0 workflowr_1.6.2
[19] rvest_0.3.2 htmlwidgets_1.3 evaluate_0.12
[22] knitr_1.20 httpuv_1.4.5 Rcpp_1.0.4.6
[25] readr_1.3.1 promises_1.0.1 scales_1.0.0
[28] backports_1.1.2 webshot_0.5.1 jsonlite_1.6.1
[31] fs_1.3.1 hms_0.4.2 digest_0.6.25
[34] stringi_1.3.1 dplyr_1.0.0 grid_3.5.1
[37] rprojroot_1.3-2 tools_3.5.1 magrittr_1.5
[40] lazyeval_0.2.1 tibble_3.0.1 crayon_1.3.4
[43] whisker_0.3-2 pkgconfig_2.0.2 ellipsis_0.3.1
[46] Matrix_1.2-15 xml2_1.2.0 rmarkdown_1.10
[49] httr_1.4.1 rstudioapi_0.11 R6_2.3.0
[52] git2r_0.26.1 compiler_3.5.1