Last updated: 2025-10-12

Checks: 7 0

Knit directory: Improved_LD_SuSiE/

This reproducible R Markdown analysis was created with workflowr (version 1.7.1). 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(20250821) 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 2c643c9. 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:


Untracked files:
    Untracked:  data/bloodcells_chr1.153094636.157301801.matrix.gz
    Untracked:  data/bloodcells_chr1.153094636.157301801.z.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/susie_rss_ukbb.Rmd) and HTML (docs/susie_rss_ukbb.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 2c643c9 Peter Carbonetto 2025-10-12 wflow_publish("analysis/susie_rss_ukbb.Rmd", view = T, verbose = T)
Rmd 110e9ae Peter Carbonetto 2025-10-12 wflow_publish("analysis/index.Rmd")

To run this analysis, you will first need to download the association statistics from the UK Biobank data and the LD matrix. Download these two files from the Box folder and move them into the “data” directory of this repository:

bloodcells_chr1.153094636.157301801.z.rds
bloodcells_chr1.153094636.157301801.matrix.gz

Load the packages needed for this analysis:

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

Set the seed for reproducibility:

set.seed(1)

Get the z-scores:

dat <- readRDS("data/bloodcells_chr1.153094636.157301801.z.rds")
n <- dat$n
z <- dat$Z[,"Reticulocyte_perc"]
pos <- dat$pos$POS/1e6
ids <- dat$pos$ID
names(z) <- ids

Import the “in-sample” LD matrix:

R <- fread("data/bloodcells_chr1.153094636.157301801.matrix.gz",
           sep = " ",verbose = TRUE)
R <- as.matrix(R)
rownames(R) <- ids
colnames(R) <- ids
#   OpenMP version (_OPENMP)       201811
#   omp_get_num_procs()            8
#   R_DATATABLE_NUM_PROCS_PERCENT  unset (default 50)
#   R_DATATABLE_NUM_THREADS        unset
#   R_DATATABLE_THROTTLE           unset (default 1024)
#   omp_get_thread_limit()         2147483647
#   omp_get_max_threads()          8
#   OMP_THREAD_LIMIT               unset
#   OMP_NUM_THREADS                unset
#   RestoreAfterFork               true
#   data.table is using 4 threads with throttle==1024. See ?setDTthreads.
# freadR.c has been passed a filename: /var/folders/9b/ck4lp8s140lcksryyh4dppdr0000gp/T//RtmpbkVxkq/filefb341eebd464
# [01] Check arguments
#   Using 4 threads (omp_get_max_threads()=8, nth=4)
#   NAstrings = [<<NA>>]
#   None of the NAstrings look like numbers.
#   show progress = 0
#   0/1 column will be read as integer
#   Y/N column will be read as character
# [02] Opening the file
#   Opening file /var/folders/9b/ck4lp8s140lcksryyh4dppdr0000gp/T//RtmpbkVxkq/filefb341eebd464
#   File opened, size = 3.061GB (3286687694 bytes).
#   Memory mapped ok
# [03] Detect and skip BOM
# [04] Arrange mmap to be \0 terminated
#   \n has been found in the input and different lines can end with different line endings (e.g. mixed \n and \r\n in one file). This is common and ideal.
# [05] Skipping initial rows if needed
#   Positioned on line 1 starting: <<1 -0.016736 -0.00106111 -0.001>>
# [06] Detect separator, quoting rule, and ncolumns
#   Using supplied sep ' '
#   sep=' '  with 100 lines of 17048 fields using quote rule 0
#   Detected 17048 columns on line 1. This line is either column names or first data row. Line starts as: <<1 -0.016736 -0.00106111 -0.001>>
#   Quote rule picked = 0
#   fill=false and the most number of columns found is 17048
# [07] Detect column types, dec, good nrow estimate and whether first row is column names
#   Number of sampling jump points = 10 because (3286687693 bytes from row 1 to eof) / (2 * 19613164 jump0size) == 83
#   dec='.' detected based on a balance of 1704799 parsed fields
#   Type codes (jump 000)    : 99999999999999999999999999999999999999999999999999999999999999999999999999999999...9999999999  Quote rule 0
#   Type codes (jump 010)    : 99999999999999999999999999999999999999999999999999999999999999999999999999999999...9999999999  Quote rule 0
#   'header' determined to be false because there are some number columns and those columns do not have a string field at the top of them
#   =====
#   Sampled 1050 rows (handled \n inside quoted fields) at 11 jump points
#   Bytes from first data row on line 1 to the end of last row: 3286490092
#   Line length: mean=192865.54 sd=4221.24 min=184037 max=199377
#   Estimated number of rows: 3286490092 / 192865.54 = 17041
#   Initial alloc = 18745 rows (17041 + 9%) using bytes/max(mean-2*sd,min) clamped between [1.1*estn, 2.0*estn]
#   =====
# [08] Assign column names
# [09] Apply user overrides on column types
#   After 0 type and 0 drop user overrides : 99999999999999999999999999999999999999999999999999999999999999999999999999999999...9999999999
# [10] Allocate memory for the datatable
#   Allocating 17048 column slots (17048 - 0 dropped) with 18745 rows
# [11] Read the data
#   jumps=[0..20), chunk_size=164324504, total_size=3286687693
# Read 17048 rows x 17048 columns from 3.061GB (3286687694 bytes) file in 00:10.230 wall clock time
# [12] Finalizing the datatable
#   Type counts:
#      17048 : float64   '9'
# =============================
#    0.009s (  0%) Memory map 3.061GB file
#    0.943s (  9%) sep=' ' ncol=17048 and header detection
#    0.005s (  0%) Column type detection using 1050 sample rows
#    1.547s ( 15%) Allocation of 18745 rows x 17048 cols (2.381GB) of which 17048 ( 91%) rows used
#    7.727s ( 76%) Reading 20 chunks (0 swept) of 156.712MB (each chunk 852 rows) using 4 threads
#    +    7.209s ( 70%) Parse to row-major thread buffers (grown 0 times)
#    +    0.392s (  4%) Transpose
#    +    0.126s (  1%) Waiting
#    0.000s (  0%) Rereading 0 columns due to out-of-sample type exceptions
#   10.230s        Total

Notes

The file bloodcells_chr1.153094636.157301801.z.rds was originally downloaded from the directory /gpfs/data/stephens-lab/finemap-uk-biobank/data/raw/BloodCells/regions_zscores_maf001_info6 on randi.

bloodcells_chr1.153094636.157301801.matrix.gz was downloaded # from /gpfs/data/stephens-lab/finemap-uk-biobank/data/raw/BloodCells/ # regions_ld_maf001_info6 on randi.


sessionInfo()
# R version 4.3.3 (2024-02-29)
# Platform: aarch64-apple-darwin20 (64-bit)
# Running under: macOS 15.6.1
# 
# Matrix products: default
# BLAS:   /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/lib/libRblas.0.dylib 
# LAPACK: /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/lib/libRlapack.dylib;  LAPACK version 3.11.0
# 
# locale:
# [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
# 
# time zone: America/Chicago
# tzcode source: internal
# 
# attached base packages:
# [1] stats     graphics  grDevices utils     datasets  methods   base     
# 
# other attached packages:
# [1] cowplot_1.1.3     ggrepel_0.9.6     ggplot2_3.5.2     susieR_0.14.22   
# [5] data.table_1.17.6 workflowr_1.7.1  
# 
# loaded via a namespace (and not attached):
#  [1] sass_0.4.10        generics_0.1.4     stringi_1.8.7      lattice_0.22-5    
#  [5] digest_0.6.37      magrittr_2.0.3     evaluate_1.0.4     grid_4.3.3        
#  [9] RColorBrewer_1.1-3 fastmap_1.2.0      R.oo_1.26.0        plyr_1.8.9        
# [13] rprojroot_2.0.4    jsonlite_2.0.0     Matrix_1.6-5       R.utils_2.12.3    
# [17] processx_3.8.3     whisker_0.4.1      reshape_0.8.9      ps_1.7.6          
# [21] mixsqp_0.3-54      promises_1.3.3     httr_1.4.7         scales_1.4.0      
# [25] jquerylib_0.1.4    cli_3.6.5          rlang_1.1.6        crayon_1.5.3      
# [29] R.methodsS3_1.8.2  withr_3.0.2        cachem_1.1.0       yaml_2.3.10       
# [33] tools_4.3.3        dplyr_1.1.4        httpuv_1.6.14      vctrs_0.6.5       
# [37] R6_2.6.1           matrixStats_1.2.0  lifecycle_1.0.4    git2r_0.33.0      
# [41] stringr_1.5.1      fs_1.6.6           irlba_2.3.5.1      pkgconfig_2.0.3   
# [45] callr_3.7.5        pillar_1.11.0      bslib_0.9.0        later_1.4.2       
# [49] gtable_0.3.6       glue_1.8.0         Rcpp_1.1.0         xfun_0.52         
# [53] tibble_3.3.0       tidyselect_1.2.1   rstudioapi_0.15.0  knitr_1.50        
# [57] dichromat_2.0-0.1  farver_2.1.2       htmltools_0.5.8.1  rmarkdown_2.29    
# [61] compiler_4.3.3     getPass_0.2-4