Last updated: 2023-07-09
Checks: 6 1
Knit directory: IITA_2022GS/
This reproducible R Markdown analysis was created with workflowr (version 1.7.0). 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(20230709)
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 2c06448. 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: .Rproj.user/
Unstaged changes:
Modified: analysis/02-GetBLUPS.Rmd
Modified: analysis/Imputation.Rmd
Modified: analysis/cleanTPdata.rmd
Modified: analysis/index.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/Imputation.Rmd
) and HTML
(docs/Imputation.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 | 2c06448 | LucianoRogerio | 2023-07-09 | Update Github page |
html | 2c06448 | LucianoRogerio | 2023-07-09 | Update Github page |
cp -r /home/jj332_cas/CassavaGenotypeData/CassavaGeneticMap /workdir/lbraatz/IITA_2022GS/data/.;
Impute with Beagle V5.0.
Use the “imputation reference panel” dataset from 2021 merged with the imputed GS progeny, e.g. chr1_RefPanelAndGSprogeny_ReadyForGP_2021Aug08.vcf.gz as reference for the current imputation. Downloaded from cassavabase FTP server
Used cbsumezey03 Cornell CBSU machine (e.g. cbsumezey03; 20 cores, 512 GB RAM), running 1 chromosome at a time.
targetVCFpath<-here::here("data/Report-DCas22-7004/") # location of the targetVCF
refVCFpath<-here::here("data/")
mapPath<-here::here("data/CassavaGeneticMap/")
outPath<-here::here("output/")
outSuffix<-"DCas22_7004"
library(tidyverse); library(magrittr);
library(genomicMateSelectR)
purrr::map(1:18,
~genomicMateSelectR::runBeagle5(targetVCF=paste0(targetVCFpath,"chr",.,
"_DCas22_7004.vcf.gz"),
refVCF=paste0(refVCFpath,"chr",.,
"_RefPanelAndGSprogeny_ReadyForGP_2021Aug08.vcf.gz"),
mapFile=paste0(mapPath,"chr",.,
"_cassava_cM_pred.v6_91019.map"),
outName=paste0(outPath,"chr",.,
"_DCas22_7004_WA_REFimputed"),
nthreads=20))
purrr::map(3,
~genomicMateSelectR::runBeagle5(window = 60, targetVCF=paste0(targetVCFpath,"chr",.,
"_DCas22_7004.vcf.gz"),
refVCF=paste0(refVCFpath,"chr",.,
"_RefPanelAndGSprogeny_ReadyForGP_2021Aug08.vcf.gz"),
mapFile=paste0(mapPath,"chr",.,
"_cassava_cM_pred.v6_91019.map"),
outName=paste0(outPath,"chr",.,
"_DCas22_7004_WA_REFimputed"),
nthreads=20))
Clean up Beagle log files after run. Move to sub-directory output/BeagleLogs/.
cd /workdir/lbraatz/IITA_2022GS/output/;
mkdir BeagleLogs;
cp *_DCas22_7004_WA_REFimputed.log BeagleLogs/
cp -r BeagleLogs /home/jj332_cas/lbraatz/IITA_2022GS/output/
cp *_DCas22_7004_WA_REFimputed* /home/jj332_cas/lbraatz/IITA_2022GS/output/
cp *_DCas22_7004_WA_REFimputed.vcf.gz /home/jj332_cas/lbraatz/IITA_2022GS/output/
##Post-impute filter
Standard post-imputation filter: AR2>0.75 (DR2>0.75 as of Beagle5.0), P_HWE>1e-20, MAF>0.005 [0.5%].
Loop to filter all 18 VCF files in parallel
inPath<-here::here("output/")
outPath<-here::here("output/")
require(furrr); plan(multicore, workers = 18)
future_map(1:18,
~genomicMateSelectR::postImputeFilter(inPath=inPath,
inName=paste0("chr",.,"_DCas22_7004_WA_REFimputed"),
outPath=outPath,
outName=paste0("chr",.,"_DCas22_7004_WA_REFimputedAndFiltered")))
plan(sequential)
Check what’s left
purrr::map(1:18,~system(paste0("zcat ",here::here("output/"),"chr",.,"_DCas22_7004_WA_REFimputedAndFiltered.vcf.gz | wc -l")))
# Chr01 - 7,321
# Chr02 - 3,517
# Chr03 - 3,606
# Chr04 - 3,050
# Chr05 - 3,644
# Chr06 - 3,324
# Chr07 - 1,633
# Chr08 - 3,082
# Chr09 - 3,208
# Chr10 - 2,484
# Chr11 - 2,803
# Chr12 - 2,700
# Chr13 - 2,478
# Chr14 - 4,911
# Chr15 - 3,414
# Chr16 - 2,672
# Chr17 - 2,429
# Chr18 - 2,732
cd /workdir/lbraatz/IITA_2022GS/output/;
cp -r *_DCas22_7004_WA_REFimputed* /home/jj332_cas/lbraatz/IITA_2022GS/output/
Need to create a genome-wide VCF with the RefPanel + DCas22_7004 VCFs merged.
require(furrr); plan(multicore, workers = 18)
# 1. Subset RefPanel to sites remaining after post-impute filter of DCas22_7004
future_map(1:18,~system(paste0("vcftools --gzvcf ",
"/workdir/lbraatz/IITA_2022GS/data/chr",
.,"_RefPanelAndGSprogeny_ReadyForGP_2021Aug08.vcf.gz"," ",
"--positions ","/workdir/lbraatz/IITA_2022GS/output/chr",.,
"_DCas22_7004_WA_REFimputed.sitesPassing"," ",
"--recode --stdout | bgzip -c -@ 24 > ",
"/workdir/lbraatz/IITA_2022GS/output/chr",.,
"_RefPanelAndGSprogeny2021Aug08_SubsetAndReadyToMerge.vcf.gz")))
plan(sequential)
# 2. Merge RefPanel and DCas22_7004
library(tidyverse); library(magrittr); library(genomicMateSelectR)
inPath<-here::here("output/")
outPath<-here::here("output/")
future_map(1:18,~mergeVCFs(inPath=inPath,
inVCF1=paste0("chr",.,"_RefPanelAndGSprogeny2021Aug08_SubsetAndReadyToMerge"),
inVCF2=paste0("chr",.,"_DCas22_7004_WA_REFimputedAndFiltered"),
outPath=outPath,
outName=paste0("chr",.,"_RefPanelAndGSprogeny_ReadyForGP_2022Aug03")))
# 3. Concatenate chromosomes
## Index with tabix first
future_map(1:18,~system(paste0("tabix -f -p vcf ",inPath,
"chr",.,"_RefPanelAndGSprogeny_ReadyForGP_2022Aug03.vcf.gz")))
plan(sequential)
## bcftools concat
system(paste0("bcftools concat ",
"--output ",outPath,
"AllChrom_RefPanelAndGSprogeny_ReadyForGP_2022Aug03.vcf.gz ",
"--output-type z --threads 18 ",
paste0(inPath,"chr",1:18,
"_RefPanelAndGSprogeny_ReadyForGP_2022Aug03.vcf.gz",
collapse = " ")))
## Remove the Old DS format of the VCF file
system(paste0("bcftools annotate -x ^INFO/PASS,^FORMAT/GT ",
"AllChrom_RefPanelAndGSprogeny_ReadyForGP_2022Aug03.vcf.gz | ",
"bgzip -c -@20 > ",
"AllChrom_RefPanelAndGSprogeny_ReadyForGP_2022Aug31.vcf.gz"))
## Convert to binary blink (bed/bim/fam)
inPath<-here::here("output/")
outPath<-here::here("output/")
vcfName<-"AllChrom_RefPanelAndGSprogeny_ReadyForGP_2022Aug31"
system(paste0("export PATH=/programs/plink-1.9-x86_64-beta3.30:$PATH;",
"plink --vcf ",inPath,vcfName,".vcf.gz ",
"--make-bed --const-fid --keep-allele-order ",
"--out ",outPath,vcfName))
sessionInfo()
R version 4.2.2 (2022-10-31)
Platform: aarch64-apple-darwin20 (64-bit)
Running under: macOS Ventura 13.4.1
Matrix products: default
BLAS: /Library/Frameworks/R.framework/Versions/4.2-arm64/Resources/lib/libRblas.0.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/4.2-arm64/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
loaded via a namespace (and not attached):
[1] Rcpp_1.0.11 rstudioapi_0.14 whisker_0.4.1 knitr_1.42
[5] magrittr_2.0.3 workflowr_1.7.0 R6_2.5.1 rlang_1.1.1
[9] fastmap_1.1.1 fansi_1.0.4 stringr_1.5.0 tools_4.2.2
[13] xfun_0.39 utf8_1.2.3 cli_3.6.1 git2r_0.32.0
[17] jquerylib_0.1.4 htmltools_0.5.5 rprojroot_2.0.3 yaml_2.3.7
[21] digest_0.6.33 tibble_3.2.1 lifecycle_1.0.3 later_1.3.1
[25] sass_0.4.5 vctrs_0.6.3 promises_1.2.0.1 fs_1.6.2
[29] cachem_1.0.8 glue_1.6.2 evaluate_0.21 rmarkdown_2.21
[33] stringi_1.7.12 bslib_0.4.2 compiler_4.2.2 pillar_1.9.0
[37] jsonlite_1.8.7 httpuv_1.6.9 pkgconfig_2.0.3