Last updated: 2020-10-22

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 fa5bc6c. 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/

Untracked files:
    Untracked:  analysis/clusters_pca_structure_Cusanovich2018.Rmd

Unstaged changes:
    Modified:   analysis/plots_Lareau2019_bonemarrow.Rmd
    Modified:   code/plots.R
    Modified:   scripts/fit_all_models_Lareau2019.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_Lareau2019_bonemarrow.Rmd) and HTML (docs/assess_fits_Lareau2019_bonemarrow.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 0ef3b66 kevinlkx 2020-10-21 Build site.
Rmd 65dd007 kevinlkx 2020-10-21 add results from resting and simulated conditions
html 720d1c8 kevinlkx 2020-09-12 Build site.
html cf8b866 kevinlkx 2020-09-10 Build site.
html 8723639 kevinlkx 2020-09-09 Build site.
Rmd da472e5 kevinlkx 2020-09-09 wflow_publish(“analysis/assess_fits_Lareau2019_bonemarrow.Rmd”)
html 1320872 kevinlkx 2020-09-09 Build site.
Rmd f99fe86 kevinlkx 2020-09-09 assess fits
html 14c53c8 kevinlkx 2020-09-09 Build site.
html 54e781b kevinlkx 2020-09-09 Build site.
Rmd 334af8e 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")

Lareau_2019_bonemarrow dataset (including both resting and simulated conditions)

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

out.dir <- "/project2/mstephens/kevinluo/scATACseq-topics/output/Lareau_2019/Lareau_2019_bonemarrow"
load(file.path(out.dir, "/compiled.fits.Lareau2019_bonemarrow.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
0ef3b66 kevinlkx 2020-10-21

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=300)

Version Author Date
0ef3b66 kevinlkx 2020-10-21

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=300)

Version Author Date
0ef3b66 kevinlkx 2020-10-21

Lareau2019_bonemarrow_resting dataset (resting condition)

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

out.dir <- "/project2/mstephens/kevinluo/scATACseq-topics/output/Lareau_2019/Lareau_2019_bonemarrow_resting"
load(file.path(out.dir, "/compiled.fits.Lareau2019_bonemarrow_resting.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
0ef3b66 kevinlkx 2020-10-21

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=300)

Version Author Date
0ef3b66 kevinlkx 2020-10-21

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=300)

Version Author Date
0ef3b66 kevinlkx 2020-10-21

Lareau2019_bonemarrow_stimulated dataset (stimulated condition)

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

out.dir <- "/project2/mstephens/kevinluo/scATACseq-topics/output/Lareau_2019/Lareau_2019_bonemarrow_stimulated"
load(file.path(out.dir, "/compiled.fits.Lareau2019_bonemarrow_stimulated.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
0ef3b66 kevinlkx 2020-10-21

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=300)

Version Author Date
0ef3b66 kevinlkx 2020-10-21

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=300)

Version Author Date
0ef3b66 kevinlkx 2020-10-21

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-180 workflowr_1.6.2   
# 
# 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       quadprog_1.5-5     viridisLite_0.3.0  crayon_1.3.4      
# [41] dplyr_0.8.5        withr_2.1.2        later_1.0.0        MASS_7.3-51.6     
# [45] grid_3.5.1         jsonlite_1.6       gtable_0.3.0       lifecycle_0.2.0   
# [49] git2r_0.27.1       magrittr_1.5       scales_1.1.1       RcppParallel_4.4.3
# [53] stringi_1.4.6      farver_2.0.3       fs_1.3.1           promises_1.1.0    
# [57] ellipsis_0.3.1     vctrs_0.3.0        tools_3.5.1        glue_1.4.1        
# [61] purrr_0.3.4        hms_0.4.2          yaml_2.2.0         colorspace_1.4-1  
# [65] plotly_4.8.0       knitr_1.28         quantreg_5.36      MCMCpack_1.4-4