Last updated: 2022-03-10
Checks: 7 0
Knit directory: rare-mutation-detection/
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(20210916)
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 29f268f. 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
Ignored: .Rhistory
Ignored: .Rproj.user/
Ignored: scripts/
Untracked files:
Untracked: ._.DS_Store
Untracked: DOCNAME
Untracked: analysis/cache/
Untracked: analysis/calc_nanoseq_metrics.Rmd
Untracked: data/
Untracked: prototype_code/
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/compare_MGI_Illumina.Rmd
) and HTML (docs/compare_MGI_Illumina.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 | 29f268f | Marek Cmero | 2022-03-10 | Rebuild |
html | 5fd8f9a | Marek Cmero | 2022-03-10 | Build site. |
Rmd | b257d52 | Marek Cmero | 2022-03-10 | Added MGI vs. Illumina comparison; refactoring ecoli.Rmd code |
Compare duplex statistics for two libraries, one MGI and one Illumina, containing the same samples.
library(ggplot2)
library(data.table)
library(dplyr)
library(here)
library(tibble)
library(stringr)
library(Rsamtools)
library(GenomicRanges)
library(seqinr)
source(here('code/load_data.R'))
source(here('code/efficiency_nanoseq_functions.R'))
# Ecoli genome max size
genome_max <- 4528118
# directory paths
genomeFile <- here('data/ref/Ecoli_strain_BL21_genome.fasta')
ill_rinfo_dir <- here('data/ecoli/jafarJ_201021/QC/read_info')
ill_markdup_dir <- here('data/ecoli/jafarJ_201021/QC/mark_duplicates')
mgi_rinfo_dir <- here('data/ecoli/jafarJ_150222/QC/read_info')
mgi_markdup_dir <- here('data/ecoli/jafarJ_150222/QC/mark_duplicates')
# load and transform read barcode data
ill_rbs <- load_rbs_data(ill_rinfo_dir)
ill_sample_names <- list.files(ill_rinfo_dir) %>%
str_split('\\.txt.gz') %>%
lapply(., dplyr::first) %>%
unlist() %>%
str_split('_') %>%
lapply(., dplyr::first) %>%
unlist()
names(ill_rbs) <- ill_sample_names
mgi_rbs <- load_rbs_data(mgi_rinfo_dir)
mgi_sample_names <- list.files(mgi_rinfo_dir) %>%
str_split('\\.txt.gz') %>%
lapply(., dplyr::first) %>% unlist()
names(mgi_rbs) <- mgi_sample_names
# load and fetch duplicate rate from MarkDuplicates output
ill_mdup <- load_markdup_data(ill_markdup_dir, ill_sample_names)
mgi_mdup <- load_markdup_data(mgi_markdup_dir, mgi_sample_names)
# Nan metrics
rlen <- 151; skips <- 5
ill_metrics <- calculate_metrics(head(ill_rbs, 4))
mgi_metrics <- calculate_metrics(head(mgi_rbs, 3))
# Nuxg metrics
rlen <- 151; skips <- 8
ill_metrics <- rbind(ill_metrics,
calculate_metrics(tail(ill_rbs, 4)))
mgi_metrics <- rbind(mgi_metrics,
calculate_metrics(tail(mgi_rbs, 4)))
ill_metrics$duplicate_rate <- as.numeric(ill_mdup)
mgi_metrics$duplicate_rate <- as.numeric(mgi_mdup)
mm <- rbind(data.frame(melt(ill_metrics), platform = "Illumina"),
data.frame(melt(mgi_metrics), platform = "MGI"))
metrics <- as.character(mm$variable) %>% unique()
for(metric in metrics) {
p <- ggplot(mm[mm$variable == metric,], aes(sample, value, fill=platform)) +
geom_histogram(stat = 'identity', position = 'dodge') +
theme_bw() +
coord_flip() +
scale_fill_brewer(palette = 'Accent') +
ggtitle(metric)
show(p)
}
sessionInfo()
R version 4.0.5 (2021-03-31)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: CentOS Linux 7 (Core)
Matrix products: default
BLAS: /stornext/System/data/apps/R/R-4.0.5/lib64/R/lib/libRblas.so
LAPACK: /stornext/System/data/apps/R/R-4.0.5/lib64/R/lib/libRlapack.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 parallel stats graphics grDevices utils datasets
[8] methods base
other attached packages:
[1] seqinr_4.2-8 Rsamtools_2.6.0 Biostrings_2.58.0
[4] XVector_0.30.0 GenomicRanges_1.42.0 GenomeInfoDb_1.26.7
[7] IRanges_2.24.1 S4Vectors_0.28.1 BiocGenerics_0.36.1
[10] stringr_1.4.0 tibble_3.1.5 here_1.0.1
[13] dplyr_1.0.7 data.table_1.14.0 ggplot2_3.3.5
[16] workflowr_1.6.2
loaded via a namespace (and not attached):
[1] Rcpp_1.0.7 assertthat_0.2.1 rprojroot_2.0.2
[4] digest_0.6.27 utf8_1.2.2 plyr_1.8.6
[7] R6_2.5.1 evaluate_0.14 highr_0.9
[10] pillar_1.6.4 zlibbioc_1.36.0 rlang_0.4.12
[13] whisker_0.4 jquerylib_0.1.4 R.oo_1.24.0
[16] R.utils_2.11.0 rmarkdown_2.11 labeling_0.4.2
[19] BiocParallel_1.24.1 RCurl_1.98-1.3 munsell_0.5.0
[22] compiler_4.0.5 httpuv_1.6.3 xfun_0.22
[25] pkgconfig_2.0.3 htmltools_0.5.2 tidyselect_1.1.1
[28] GenomeInfoDbData_1.2.4 fansi_0.5.0 crayon_1.4.2
[31] withr_2.4.2 later_1.3.0 R.methodsS3_1.8.1
[34] MASS_7.3-53.1 bitops_1.0-7 grid_4.0.5
[37] jsonlite_1.7.2 gtable_0.3.0 lifecycle_1.0.1
[40] DBI_1.1.1 git2r_0.28.0 magrittr_2.0.1
[43] scales_1.1.1 stringi_1.7.5 farver_2.1.0
[46] reshape2_1.4.4 fs_1.5.0 promises_1.2.0.1
[49] bslib_0.3.0 ellipsis_0.3.2 generics_0.1.1
[52] vctrs_0.3.8 RColorBrewer_1.1-2 tools_4.0.5
[55] ade4_1.7-18 glue_1.4.2 purrr_0.3.4
[58] fastmap_1.1.0 yaml_2.2.1 colorspace_2.0-0
[61] knitr_1.33 sass_0.4.0