Last updated: 2019-07-02

Checks: 6 0

Knit directory: FLASHvestigations/

This reproducible R Markdown analysis was created with workflowr (version 1.2.0). The Report 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(20180714) 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! You are using Git for version control. Tracking code development and connecting the code version to the results is critical for reproducibility. The version displayed above was the version of the Git repository at the time these results were generated.

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:    .DS_Store
    Ignored:    .Rhistory
    Ignored:    .Rproj.user/
    Ignored:    analysis/.DS_Store
    Ignored:    code/.DS_Store
    Ignored:    code/flashier_bench/.DS_Store
    Ignored:    data/flashier_bench/

Untracked files:
    Untracked:  code/ebspca.R
    Untracked:  code/flashier_bench/.test2.swp
    Untracked:  code/lowrank.R

Unstaged changes:
    Modified:   analysis/flashier_features.Rmd
    Modified:   analysis/index.Rmd

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 R Markdown and HTML files. If you’ve configured a remote Git repository (see ?wflow_git_remote), click on the hyperlinks in the table below to view them.

File Version Author Date Message
Rmd 1037f11 Jason Willwerscheid 2019-07-02 wflow_publish(“analysis/flashier_bench.Rmd”)
html 64ed09f Jason Willwerscheid 2019-01-12 Build site.
Rmd 7951c3c Jason Willwerscheid 2019-01-12 workflowr::wflow_publish(“analysis/flashier_bench.Rmd”)

GTEx eQTL data

First, I fit the “strong” subset of SNP-gene association statistics used in Urbut, Wang, Carbonetto, and Stephens (2018) (the strong.z dataset found here). I fit five FLASH factors with scale-mixture-of-normal and point-normal priors using flashr and flashier.

The data is a dense 16k x 44 matrix that takes up 7.0 MB of memory when loaded into R. I used the broadwl partition of the midway2 RCC cluster with 4 CPUs and 32 GB of memory, and I used Gao Wang’s monitor_memory.py script to test memory usage, as recommended in Peter Carbonetto’s large-scale data analysis tutorial.

GTEx eQTL data
VMS (GB) RSS (GB) Init (s/factor) Greedy (s/iter) Backfit (s/iter) Backfit iters ELBO Time (min)
flashr.normal.mix 0.62 0.37 0.96 0.47 0.43 285 -1324706 3.25
flashier.normal.mix 0.48 0.30 0.13 0.31 0.25 266 -1324702 1.94
flashr.point.normal 0.57 0.32 0.97 0.12 0.10 300 -1326412 0.87
flashier.point.normal 0.43 0.24 0.17 0.09 0.09 263 -1326413 0.61

Montoro et al. 3’ scRNA-seq data

Next, I fit the droplet-based 3’ scRNA-seq dataset analyzed in Montoro et al. (2018) (the data can be obtained here). I removed all genes with nonzero counts in five or fewer cells, performed a log-plus-one transform of the data, and fit five FLASH factors using scale-mixture-of-normal and point-normal priors.

The data matrix is 15k x 7k and takes up 838 MB of memory when loaded into R as a dense matrix. However, only 11.2% of entries are nonzero, so the data can also be loaded as a sparse Matrix object, in which case the data takes up 142 MB of memory (only flashier supports objects of class Matrix). All fits were performed on the broadwl partition of the midway2 RCC cluster using 4 CPUs and 32 GB of memory.

Montoro 3’ scRNA data
VMS (GB) RSS (GB) Init (s/factor) Greedy (s/iter) Backfit (s/iter) Backfit iters ELBO Time (min)
flashr.normal.mix 11.69 11.44 37.24 15.14 9.49 315 2354585 56.72
flashier.normal.mix. 3.25 3.07 3.52 1.18 1.19 293 2354637 6.76
flashier.sprs.normal.mix 0.96 0.78 0.97 0.45 0.45 294 2354650 2.51
flashr.point.normal 11.78 11.07 37.46 13.28 8.99 105 2322665 23.94
flashier.point.normal 3.17 2.98 3.48 1.02 1.00 30 2319044 1.35
flashier.sprs.point.normal 0.87 0.69 0.97 0.27 0.26 30 2319044 0.36

Montoro et al. full-length scRNA-seq data

Finally, I fit the larger full-length scRNA “PulseSeq” dataset from Montoro et al. (2018). The dataset is about ten times larger than the droplet-based scRNA-seq dataset, so it was not feasible to use flashr. I again removed genes with nonzero counts in five or fewer cells, performed a log-plus-one transform of the data, and fit five factors using scale-mixture-of-normal and point-normal priors.

The dataset is 19k x 66k, with 10.6% of entries not equal to zero, and occupies 1.5 GB of memory when loaded into R as a sparse Matrix object. (I did not attempt to fit a larger matrix object.) The fit was again performed on broadwl using 4 CPUs and 32 GB of memory.

Montoro full-length scRNA data
VMS (GB) RSS (GB) Init (s/factor) Greedy (s/iter) Backfit (s/iter) Backfit iters ELBO Time (min)
flashier.sprs.normal.mix 7.69 7.54 9.42 2.78 2.68 20 125716192 4.33
flashier.sprs.point.normal 7.69 7.54 9.42 2.18 2.04 8 125635635 3.16

Code

The benchmarking code can be browsed here. The R package versions used are those that appear in the session information below (“other attached packages”).

sessionInfo()
R version 3.5.3 (2019-03-11)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS Mojave 10.14.5

Matrix products: default
BLAS: /Library/Frameworks/R.framework/Versions/3.5/Resources/lib/libRblas.0.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.5/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] mixsqp_0.1-119 ashr_2.2-38    ebnm_0.1-23    flashier_0.1.4
[5] flashr_0.6-6  

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.1        highr_0.8         plyr_1.8.4       
 [4] pillar_1.3.1      compiler_3.5.3    git2r_0.25.2     
 [7] workflowr_1.2.0   iterators_1.0.10  tools_3.5.3      
[10] digest_0.6.18     evaluate_0.13     tibble_2.1.1     
[13] gtable_0.3.0      lattice_0.20-38   pkgconfig_2.0.2  
[16] rlang_0.3.1       Matrix_1.2-15     foreach_1.4.4    
[19] yaml_2.2.0        parallel_3.5.3    xfun_0.6         
[22] dplyr_0.8.0.1     stringr_1.4.0     knitr_1.22       
[25] fs_1.2.7          tidyselect_0.2.5  rprojroot_1.3-2  
[28] grid_3.5.3        glue_1.3.1        R6_2.4.0         
[31] rmarkdown_1.12    reshape2_1.4.3    purrr_0.3.2      
[34] ggplot2_3.2.0     magrittr_1.5      whisker_0.3-2    
[37] backports_1.1.3   scales_1.0.0      codetools_0.2-16 
[40] htmltools_0.3.6   MASS_7.3-51.1     assertthat_0.2.1 
[43] softImpute_1.4    colorspace_1.4-1  stringi_1.4.3    
[46] lazyeval_0.2.2    doParallel_1.0.14 pscl_1.5.2       
[49] munsell_0.5.0     truncnorm_1.0-8   SQUAREM_2017.10-1
[52] crayon_1.3.4