Last updated: 2022-08-16
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 e6092ec. 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: .Rapp.history
Ignored: .Rhistory
Ignored: .Rproj.user/
Ignored: analysis/.DS_Store
Ignored: scripts/
Untracked files:
Untracked: ._.DS_Store
Untracked: DOCNAME
Untracked: analysis/._.DS_Store
Untracked: analysis/cache/
Untracked: analysis/calc_nanoseq_metrics.Rmd
Untracked: data/._metrics.rds
Untracked: data/ecoli/
Untracked: data/metadata/
Untracked: data/metrics_efficiency_nossc.rds
Untracked: data/mixtures
Untracked: data/ref/
Untracked: prototype_code/
Unstaged changes:
Modified: analysis/ecoli_K12.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/insilico_mixtures.Rmd
) and
HTML (docs/insilico_mixtures.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 | e6092ec | Marek Cmero | 2022-08-16 | Added duplicate rate stat to 0.1% spike-in sample |
html | b524238 | Marek Cmero | 2022-05-26 | Build site. |
Rmd | afd79e5 | Marek Cmero | 2022-05-26 | Added revised model, in silico mixtures redone with 1 supporting read, added input cell estimates |
html | 39c5a18 | Marek Cmero | 2022-05-20 | Build site. |
Rmd | d97ddd6 | Marek Cmero | 2022-05-20 | Update experiment text |
html | 4499502 | Marek Cmero | 2022-05-20 | Build site. |
Rmd | 77280c2 | Marek Cmero | 2022-05-20 | Added 0.001 mix results |
html | 98aadc0 | Marek Cmero | 2022-05-20 | Build site. |
Rmd | 727938e | Marek Cmero | 2022-05-20 | Added mixture results for 0.01 and 0.05 |
html | 491e97d | Marek Cmero | 2022-05-19 | Build site. |
Rmd | 434e8b9 | Marek Cmero | 2022-05-19 | Added in silico mixtures to navigation |
html | ff1f665 | Marek Cmero | 2022-05-19 | Build site. |
Rmd | 572a31d | Marek Cmero | 2022-05-19 | Added initial results from in silico mixture experiment |
In this experiment, the duplex reads from NanoSeq MB2 rep 1 from E coli K12 was mixed in pairs (in silico) at four depths (0.1x, 1x, 5x and 10x) with the duplex reads from NanoSeq MB2 (MGI) from E coli BL21 at four depths (99.9x, 99x, 95x and 90x). Variants called required a coverage of at least 4 and at least 1 supporting variant read. There are >33k SNP and INDEL differences between the E coli species. Given the mixture and total depth we can calculate the number of SNPs that we expect to find.
library(ggplot2)
library(data.table)
library(dplyr)
library(here)
library(tibble)
library(stringr)
library(Rsamtools)
library(GenomicRanges)
library(seqinr)
library(readxl)
library(patchwork)
library(RColorBrewer)
library(UpSetR)
library(vcfR)
source(here('code/load_data.R'))
variant_dir <- here('data/mixtures/min_1_read')
var_df <- load_variants(variant_dir, c('NanoMB2-0.001', 'NanoMB2-0.01', 'NanoMB2-0.05', 'NanoMB2-0.10')) %>% calculate_vafs()
var_df$sample <- factor(var_df$sample, levels = c('NanoMB2-0.001', 'NanoMB2-0.01', 'NanoMB2-0.05', 'NanoMB2-0.10'))
NanoSeq MB2 mixes:
# NOTE: variant number obtained from nucdiff difference between two genomes
# cat G000204/workflow/jafarJ_201021_duplex/duplex-pipe/ref/nucdiff/ecoli_BL21_vs_ATCCecoli_BL21_vs_ATCC_1.snps | cut -f 1-2 | grep -v "\." | cut -f 1 | sort | uniq | wc -l
vaf_sm <- data.table(var_df)[, list(VAF_mean = mean(VAF), nvars = length(POS)), by=sample] %>%
mutate(VAF_mix = as.character(sample) %>% strsplit('-') %>% lapply(last) %>% unlist() %>% as.numeric())
vaf_sm$expected <- (1 - (1 - vaf_sm$VAF_mix) ^ 100) * 33655
print(vaf_sm)
sample VAF_mean nvars VAF_mix expected
1: NanoMB2-0.001 0.01774953 3100 0.001 3204.22
2: NanoMB2-0.01 0.01768270 18358 0.010 21336.18
3: NanoMB2-0.05 0.04655841 32537 0.050 33455.74
4: NanoMB2-0.10 0.08925551 33697 0.100 33654.11
ggplot(var_df, aes(VAF)) +
geom_histogram(bins = 50) +
theme_minimal() +
facet_wrap(~sample) +
scale_x_continuous(breaks = seq(0, 1, 0.1), limits = c(0, 1))
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] vcfR_1.12.0 UpSetR_1.4.0 RColorBrewer_1.1-3
[4] patchwork_1.1.1 readxl_1.3.1 seqinr_4.2-8
[7] Rsamtools_2.6.0 Biostrings_2.58.0 XVector_0.30.0
[10] GenomicRanges_1.42.0 GenomeInfoDb_1.26.7 IRanges_2.24.1
[13] S4Vectors_0.28.1 BiocGenerics_0.36.1 stringr_1.4.0
[16] tibble_3.1.7 here_1.0.1 dplyr_1.0.7
[19] data.table_1.14.0 ggplot2_3.3.6 workflowr_1.6.2
loaded via a namespace (and not attached):
[1] nlme_3.1-152 bitops_1.0-7 fs_1.5.0
[4] rprojroot_2.0.2 tools_4.0.5 bslib_0.3.0
[7] utf8_1.2.2 R6_2.5.1 vegan_2.5-7
[10] DBI_1.1.1 mgcv_1.8-35 colorspace_2.0-3
[13] permute_0.9-5 ade4_1.7-18 withr_2.5.0
[16] tidyselect_1.1.1 gridExtra_2.3 compiler_4.0.5
[19] git2r_0.28.0 cli_3.3.0 labeling_0.4.2
[22] sass_0.4.0 scales_1.2.0 digest_0.6.29
[25] rmarkdown_2.11 pkgconfig_2.0.3 htmltools_0.5.2
[28] fastmap_1.1.0 highr_0.9 rlang_1.0.2
[31] rstudioapi_0.13 jquerylib_0.1.4 generics_0.1.1
[34] farver_2.1.0 jsonlite_1.7.2 BiocParallel_1.24.1
[37] RCurl_1.98-1.3 magrittr_2.0.3 GenomeInfoDbData_1.2.4
[40] Matrix_1.3-2 Rcpp_1.0.7 munsell_0.5.0
[43] fansi_1.0.3 ape_5.5 lifecycle_1.0.1
[46] stringi_1.7.5 whisker_0.4 yaml_2.2.1
[49] MASS_7.3-53.1 zlibbioc_1.36.0 plyr_1.8.6
[52] pinfsc50_1.2.0 grid_4.0.5 promises_1.2.0.1
[55] crayon_1.5.1 lattice_0.20-44 splines_4.0.5
[58] knitr_1.33 pillar_1.7.0 glue_1.6.2
[61] evaluate_0.14 memuse_4.2-1 vctrs_0.4.1
[64] httpuv_1.6.3 cellranger_1.1.0 gtable_0.3.0
[67] purrr_0.3.4 assertthat_0.2.1 xfun_0.22
[70] later_1.3.0 viridisLite_0.4.0 cluster_2.1.2
[73] ellipsis_0.3.2