Last updated: 2024-11-06
Checks: 7 0
Knit directory: DEanalysis/
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.
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(20230508)
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 1d3fc6c. 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/
Ignored: data/.Rhistory
Untracked files:
Untracked: .DS_Store
Untracked: .gitignore
Untracked: analysis/analysis_humanspine.Rmd
Untracked: analysis/simulation_donor_effect.Rmd
Untracked: data/.DS_Store
Untracked: data/10X_inputdata.RData
Untracked: data/10X_inputdata_cpm.RData
Untracked: data/10X_inputdata_integrated.RData
Untracked: data/10X_inputdata_lognorm.RData
Untracked: data/10Xdata_annotate.rds
Untracked: data/Bcells.Rmd
Untracked: data/Bcellsce.rds
Untracked: data/Kang_DEresult.RData
Untracked: data/Kang_data.RData
Untracked: data/fallopian_DEresult.RData
Untracked: data/fallopian_tubes.RData
Untracked: data/fallopian_tubes_all.RData
Untracked: data/human/
Untracked: data/human_spine.RData
Untracked: data/human_spine_DEresult.RData
Untracked: data/ls_offset_Result.RData
Untracked: data/mouse/
Untracked: data/permutation.RData
Untracked: data/permutation13.RData
Untracked: data/permutation2.RData
Untracked: data/splatter_simulation.RData
Untracked: data/vstcounts.Rdata
Untracked: figure/
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/new_criteria.Rmd
) and HTML
(docs/new_criteria.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 | 1d3fc6c | C-HW | 2024-11-06 | add heatmaps |
html | 2b2e6c4 | C-HW | 2024-11-06 | Build site. |
Rmd | c36ad32 | C-HW | 2024-11-06 | add heatmaps |
html | 549857a | C-HW | 2023-12-01 | Build site. |
html | 3370d0d | C-HW | 2023-12-01 | Build site. |
html | 688fbb4 | C-HW | 2023-12-01 | html |
Rmd | c88d389 | C-HW | 2023-12-01 | heatmap color |
Rmd | ecc86c5 | C-HW | 2023-12-01 | update new criteria |
Rmd | 3803697 | C-HW | 2023-12-01 | upload rmd |
html | 13d726d | C-HW | 2023-05-18 | add DE results on different groups |
html | fc9f4b6 | C-HW | 2023-05-18 | add new_criteria |
If there is a statistically significant difference or change in read counts or expression levels between two experimental conditions, a gene is considered as differentially expressed. In current gene DE analysis, the criteria is based on statistical significance \(-\log_{10}\text{(p-value)}\) and magnitude of change \(\log_{2}\text{(fold change)}\). A volcano plot is commonly used to visualize the result.
Here’s the volcano plot for the DE analysis on group2 and group19. The thresholds for adjusted p-values and fold changes are \(0.05\) and \(1.5\), respectively. There are \(608\) genes identified as hits based on the criteria.
In scRNA data, lots of mean counts are extremely close to zero. In this case, the fold change can be less meaningful to characterize the difference of read counts. For example, the gene means can be \(2^{-3}\) and \(1.5*2^{-3}\) in two groups. Even though it passes the threshold for fold changes\((1.5)\), the absolute difference is only \(0.0625\). it doesn’t provide the same strength of evidence in absolute difference compared to genes with larger means.
From the scatter plot below, current criteria would select genes with small means. And these genes usually have smaller values in log2 mean difference \((\log_2|\text{mean1-mean2}|)\).
Let’s make some heatmaps to see the read counts of DE genes with different range of mean.
To rule out the genes with smaller means, we can add a filter on the previous criteria. If the gene mean doesn’t pass the threshold, then it can’t be counted as a DE gene. From the heatmaps shown above, we set the default threshold at \(-2.25\) for the average log2mean in two different groups \((\frac{\log_2\text{mean1}+\log_2\text{mean2}}{2})\).
The heatmaps also tell us we might miss out some genes that have smaller genes but large absolute difference. To save the genes, we allow the genes with log2 mean difference greater than \(-1\) to pass the filter as well.
Here’s the volcano plot and scatter plot based on the new criteria.
Version | Author | Date |
---|---|---|
dd47fda | C-HW | 2023-12-01 |
R version 4.4.1 (2024-06-14)
Platform: x86_64-apple-darwin20
Running under: macOS Monterey 12.6
Matrix products: default
BLAS: /Library/Frameworks/R.framework/Versions/4.4-x86_64/Resources/lib/libRblas.0.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/4.4-x86_64/Resources/lib/libRlapack.dylib; LAPACK version 3.12.0
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
time zone: America/Chicago
tzcode source: internal
attached base packages:
[1] stats4 stats graphics grDevices utils datasets methods
[8] base
other attached packages:
[1] SeuratObject_5.0.2 sp_2.1-4
[3] gridExtra_2.3 pheatmap_1.0.12
[5] SingleCellExperiment_1.26.0 SummarizedExperiment_1.34.0
[7] Biobase_2.64.0 GenomicRanges_1.56.2
[9] GenomeInfoDb_1.40.1 IRanges_2.38.1
[11] S4Vectors_0.42.1 BiocGenerics_0.50.0
[13] MatrixGenerics_1.16.0 matrixStats_1.4.1
[15] ggpubr_0.6.0 dplyr_1.1.4
[17] ggplot2_3.5.1
loaded via a namespace (and not attached):
[1] tidyselect_1.2.1 farver_2.1.2 fastmap_1.2.0
[4] promises_1.3.0 dotCall64_1.2 digest_0.6.37
[7] lifecycle_1.0.4 magrittr_2.0.3 compiler_4.4.1
[10] rlang_1.1.4 sass_0.4.9 tools_4.4.1
[13] utf8_1.2.4 yaml_2.3.10 knitr_1.48
[16] ggsignif_0.6.4 labeling_0.4.3 S4Arrays_1.4.1
[19] DelayedArray_0.30.1 RColorBrewer_1.1-3 abind_1.4-8
[22] workflowr_1.7.1 withr_3.0.1 purrr_1.0.2
[25] grid_4.4.1 fansi_1.0.6 git2r_0.35.0
[28] colorspace_2.1-1 future_1.34.0 progressr_0.14.0
[31] globals_0.16.3 scales_1.3.0 cli_3.6.3
[34] rmarkdown_2.28 crayon_1.5.3 generics_0.1.3
[37] future.apply_1.11.2 rstudioapi_0.17.0 httr_1.4.7
[40] cachem_1.1.0 stringr_1.5.1 zlibbioc_1.50.0
[43] parallel_4.4.1 XVector_0.44.0 vctrs_0.6.5
[46] Matrix_1.7-1 jsonlite_1.8.9 carData_3.0-5
[49] car_3.1-3 rstatix_0.7.2 Formula_1.2-5
[52] listenv_0.9.1 tidyr_1.3.1 jquerylib_0.1.4
[55] spam_2.11-0 parallelly_1.38.0 glue_1.8.0
[58] codetools_0.2-20 stringi_1.8.4 gtable_0.3.5
[61] later_1.3.2 UCSC.utils_1.0.0 munsell_0.5.1
[64] tibble_3.2.1 pillar_1.9.0 htmltools_0.5.8.1
[67] GenomeInfoDbData_1.2.12 R6_2.5.1 rprojroot_2.0.4
[70] evaluate_1.0.1 lattice_0.22-6 highr_0.11
[73] backports_1.5.0 broom_1.0.7 httpuv_1.6.15
[76] bslib_0.8.0 Rcpp_1.0.13 SparseArray_1.4.8
[79] whisker_0.4.1 xfun_0.48 fs_1.6.4
[82] pkgconfig_2.0.3