Last updated: 2022-07-18

Checks: 7 0

Knit directory: mmbr-rss-dsc/

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.


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(20200227) 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 925e127. 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:  analysis/mvsusie-rss-eg.Rmd
    Untracked:  data/PAINTOR_problem_2indep/
    Untracked:  data/tiny_data_211.config
    Untracked:  data/tiny_data_211.ld
    Untracked:  data/tiny_data_211.log
    Untracked:  data/tiny_data_211.master
    Untracked:  data/tiny_data_211.snp
    Untracked:  data/tiny_data_211_post
    Untracked:  data/tiny_data_211_set
    Untracked:  output/mnm_rss_lite_output.20200227.rds
    Untracked:  output/mnm_rss_lite_output.20200310.rds
    Untracked:  output/ukb_prior_simulation_20220429.rds
    Untracked:  output/ukb_prior_simulation_20220619.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/create_simulation_priors.Rmd) and HTML (docs/create_simulation_priors.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 925e127 zouyuxin 2022-07-18 workflowr::wflow_publish("analysis/create_simulation_priors.Rmd")
html b724100 zouyuxin 2021-03-10 Build site.
Rmd 53ee245 zouyuxin 2021-03-10 wflow_publish("analysis/create_simulation_priors.Rmd")
html ed6347f zouyuxin 2021-03-10 Build site.
Rmd 5825746 zouyuxin 2021-03-10 wflow_publish("analysis/create_simulation_priors.Rmd")
html 756535e zouyuxin 2020-12-30 Build site.
html 329e27d zouyuxin 2020-12-30 Build site.
Rmd a6db4bf zouyuxin 2020-12-30 wflow_publish("analysis/create_simulation_priors.Rmd")
html a93a74b zouyuxin 2020-12-30 Build site.
Rmd 6a8fc02 zouyuxin 2020-12-30 wflow_publish("analysis/create_simulation_priors.Rmd")
html bcf184e zouyuxin 2020-12-30 Build site.
Rmd 5d9fa8d zouyuxin 2020-12-30 wflow_publish("analysis/create_simulation_priors.Rmd")
html 39e04e3 zouyuxin 2020-12-18 Build site.
html f93e386 zouyuxin 2020-12-16 Build site.
Rmd d20e5d4 zouyuxin 2020-12-16 wflow_publish("analysis/create_simulation_priors.Rmd")
html 6fb63e9 zouyuxin 2020-12-16 Build site.
Rmd 98e244e zouyuxin 2020-12-16 wflow_publish("analysis/create_simulation_priors.Rmd")

Artificial structure

20 traits

Canonical patterns of sharing:

R = 20
prior = mvsusieR:::create_cov_canonical(R)

Paired sharing:

paired = matrix(0,R,R)
paired[1:2,1:2] = 1
prior[['paired_1']] = paired
paired = matrix(0,R,R)
paired[10:11,10:11] = 1
prior[['paired_2']] = paired

Block sharing:

block = matrix(0,R,R)
block[1:R/2, 1:R/2] = 1
block[(R/2+1):R, (R/2+1):R] = 1
prior[['blocked_1']] = block

We assign weights to priors:

  1. singleton total 25%

    • singleton_1 has 15%

    • singleton_2 to singleton_11 has 10% (1% each)

  2. shared total 25%

  3. paired 30% (15% each)

  4. blocked 20%

w = c(0.15, rep(0.01, 10), rep(0, 9), rep(0.05, 5), rep(0.15,2), 0.2)
prior = prior[which(w>0)]
w = w[which(w>0)]
artificial_mixture_20 = list(U=prior,w=w)

4 traits

Canonical patterns of sharing:

R = 4
prior = mvsusieR:::create_cov_canonical(R)

Paired sharing:

paired = matrix(0,R,R)
paired[1:2,1:2] = 1
prior[['paired_1']] = paired

Block sharing:

block = matrix(0,R,R)
block[1:R/2, 1:R/2] = 1
block[(R/2+1):R, (R/2+1):R] = 1
prior[['blocked_1']] = block

We assign weights to priors:

  1. singleton total 30%

    • singleton_1, singleton 2 each has 15%
  2. shared total 50%

  3. paired 10%

  4. blocked 10%

w = c(0.15, 0.15, 0, 0, rep(0.5/5,5), 0.1, 0.1)
prior = prior[which(w>0)]
names(prior)
[1] "singleton_1" "singleton_2" "shared_1"    "shared_2"    "shared_3"   
[6] "shared_4"    "shared_5"    "paired_1"    "blocked_1"  
w = w[which(w>0)]
artificial_mixture_4 = list(U=prior,w=w)

2 traits

Canonical patterns of sharing:

R = 2
prior = mvsusieR:::create_cov_canonical(R)

We assign weights to priors:

  1. singleton total 40%

    • singleton_1, singleton 2 each has 20%
  2. shared total 60%

w = c(0.2, 0.2, rep(0.6/5,5))
prior = prior[which(w>0)]
names(prior)
[1] "singleton_1" "singleton_2" "shared_1"    "shared_2"    "shared_3"   
[6] "shared_4"    "shared_5"   
w = w[which(w>0)]
artificial_mixture_2 = list(U=prior,w=w)

2 traits independent

Canonical patterns of sharing:

R = 2
prior = list(independent=diag(2))
w = c(1)
names(prior)
[1] "independent"
artificial_mixture_2_indep = list(U=prior,w=w)

3 traits

Canonical patterns of sharing:

R = 3
prior = mvsusieR:::create_cov_canonical(R)

Paired sharing:

paired = matrix(0,R,R)
paired[1:2,1:2] = 1
prior[['paired_1']] = paired

We assign weights to priors:

  1. singleton total 30%

    • singleton_1 has 15%

    • singleton_2 has 5%

    • singleton_3 has 10%

  2. shared total 50% (10% each)

  3. paired 20%

w = c(0.15, 0.05, 0.1, rep(0.1, 5), 0.2)
prior = prior[which(w>0)]
w = w[which(w>0)]
artificial_mixture_3 = list(U=prior,w=w)

Mixture from UKB

The priors are from this workflow.

prior = readRDS('/project2/mstephens/yuxin/ukb-bloodcells/analysis_20220619/ukbbloodcells_prepare.ed_bovy.ukbbloodcells_prepare.Ycor.rds')
tol=1E-10
U = prior$U[which(prior$w>tol)]
w = prior$w[which(prior$w>tol)]
bloodcells_mixture = list(U=U,w=w)
for(i in 1:length(U)){
  bloodcells_mixture$U[[i]] = (bloodcells_mixture$U[[i]] + t(bloodcells_mixture$U[[i]]))/2
  eigenU = eigen(bloodcells_mixture$U[[i]], symmetric = T)
  if(any(eigenU$values<0)){
    eigenU$values[eigenU$values < 0] = 0
    bloodcells_mixture$U[[i]] = eigenU$vectors %*% (t(eigenU$vectors) * eigenU$values)
  }
}
saveRDS(list(bloodcells_mixture=bloodcells_mixture, artificial_mixture_20=artificial_mixture_20, artificial_mixture_4=artificial_mixture_4, artificial_mixture_2 = artificial_mixture_2, artificial_mixture_2_indep = artificial_mixture_2_indep, artificial_mixture_3 = artificial_mixture_3), 'output/ukb_prior_simulation_20220619.rds')

sessionInfo()
R version 4.1.0 (2021-05-18)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Scientific Linux 7.4 (Nitrogen)

Matrix products: default
BLAS/LAPACK: /software/openblas-0.3.13-el7-x86_64/lib/libopenblas_haswellp-r0.3.13.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] workflowr_1.6.2

