Last updated: 2024-06-18
Checks: 6 1
Knit directory: zinck-website/
This reproducible R Markdown analysis was created with workflowr (version 1.7.1). The Checks tab describes the reproducibility checks that were applied when the results were created. The Past versions tab lists the development history.
The R Markdown file has unstaged changes. To know which version of
the R Markdown file created these results, you’ll want to first commit
it to the Git repo. If you’re still working on the analysis, you can
ignore this warning. When you’re finished, you can run
wflow_publish
to commit the R Markdown file and build the
HTML.
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(20240617)
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 ab6400d. 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: .DS_Store
Unstaged changes:
Modified: analysis/Heatmaps.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/Heatmaps.Rmd
) and HTML
(docs/Heatmaps.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 | ab6400d | Patron | 2024-06-18 | Build and publish the website |
Rmd | a6c38f8 | Patron | 2024-06-18 | Add home, experiment, and simulation pages |
We demonstrate the ability of zinck to capture the compositional and highly sparse nature of microbiome count data by comparing the heatmaps of the original sample taxa matrix \(\mathbf{X}\) with its high quality knockoff copy, \(\tilde{\mathbf{X}}\).
We consider a toy setting with \(20\) samples and \(30\) taxa with the library size between
\(400\) and \(500\) for each sample, for a high
zero-inflation level of \(0.8\). We use
the simulateZINLDA()
function from the zinLDA
package to generate the original sample taxa matrix.
library(zinck)
library(zinLDA)
library(ggplot2)
library(reshape2)
library(gridExtra)
library(cowplot)
set.seed(1)
N.d=zinLDA::rdu(n=20,min=400,max=500) # Drawing random library sizes between 400, 500
sim_data = zinLDA::simulateZINLDA(D=20,V=30,N=N.d,K=5,Alpha=0.1,Pi=0.8,a=0.5,b=10)
X_original <- sim_data$sampleTaxaMatrix ## The original sample taxa count matrix
model_zinck <- fit.zinck(X_original, num_clusters=5, method="Gibbs", seed=1)
Theta <- model_zinck$theta
Beta <- model_zinck$beta
X_zinck <- generateKnockoff(X_original,Theta,Beta,seed=1)
rownames(X_zinck) <- rownames(X_original)
We will now visualize the heatmaps of the original matrix and its corresponding knockoff copy. The function applies an arcsinh transformation to the data for normalization and better visualization of abundance patterns and zero inflation within the sample taxa matrix.
heat1 <- draw_heatmap(X_original, "Original")
heat2 <- draw_heatmap(X_zinck, "Knockoff")
plot_grid(heat1, heat2, ncol = 2, align="v")
It is evident from the above heatmaps that the knockoff copy is almost indistinguishable from the original matrix! This underscores the fact that the knockoff copy preserves the underlying structure of the observed sample taxa count matrix.
sessionInfo()
R version 4.1.3 (2022-03-10)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Big Sur/Monterey 10.16
Matrix products: default
BLAS: /Library/Frameworks/R.framework/Versions/4.1/Resources/lib/libRblas.0.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/4.1/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.1.1 gridExtra_2.3 reshape2_1.4.4 ggplot2_3.4.2
[5] zinLDA_0.0.0.9000 zinck_0.0.0.9000 workflowr_1.7.1
loaded via a namespace (and not attached):
[1] mcmc_0.9-7 matrixStats_0.63.0 fs_1.6.2
[4] httr_1.4.6 rprojroot_2.0.3 rstan_2.21.8
[7] tools_4.1.3 bslib_0.5.0 utf8_1.2.3
[10] R6_2.5.1 DBI_1.1.3 colorspace_2.1-0
[13] withr_2.5.0 tidyselect_1.2.0 prettyunits_1.1.1
[16] processx_3.8.1 compiler_4.1.3 git2r_0.32.0
[19] glmnet_4.1-7 cli_3.6.1 quantreg_5.95
[22] SparseM_1.81 xml2_1.3.4 NLP_0.2-1
[25] slam_0.1-50 sass_0.4.6 scales_1.2.1
[28] tm_0.7-8 randomForest_4.7-1.1 callr_3.7.3
[31] pbapply_1.7-2 stringr_1.5.0 digest_0.6.31
[34] StanHeaders_2.21.0-7 rmarkdown_2.22 MCMCpack_1.6-3
[37] pkgconfig_2.0.3 htmltools_0.5.5 highr_0.10
[40] fastmap_1.1.1 rlang_1.1.1 rstudioapi_0.14
[43] shape_1.4.6 jquerylib_0.1.4 generics_0.1.3
[46] farver_2.1.1 jsonlite_1.8.5 dplyr_1.1.2
[49] inline_0.3.19 magrittr_2.0.3 modeltools_0.2-23
[52] loo_2.6.0 Matrix_1.5-1 Rcpp_1.0.10
[55] munsell_0.5.0 fansi_1.0.4 lifecycle_1.0.3
[58] stringi_1.7.12 whisker_0.4.1 yaml_2.3.7
[61] MASS_7.3-60 pkgbuild_1.4.2 plyr_1.8.8
[64] grid_4.1.3 parallel_4.1.3 promises_1.2.0.1
[67] crayon_1.5.2 lattice_0.21-8 splines_4.1.3
[70] knockoff_0.3.6 knitr_1.43 ps_1.7.5
[73] pillar_1.9.0 topicmodels_0.2-14 codetools_0.2-19
[76] stats4_4.1.3 glue_1.6.2 evaluate_0.21
[79] getPass_0.2-2 RcppParallel_5.1.7 vctrs_0.6.5
[82] httpuv_1.6.11 foreach_1.5.2 MatrixModels_0.5-1
[85] gtable_0.3.3 cachem_1.0.8 xfun_0.39
[88] coda_0.19-4 later_1.3.1 survival_3.5-5
[91] tibble_3.2.1 iterators_1.0.14