Last updated: 2022-01-05
Checks: 7 0
Knit directory: single-cell-topics/analysis/
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(1)
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 5aac256. 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: data/droplet.RData
Ignored: data/pbmc_68k.RData
Ignored: data/pbmc_purified.RData
Ignored: data/pulseseq.RData
Ignored: output/droplet/diff-count-droplet.RData
Ignored: output/droplet/fits-droplet.RData
Ignored: output/droplet/rds/
Ignored: output/pbmc-68k/fits-pbmc-68k.RData
Ignored: output/pbmc-68k/rds/
Ignored: output/pbmc-purified/fits-pbmc-purified.RData
Ignored: output/pbmc-purified/rds/
Ignored: output/pulseseq/diff-count-pulseseq.RData
Ignored: output/pulseseq/fits-pulseseq.RData
Ignored: output/pulseseq/rds/
Ignored: output/sims/
Untracked files:
Untracked: analysis/de_analysis_detailed_look_cache/
Untracked: analysis/de_analysis_detailed_look_more_cache/
Untracked: plots/
Unstaged changes:
Modified: analysis/de_analysis_mast_deseq2.Rmd
Modified: analysis/de_analysis_two_topics.R
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 repository in which changes were made to the R Markdown (analysis/de_analysis_two_topics.Rmd
) and HTML (docs/de_analysis_two_topics.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 | 5aac256 | Peter Carbonetto | 2022-01-05 | workflowr::wflow_publish(“de_analysis_two_topics.Rmd”, verbose = TRUE) |
Here we evaluate performance of the grade-of-membership DE methods in simulations, focussing on the case of \(K = 2\) topics. A smaller simulation with \(K = 2\) topics was first performed here, and based on this initial simulation we have conducted a larger set of simulations using the run_sims.R
script. Here we summarize the results of this larger set of simulations.
Load the packages needed for this analysis, and some additional functions used to compile the results and generate the plots.
library(Matrix)
library(fastTopics)
library(ggplot2)
library(cowplot)
source("../code/de_analysis_functions.R")
Load the results of the simulations.
load("../output/sims/sims-k=2.RData")
These were the R packages used to run the simulations:
res$session.info
# 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] stats4 tools stats graphics grDevices utils datasets
# [8] methods base
#
# other attached packages:
# [1] fastTopics_0.6-97 MAST_1.20.0
# [3] SeuratObject_4.0.2 Seurat_4.0.3
# [5] DESeq2_1.34.0 scran_1.22.1
# [7] scuttle_1.4.0 SingleCellExperiment_1.16.0
# [9] SummarizedExperiment_1.24.0 Biobase_2.54.0
# [11] GenomicRanges_1.46.0 GenomeInfoDb_1.30.0
# [13] IRanges_2.28.0 S4Vectors_0.32.0
# [15] BiocGenerics_0.40.0 MatrixGenerics_1.6.0
# [17] matrixStats_0.60.1 Matrix_1.3-3
#
# loaded via a namespace (and not attached):
# [1] utf8_1.2.1 reticulate_1.20
# [3] tidyselect_1.1.1 RSQLite_2.2.8
# [5] AnnotationDbi_1.56.1 htmlwidgets_1.5.3
# [7] grid_4.1.0 BiocParallel_1.28.0
# [9] Rtsne_0.15 munsell_0.5.0
# [11] ScaledMatrix_1.2.0 codetools_0.2-18
# [13] ica_1.0-2 statmod_1.4.36
# [15] future_1.21.0 miniUI_0.1.1.1
# [17] colorspace_2.0-2 rstudioapi_0.13
# [19] ROCR_1.0-11 tensor_1.5
# [21] listenv_0.8.0 GenomeInfoDbData_1.2.7
# [23] mixsqp_0.3-43 polyclip_1.10-0
# [25] MCMCpack_1.6-0 bit64_4.0.5
# [27] coda_0.19-4 parallelly_1.26.1
# [29] vctrs_0.3.8 generics_0.1.0
# [31] R6_2.5.0 rsvd_1.0.5
# [33] invgamma_1.1 locfit_1.5-9.4
# [35] bitops_1.0-7 spatstat.utils_2.2-0
# [37] cachem_1.0.5 DelayedArray_0.20.0
# [39] assertthat_0.2.1 promises_1.2.0.1
# [41] scales_1.1.1 gtable_0.3.0
# [43] beachmat_2.10.0 globals_0.14.0
# [45] conquer_1.0.2 goftest_1.2-2
# [47] mcmc_0.9-7 rlang_0.4.11
# [49] MatrixModels_0.5-0 genefilter_1.76.0
# [51] splines_4.1.0 lazyeval_0.2.2
# [53] spatstat.geom_2.2-0 reshape2_1.4.4
# [55] abind_1.4-5 httpuv_1.6.1
# [57] ggplot2_3.3.5 ellipsis_0.3.2
# [59] spatstat.core_2.2-0 RColorBrewer_1.1-2
# [61] ggridges_0.5.3 Rcpp_1.0.7
# [63] plyr_1.8.6 sparseMatrixStats_1.6.0
# [65] progress_1.2.2 zlibbioc_1.40.0
# [67] purrr_0.3.4 RCurl_1.98-1.5
# [69] prettyunits_1.1.1 rpart_4.1-15
# [71] deldir_0.2-10 pbapply_1.4-3
# [73] ashr_2.2-51 cowplot_1.1.1
# [75] zoo_1.8-9 ggrepel_0.9.1
# [77] cluster_2.1.2 magrittr_2.0.1
# [79] data.table_1.14.0 scattermore_0.7
# [81] SparseM_1.81 lmtest_0.9-38
# [83] RANN_2.6.1 truncnorm_1.0-8
# [85] SQUAREM_2021.1 fitdistrplus_1.1-5
# [87] hms_1.1.0 patchwork_1.1.1
# [89] mime_0.11 xtable_1.8-4
# [91] XML_3.99-0.6 gridExtra_2.3
# [93] compiler_4.1.0 tibble_3.1.2
# [95] KernSmooth_2.23-20 crayon_1.4.1
# [97] htmltools_0.5.1.1 mgcv_1.8-35
# [99] later_1.2.0 tidyr_1.1.3
# [101] geneplotter_1.72.0 RcppParallel_5.1.4
# [103] DBI_1.1.1 MASS_7.3-54
# [105] quadprog_1.5-8 parallel_4.1.0
# [107] metapod_1.2.0 igraph_1.2.6
# [109] pkgconfig_2.0.3 plotly_4.9.4.1
# [111] spatstat.sparse_2.0-0 annotate_1.72.0
# [113] dqrng_0.3.0 XVector_0.34.0
# [115] stringr_1.4.0 digest_0.6.27
# [117] sctransform_0.3.2 RcppAnnoy_0.0.18
# [119] spatstat.data_2.1-0 Biostrings_2.62.0
# [121] leiden_0.3.8 uwot_0.1.10
# [123] edgeR_3.36.0 DelayedMatrixStats_1.16.0
# [125] shiny_1.6.0 quantreg_5.86
# [127] lifecycle_1.0.0 nlme_3.1-152
# [129] jsonlite_1.7.2 BiocNeighbors_1.12.0
# [131] viridisLite_0.4.0 limma_3.50.0
# [133] fansi_0.5.0 pillar_1.6.1
# [135] lattice_0.20-44 KEGGREST_1.34.0
# [137] fastmap_1.1.0 httr_1.4.2
# [139] survival_3.2-11 glue_1.4.2
# [141] png_0.1-7 bluster_1.4.0
# [143] bit_4.0.4 stringi_1.6.2
# [145] blob_1.2.1 BiocSingular_1.10.0
# [147] memoise_2.0.0 dplyr_1.0.7
# [149] irlba_2.3.3 future.apply_1.7.0
Before comparing the methods, we first assess accuracy of the Monte Carlo computations by comparing the estimates from two independent MCMC runs.
pdat <- data.frame(lfc1 = combine_sim_res(res,function (x) x$de1$postmean[,2]),
lfc2 = combine_sim_res(res,function (x) x$de2$postmean[,2]),
z1 = combine_sim_res(res,function (x) x$de1$z[,2]),
z2 = combine_sim_res(res,function (x) x$de2$z[,2]))
p1 <- ggplot(pdat,aes(x = lfc1,y = lfc2)) +
geom_point(color = "dodgerblue",shape = 4,size = 0.75) +
geom_abline(intercept = 0,slope = 1,linetype = "dotted") +
labs(x = "first posterior mean",y = "second posterior mean") +
theme_cowplot(font_size = 12)
p2 <- ggplot(pdat,aes(x = z1,y = z2)) +
geom_point(color = "dodgerblue",shape = 4,size = 0.75) +
geom_abline(intercept = 0,slope = 1,linetype = "dotted") +
labs(x = "first z-score estimate",y = "second z-score estimate") +
theme_cowplot(font_size = 12)
plot_grid(p1,p2)
The estimates of the posterior mean LFCs and z-scores generated by both MCMC runs are very similar.
sessionInfo()
# R version 3.6.2 (2019-12-12)
# Platform: x86_64-apple-darwin15.6.0 (64-bit)
# Running under: macOS Catalina 10.15.7
#
# Matrix products: default
# BLAS: /Library/Frameworks/R.framework/Versions/3.6/Resources/lib/libRblas.0.dylib
# LAPACK: /Library/Frameworks/R.framework/Versions/3.6/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] cowplot_1.0.0 ggplot2_3.3.5 fastTopics_0.6-96 Matrix_1.2-18
#
# loaded via a namespace (and not attached):
# [1] httr_1.4.2 tidyr_1.1.3 jsonlite_1.7.2 viridisLite_0.3.0
# [5] RcppParallel_4.4.2 assertthat_0.2.1 mixsqp_0.3-46 yaml_2.2.0
# [9] progress_1.2.2 ggrepel_0.9.1 pillar_1.6.2 backports_1.1.5
# [13] lattice_0.20-38 quantreg_5.54 glue_1.4.2 quadprog_1.5-8
# [17] digest_0.6.23 promises_1.1.0 colorspace_1.4-1 htmltools_0.4.0
# [21] httpuv_1.5.2 pkgconfig_2.0.3 invgamma_1.1 SparseM_1.78
# [25] purrr_0.3.4 scales_1.1.0 whisker_0.4 later_1.0.0
# [29] Rtsne_0.15 MatrixModels_0.4-1 git2r_0.26.1 tibble_3.1.3
# [33] farver_2.0.1 generics_0.0.2 ellipsis_0.3.2 withr_2.4.2
# [37] ashr_2.2-51 pbapply_1.5-1 lazyeval_0.2.2 magrittr_2.0.1
# [41] crayon_1.4.1 mcmc_0.9-6 evaluate_0.14 fs_1.3.1
# [45] fansi_0.4.0 MASS_7.3-51.4 truncnorm_1.0-8 tools_3.6.2
# [49] data.table_1.12.8 prettyunits_1.1.1 hms_1.1.0 lifecycle_1.0.0
# [53] stringr_1.4.0 MCMCpack_1.4-5 plotly_4.9.2 munsell_0.5.0
# [57] irlba_2.3.3 compiler_3.6.2 systemfonts_1.0.2 rlang_0.4.11
# [61] grid_3.6.2 htmlwidgets_1.5.1 labeling_0.3 rmarkdown_2.3
# [65] gtable_0.3.0 DBI_1.1.0 R6_2.4.1 knitr_1.26
# [69] dplyr_1.0.7 uwot_0.1.10 utf8_1.1.4 workflowr_1.6.2
# [73] rprojroot_1.3-2 ragg_0.3.1 stringi_1.4.3 parallel_3.6.2
# [77] SQUAREM_2017.10-1 Rcpp_1.0.7 vctrs_0.3.8 tidyselect_1.1.1
# [81] xfun_0.11 coda_0.19-3