loaded via a namespace (and not attached):
 [1] progress_1.2.2      softImpute_1.4-1    tidyselect_1.1.2   
 [4] xfun_0.24           bslib_0.2.5.1       ashr_2.2-54        
 [7] purrr_0.3.4         lattice_0.20-44     colorspace_2.0-3   
[10] vctrs_0.4.1         generics_0.1.2      htmltools_0.5.1.1  
[13] yaml_2.3.5          utf8_1.2.2          rlang_1.0.2        
[16] mixsqp_0.3-43       jquerylib_0.1.4     later_1.2.0        
[19] pillar_1.7.0        DBI_1.1.1           glue_1.6.2         
[22] matrixStats_0.62.0  plyr_1.8.7          mashr_0.2.59       
[25] lifecycle_1.0.1     stringr_1.4.0       munsell_0.5.0      
[28] gtable_0.3.0        mvtnorm_1.1-3       evaluate_0.14      
[31] knitr_1.33          httpuv_1.6.1        invgamma_1.1       
[34] irlba_2.3.5         fansi_1.0.3         Rcpp_1.0.8.3       
[37] susieR_0.12.12      promises_1.2.0.1    scales_1.2.0       
[40] rmeta_3.0           jsonlite_1.8.0      truncnorm_1.0-8    
[43] abind_1.4-5         fs_1.5.0            hms_1.1.1          
[46] ggplot2_3.3.6       digest_0.6.29       stringi_1.7.6      
[49] dplyr_1.0.9         grid_4.1.0          rprojroot_2.0.2    
[52] cowplot_1.1.1       cli_3.3.0           tools_4.1.0        
[55] magrittr_2.0.3      sass_0.4.0          tibble_3.1.7       
[58] crayon_1.5.1        whisker_0.4         pkgconfig_2.0.3    
[61] ellipsis_0.3.2      Matrix_1.3-3        prettyunits_1.1.1  
[64] SQUAREM_2021.1      reshape_0.8.9       assertthat_0.2.1   
[67] rmarkdown_2.9       rstudioapi_0.13     R6_2.5.1           
[70] mvsusieR_0.0.3.0518 git2r_0.28.0        compiler_4.1.0