Last updated: 2020-10-05

Checks: 7 0

Knit directory: scATACseq-topics/

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(20200729) 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 6071213. 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/

Unstaged changes:
    Modified:   scripts/fit_all_models_Cusanovich2018.sh

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/assess_fits_Cusanovich2018.Rmd) and HTML (docs/assess_fits_Cusanovich2018.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 6071213 kevinlkx 2020-09-30 Build site.
Rmd ebf1989 kevinlkx 2020-09-30 adjust figure sizes
html 0150b12 kevinlkx 2020-09-30 Build site.
Rmd 06bd689 kevinlkx 2020-09-30 add results with k = 11:15
html bdbac45 kevinlkx 2020-09-10 Build site.
html 6d06f2a kevinlkx 2020-09-09 Build site.
Rmd 96b63a9 kevinlkx 2020-09-09 assess fits

Here we compare the quality of the fits obtained from the different updates (EM, CCD, SCD, with and without extrapolation), and with different \(k\).

Load the packages used in the analysis below, as well as some additional functions for creating the plots.

library(fastTopics)
library(ggplot2)
library(cowplot)
source("code/functions_for_assessing_fits.R")

Load the results of running fit_poisson_nmf on the Cusanovich_2018 data, with different algorithms, and for various choices of \(k\) (the number of “topics”).

out.dir <- "/project2/mstephens/kevinluo/scATACseq-topics/output/Cusanovich_2018"
load(file.path(out.dir, "/compiled.fits.Cusanovich2018.RData"))

This plot shows the improvement in the log-likelihood as the rank, \(k\), is increased. The log-likelihoods are shown relative to the log-likelihood at \(k = 2\).

plot_loglik_vs_rank(fits) +
  theme_cowplot(font_size = 12)

Version Author Date
6071213 kevinlkx 2020-09-30
0150b12 kevinlkx 2020-09-30
6d06f2a kevinlkx 2020-09-09

As expected, the likelihood consistently improves as the rank, \(k\), is increased.

The next set of plots shows the improvement in the fit over time, for all choices of \(k\), and for each of the three optimization methods (EM, CCD, SCD), with and without the extrapolation scheme. The quality of the fit is measured by the log-likelihood relative to the best log-likelihood that was identified among all methods compared.

create_progress_plots(dat, fits, x="iter", y="loglik", numiter.prefit=200)

Version Author Date
6071213 kevinlkx 2020-09-30
0150b12 kevinlkx 2020-09-30
6d06f2a kevinlkx 2020-09-09

The last set of plots shows the evolution of the KKT residuals over time; the KKT residuals should vanish near a stationary point of the log-likelihood, so looking at the largest KKT residual can be used to assess how close we are to a solution. Note that, unlike the log-likelihood, the KKT residuals are not expected to decrease monotonically over time.

create_progress_plots(dat, fits, x="iter", y="res", numiter.prefit=200)

Version Author Date
6071213 kevinlkx 2020-09-30
0150b12 kevinlkx 2020-09-30
6d06f2a kevinlkx 2020-09-09

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] cowplot_1.0.0      ggplot2_3.3.0      fastTopics_0.3-163
# 
# loaded via a namespace (and not attached):
#  [1] ggrepel_0.8.2      Rcpp_1.0.4.6       lattice_0.20-38    tidyr_0.8.3       
#  [5] prettyunits_1.1.1  assertthat_0.2.1   rprojroot_1.3-2    digest_0.6.25     
#  [9] R6_2.4.1           backports_1.1.7    MatrixModels_0.4-1 evaluate_0.14     
# [13] coda_0.19-2        httr_1.4.1         pillar_1.4.4       rlang_0.4.6       
# [17] progress_1.2.2     lazyeval_0.2.2     data.table_1.12.8  irlba_2.3.3       
# [21] SparseM_1.77       whisker_0.4        Matrix_1.2-15      rmarkdown_2.1     
# [25] labeling_0.3       Rtsne_0.15         stringr_1.4.0      htmlwidgets_1.5.1 
# [29] munsell_0.5.0      compiler_3.5.1     httpuv_1.5.3.1     xfun_0.14         
# [33] pkgconfig_2.0.3    mcmc_0.9-7         htmltools_0.4.0    tidyselect_0.2.5  
# [37] tibble_3.0.1       workflowr_1.6.2    quadprog_1.5-5     viridisLite_0.3.0 
# [41] crayon_1.3.4       dplyr_0.8.5        withr_2.1.2        later_1.0.0       
# [45] MASS_7.3-51.6      grid_3.5.1         jsonlite_1.6       gtable_0.3.0      
# [49] lifecycle_0.2.0    git2r_0.27.1       magrittr_1.5       scales_1.1.1      
# [53] RcppParallel_4.4.3 stringi_1.4.6      farver_2.0.3       fs_1.3.1          
# [57] promises_1.1.0     ellipsis_0.3.1     vctrs_0.3.0        tools_3.5.1       
# [61] glue_1.4.1         purrr_0.3.4        hms_0.4.2          yaml_2.2.0        
# [65] colorspace_1.4-1   plotly_4.8.0       knitr_1.28         quantreg_5.36     
# [69] MCMCpack_1.4-4