Last updated: 2022-06-08

Checks: 5 2

Knit directory: finemap/analysis/

This reproducible R Markdown analysis was created with workflowr (version 1.7.0). 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.

The global environment had objects present when the code in the R Markdown file was run. These objects 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. Use wflow_publish or wflow_build to ensure that the code is always run in an empty environment.

The following objects were defined in the global environment when these results were created:

Name Class Size
b numeric 7.9 Kb
bhat numeric 7.9 Kb
dat1 list 250.9 Kb
dat2 list 25.7 Kb
dat3 list 25.5 Kb
maf numeric 78.4 Kb
shat numeric 7.9 Kb
z numeric 7.9 Kb

The command set.seed(1) 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 5c38ef6. 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:


Unstaged changes:
    Modified:   analysis/_site.yml
    Modified:   analysis/large_effect.Rmd

Staged changes:
    Renamed1:   small_data_11.rds
    Renamed2:   data/small_data_11.rds
    Renamed1:   small_data_11_sim_gaussian_pve_n_8.rds
    Renamed2:   data/small_data_11_sim_gaussian_pve_n_8.rds
    Renamed1:   small_data_11_sim_gaussian_pve_n_8_get_sumstats_n_1.rds
    Renamed2:   data/small_data_11_sim_gaussian_pve_n_8_get_sumstats_n_1.rds

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/large_effect.Rmd) and HTML (docs/large_effect.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
html e68ebf0 Peter Carbonetto 2022-06-07 Build site.
Rmd 5ba80d9 Peter Carbonetto 2022-06-07 Small edit.
html 5737016 Peter Carbonetto 2022-06-07 First build of large_effect analysis.
Rmd 4b1ca7f Peter Carbonetto 2022-06-07 workflowr::wflow_publish("large_effect.Rmd")
Rmd eae747f Peter Carbonetto 2022-06-07 Revised workflowr files.

In this small example drawn from our simulations, we show that that FINEMAP works well with an “in-sample LD” matrix—that is, a correlation matrix that was estimated using the same sample that was used to compute the single-SNP association statistics—but, can perform surprisingly poorly with an “out-of-sample” LD matrix. We have observed that this degradation in performance only occurs in rare cases, specifically when the effects of the causal SNPs are very large–i.e., when individual SNPs explain a large fraction of the total variance in the phenotype. So in this example the phenotypes were simulated with large coefficients for the causal SNPs.

We also run SuSiE on the same data. Unlike FINEMAP, SuSiE performs similarly well with both the in-sample and out-of-sample LD matrix.

First, we load some packages used in the code below.

library(data.table)
library(susieR)
library(ggplot2)
library(cowplot)

Load the summary data, the least-squares effect estimates \(\hat{\beta}_i\) and their standard errors \(\hat{s}_i\). Here weq also compute the z-scores since SuSiE accepts the z-scores as input.

dat1 <- readRDS("../data/small_data_11.rds")
dat3 <- readRDS("../data/small_data_11_sim_gaussian_pve_n_8_get_sumstats_n_1.rds")
maf  <- dat1$maf$in_sample
bhat <- dat3$sumstats$bhat
shat <- dat3$sumstats$shat
z    <- bhat/shat

In this simulation, two of the SNPs have a nonzero effect on the phenotype:

dat2 <- readRDS("../data/small_data_11_sim_gaussian_pve_n_8.rds")
b <- drop(dat2$meta$true_coef)
cat("True causal SNPs:\n")
which(b != 0)
# True causal SNPs:
# [1] 305 740

In-sample LD

Out-of-sample LD


sessionInfo()
# R version 3.6.2 (2019-12-12)
# Platform: x86_64-apple-darwin15.6.0 (64-bit)
# Running under: macOS Catalina 10.15.7
# 
# Matrix products: default
# BLAS:   /Library/Frameworks/R.framework/Versions/3.6/Resources/lib/libRblas.0.dylib
# LAPACK: /Library/Frameworks/R.framework/Versions/3.6/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] cowplot_1.0.0     ggplot2_3.3.5     susieR_0.12.07    data.table_1.12.8
# 
# loaded via a namespace (and not attached):
#  [1] tidyselect_1.1.1   xfun_0.29          bslib_0.3.1        purrr_0.3.4       
#  [5] lattice_0.20-38    colorspace_1.4-1   vctrs_0.3.8        generics_0.0.2    
#  [9] htmltools_0.5.2    yaml_2.2.0         utf8_1.1.4         rlang_0.4.11      
# [13] mixsqp_0.3-46      jquerylib_0.1.4    later_1.0.0        pillar_1.6.2      
# [17] withr_2.5.0        DBI_1.1.0          glue_1.4.2         plyr_1.8.5        
# [21] matrixStats_0.61.0 lifecycle_1.0.0    stringr_1.4.0      munsell_0.5.0     
# [25] gtable_0.3.0       workflowr_1.7.0    evaluate_0.14      knitr_1.37        
# [29] callr_3.7.0        fastmap_1.1.0      httpuv_1.5.2       ps_1.6.0          
# [33] irlba_2.3.3        fansi_0.4.0        highr_0.8          Rcpp_1.0.7        
# [37] promises_1.1.0     backports_1.1.5    scales_1.1.0       jsonlite_1.7.2    
# [41] fs_1.5.2           digest_0.6.23      stringi_1.4.3      processx_3.5.2    
# [45] dplyr_1.0.7        rprojroot_1.3-2    grid_3.6.2         tools_3.6.2       
# [49] magrittr_2.0.1     sass_0.4.0         tibble_3.1.3       crayon_1.4.1      
# [53] whisker_0.4        pkgconfig_2.0.3    ellipsis_0.3.2     Matrix_1.2-18     
# [57] reshape_0.8.8      assertthat_0.2.1   rmarkdown_2.11     rstudioapi_0.13   
# [61] R6_2.4.1           git2r_0.29.0       compiler_3.6.2