Last updated: 2022-02-10
Checks: 6 1
Knit directory: Serreze-T1D_Workflow/
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(20220210)
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.
Using absolute paths to the files within your workflowr project makes it difficult for you and others to run your code on a different machine. Change the absolute path(s) below to the suggested relative path(s) to make your code more reproducible.
absolute | relative |
---|---|
/Users/corneb/Documents/MyJax/CS/Projects/Serreze/qc/workflowr/Serreze-T1D_Workflow | . |
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 d199bd4. 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
Untracked files:
Untracked: analysis/0.1.1_preparing.data_bqc_4batches.Rmd
Untracked: analysis/2.1_sample_bqc_3.batches.Rmd
Untracked: analysis/2.4_preparing.data_aqc_4batches.Rmd
Untracked: analysis/4.1.1_qtl.analysis_binary_ici.vs.eoi.Rmd
Untracked: analysis/4.1.1_qtl.analysis_binary_ici.vs.pbs.Rmd
Untracked: analysis/4.1.2_qtl.analysis_cont_age_ici.vs.eoi.Rmd
Untracked: analysis/4.1.2_qtl.analysis_cont_age_ici.vs.pbs.Rmd
Untracked: analysis/4.1.2_qtl.analysis_cont_rzage_ici.vs.eoi.Rmd
Untracked: analysis/4.1.2_qtl.analysis_cont_rzage_ici.vs.pbs.Rmd
Untracked: data/GM_covar.csv
Untracked: data/bad_markers_all_4.batches.RData
Untracked: data/covar_cleaned_ici.vs.eoi.csv
Untracked: data/covar_cleaned_ici.vs.pbs.csv
Untracked: data/e.RData
Untracked: data/e_snpg_samqc_4.batches.RData
Untracked: data/e_snpg_samqc_4.batches_bc.RData
Untracked: data/errors_ind_4.batches.RData
Untracked: data/errors_ind_4.batches_bc.RData
Untracked: data/genetic_map.csv
Untracked: data/genotype_errors_marker_4.batches.RData
Untracked: data/genotype_freq_marker_4.batches.RData
Untracked: data/gm_allqc_4.batches.RData
Untracked: data/gm_samqc_3.batches.RData
Untracked: data/gm_samqc_4.batches.RData
Untracked: data/gm_samqc_4.batches_bc.RData
Untracked: data/gm_serreze.192.RData
Untracked: data/percent_missing_id_3.batches.RData
Untracked: data/percent_missing_id_4.batches.RData
Untracked: data/percent_missing_id_4.batches_bc.RData
Untracked: data/percent_missing_marker_4.batches.RData
Untracked: data/pheno.csv
Untracked: data/physical_map.csv
Untracked: data/qc_info_bad_sample_3.batches.RData
Untracked: data/qc_info_bad_sample_4.batches.RData
Untracked: data/qc_info_bad_sample_4.batches_bc.RData
Untracked: data/sample_geno.csv
Untracked: data/sample_geno_bc.csv
Untracked: data/serreze_probs.rds
Untracked: data/serreze_probs_allqc.rds
Untracked: data/summary.cg_3.batches.RData
Untracked: data/summary.cg_4.batches.RData
Untracked: data/summary.cg_4.batches_bc.RData
Untracked: output/Percent_missing_genotype_data_4.batches.pdf
Untracked: output/Proportion_matching_genotypes_before_removal_of_bad_samples_4.batches.pdf
Unstaged changes:
Modified: analysis/_site.yml
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/2.2.1_snp_qc_4.batches.Rmd
) and HTML (docs/2.2.1_snp_qc_4.batches.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 | d199bd4 | Belinda Cornes | 2022-02-10 | QC analysis |
load("data/e_snpg_samqc_4.batches.RData")
gm <- get(load("data/gm_samqc_4.batches.RData"))
gm
Object of class cross2 (crosstype "bc")
Total individuals 188
No. genotyped individuals 188
No. phenotyped individuals 188
No. with both geno & pheno 188
No. phenotypes 1
No. covariates 6
No. phenotype covariates 0
No. chromosomes 20
Total markers 133716
No. markers by chr:
1 2 3 4 5 6 7 8 9 10 11 12 13
10159 10172 7987 7736 7778 7911 7548 6561 6823 6472 7276 6226 6177
14 15 16 17 18 19 X
6082 5421 5075 5161 4682 3612 4857
It can also be useful to look at the proportion of missing genotypes by marker. Markers with a lot of missing data were likely difficult to call, and so the genotypes that were called may contain a lot of errors.
pmis_mar <- n_missing(gm, "marker", "proportion")*100
save(pmis_mar, file = "data/percent_missing_marker_4.batches.RData")
par(mar=c(5.1,0.6,0.6, 0.6))
hist(pmis_mar, breaks=seq(0, 100, length=201),
main="", yaxt="n", ylab="", xlab="Percent missing genotypes")
rug(pmis_mar)
pdf(file = "output/Percent_missing_genotype_data_per_marker.pdf")
par(mar=c(5.1,0.6,0.6, 0.6))
hist(pmis_mar, breaks=seq(0, 100, length=201),
main="", yaxt="n", ylab="", xlab="Percent missing genotypes")
rug(pmis_mar)
dev.off()
quartz_off_screen
2
count | |
---|---|
pmis_mar_5 | 3768 |
pmis_mar_10 | 2138 |
pmis_mar_15 | 1599 |
pmis_mar_25 | 1089 |
pmis_mar_50 | 368 |
pmis_mar_75 | 69 |
total_snps | 133716 |
g <- do.call("cbind", gm$geno[1:19])
#fg <- do.call("cbind", gm$founder_geno[1:19])
#g <- g[,colSums(g)!=0]
#fg <- fg[,colSums(fg==0)==0]
#fgn <- colSums(g==2)
gf_mar <- t(apply(g, 2, function(a) table(factor(a, 1:2))/sum(a != 0)))
gn_mar <- t(apply(g, 2, function(a) table(factor(a, 1:2))))
gf_mar <- gf_mar[gf_mar[,2] != "NaN",]
MAF <- apply(gf_mar, 1, function(x) min(x))
MAF <- as.data.frame(MAF)
MAF$index <- 1:nrow(gf_mar)
gf_mar_maf <- merge(gf_mar,as.data.frame(MAF), by="row.names")
gf_mar_maf <- gf_mar_maf[order(gf_mar_maf$index),]
pdf(file = "output/genotype_frequency_marker.pdf")
par(mar=c(5.1,0.6,0.6, 0.6))
hist(gf_mar_maf$MAF, breaks=seq(0, 1, length=201),
main="", yaxt="n", ylab="", xlab="MAF")
rug(gf_mar_maf$MAF)
dev.off()
quartz_off_screen
2
par(mar=c(5.1,0.6,0.6, 0.6))
hist(gf_mar_maf$MAF, breaks=seq(0, 1, length=201),
main="", yaxt="n", ylab="", xlab="MAF")
rug(gf_mar_maf$MAF)
gfmar <- NULL
gfmar$gfmar_mar_0 <- sum(gf_mar_maf$MAF==0)
gfmar$gfmar_mar_1 <- sum(gf_mar_maf$MAF< 0.01)
gfmar$gfmar_mar_5 <- sum(gf_mar_maf$MAF< 0.05)
gfmar$gfmar_mar_10 <- sum(gf_mar_maf$MAF< 0.10)
gfmar$gfmar_mar_15 <- sum(gf_mar_maf$MAF< 0.15)
gfmar$gfmar_mar_25 <- sum(gf_mar_maf$MAF< 0.25)
gfmar$gfmar_mar_50 <- sum(gf_mar_maf$MAF<= 0.50)
gfmar$total_snps <- nrow(as.data.frame(gf_mar_maf))
gfmar <- t(as.data.frame(gfmar))
gfmar <- as.data.frame(gfmar)
gfmar$count <- gfmar$V1
gfmar[c(2)] %>%
kable(escape = F,align = c("ccccccccc"),linesep ="\\hline") %>%
kable_styling(full_width = F) %>%
kable_styling("striped", full_width = F) %>%
row_spec(8 ,bold=T,color= "white",background = "black")
count | |
---|---|
gfmar_mar_0 | 84900 |
gfmar_mar_1 | 88608 |
gfmar_mar_5 | 95233 |
gfmar_mar_10 | 96232 |
gfmar_mar_15 | 96470 |
gfmar_mar_25 | 97178 |
gfmar_mar_50 | 128857 |
total_snps | 128857 |
save(gf_mar, file = "data/genotype_freq_marker_4.batches.RData")
Markers with higher rates of missing genotypes tend to show higher errors rates.
[1] 2138
[1] 88609
[1] 11032
[1] 97037
Only removing markers that are missing in at least 10% of the samples
#missing in at least 10% of the samples
gm_allqc2 <- drop_markers(gm_samqc, high_miss_bad$marker)
gm_allqc <- drop_nullmarkers(gm_allqc2)
gm_allqc
Object of class cross2 (crosstype "bc")
Total individuals 188
No. genotyped individuals 188
No. phenotyped individuals 188
No. with both geno & pheno 188
No. phenotypes 1
No. covariates 6
No. phenotype covariates 0
No. chromosomes 20
Total markers 131578
No. markers by chr:
1 2 3 4 5 6 7 8 9 10 11 12 13
9977 10005 7858 7589 7621 7758 7413 6472 6725 6396 7154 6137 6085
14 15 16 17 18 19 X
5981 5346 5019 5093 4607 3564 4778
save(gm_allqc, file = "data/gm_allqc_4.batches.RData")
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_AU.UTF-8/en_AU.UTF-8/en_AU.UTF-8/C/en_AU.UTF-8/en_AU.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] fst_0.9.2 knitr_1.33 kableExtra_1.1.0 mclust_5.4.6
[5] ggrepel_0.8.2 ggplot2_3.3.5 qtlcharts_0.11-6 qtl2_0.22
[9] broman_0.70-4 workflowr_1.6.2
loaded via a namespace (and not attached):
[1] tidyselect_1.0.0 xfun_0.24 purrr_0.3.4 colorspace_2.0-2
[5] vctrs_0.3.8 viridisLite_0.4.0 htmltools_0.5.1.1 yaml_2.2.1
[9] utf8_1.2.1 blob_1.2.1 rlang_0.4.11 later_1.0.0
[13] pillar_1.6.1 glue_1.4.2 withr_2.4.2 DBI_1.1.1
[17] bit64_4.0.5 lifecycle_1.0.0 stringr_1.4.0 munsell_0.5.0
[21] gtable_0.3.0 rvest_0.3.5 memoise_2.0.0 evaluate_0.14
[25] fastmap_1.1.0 httpuv_1.5.2 parallel_3.6.2 fansi_0.5.0
[29] highr_0.9 Rcpp_1.0.7 readr_1.3.1 promises_1.1.0
[33] backports_1.2.1 scales_1.1.1 cachem_1.0.5 webshot_0.5.2
[37] fs_1.4.1 bit_4.0.4 hms_0.5.3 digest_0.6.27
[41] stringi_1.7.2 dplyr_0.8.5 grid_3.6.2 rprojroot_1.3-2
[45] tools_3.6.2 magrittr_2.0.1 RSQLite_2.2.7 tibble_3.1.2
[49] crayon_1.4.1 whisker_0.4 pkgconfig_2.0.3 ellipsis_0.3.2
[53] xml2_1.3.1 data.table_1.14.0 httr_1.4.1 rstudioapi_0.13
[57] assertthat_0.2.1 rmarkdown_2.1 qtl_1.46-2 R6_2.5.0
[61] git2r_0.26.1 compiler_3.6.2