Last updated: 2021-08-09
Checks: 7 0
Knit directory: IITA_2021GS/
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(20210504)
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 6f2057f. 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: analysis/.DS_Store
Ignored: data/.DS_Store
Ignored: output/.DS_Store
Untracked files:
Untracked: IITA_2021GS.Rproj
Untracked: code/convertDart2vcf.R
Untracked: code/imputationFunctions.R
Untracked: data/DatabaseDownload_2021Aug08/
Untracked: data/DatabaseDownload_2021May04/
Untracked: data/GBSdataMasterList_31818.csv
Untracked: data/IITA_GBStoPhenoMaster_33018.csv
Untracked: data/NRCRI_GBStoPhenoMaster_40318.csv
Untracked: data/PedigreeGeneticGainCycleTime_aafolabi_01122020.xls
Untracked: data/Report-DCas21-6038/
Untracked: data/chr1_RefPanelAndGSprogeny_ReadyForGP_72719.fam
Untracked: output/IITA_CleanedTrialData_2021Aug08.rds
Untracked: output/IITA_trials_NOT_identifiable.csv
Untracked: output/maxNOHAV_byStudy.csv
Unstaged changes:
Modified: analysis/05-CrossValidation.Rmd
Modified: analysis/06-GenomicPredictions.Rmd
Modified: analysis/07-Results.Rmd
Deleted: analysis/inputsForSimulation.Rmd
Deleted: implementGMSinCassava.Rproj
Deleted: output/README.md
Deleted: output/cvAD_5rep5fold_predAccuracy.rds
Deleted: output/cvDirDom_5rep5fold_predAccuracy.rds
Deleted: output/estimateSelectionError.rds
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/ImputeDCas21_6038.Rmd
) and HTML (docs/ImputeDCas21_6038.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 | 6f2057f | wolfemd | 2021-08-09 | Publish project. Imputation completed. Run and complete ‘cleanTPdata’ step. |
Copy the imputation reference panel from 2019 to the data/
folder.
mkdir /workdir/mw489/;
cp -r ~/IITA_2021GS /workdir/mw489/;
cp -r /home/jj332_cas/CassavaGenotypeData/CassavaGeneticMap /workdir/mw489/IITA_2021GS/data/;
cp /home/jj332_cas/CassavaGenotypeData/nextgenImputation2019/ImputationStageIII_72619/chr*_RefPanelAndGSprogeny_ReadyForGP_72719.vcf.gz /workdir/mw489/IITA_2021GS/data/;
Impute with Beagle V5.0.
Use the “imputation reference panel” dataset from 2019 merged with the imputed GS progeny TMS13-14-15 + TMS18, e.g. chr1_RefPanelAndGSprogeny_ReadyForGP_72719.vcf.gz
as reference for the current imputation.
Used 1 large memory Cornell CBSU machine (e.g. cbsulm17; 112 cores, 512 GB RAM), running 1 chromosome at a time.
# 1) start a screen shell
screen; # or screen -r if re-attaching...
# Project directory, so R will use as working dir.
cd /workdir/mw489/IITA_2021GS/
# 3) Start R
R
<-here::here("data/Report-DCas21-6038/") # location of the targetVCF
targetVCFpath<-here::here("data/")
refVCFpath<-here::here("data/CassavaGeneticMap/")
mapPath<-here::here("output/")
outPath<-"DCas21_6038" outSuffix
library(tidyverse); library(magrittr);
library(genomicMateSelectR)
::map(1:18,
purrr~genomicMateSelectR::runBeagle5(targetVCF=paste0(targetVCFpath,"chr",.,
"_DCas21_6038.vcf.gz"),
refVCF=paste0(refVCFpath,"chr",.,
"_RefPanelAndGSprogeny_ReadyForGP_72719.vcf.gz"),
mapFile=paste0(mapPath,"chr",.,
"_cassava_cM_pred.v6_91019.map"),
outName=paste0(outPath,"chr",.,
"_DCas21_6038_WA_REFimputed"),
nthreads=112))
Clean up Beagle log files after run. Move to sub-directory output/BeagleLogs/
.
cd /workdir/mw489/IITA_2021GS/output/;
mkdir BeagleLogs;
cp *_DCas21_6038_WA_REFimputed.log BeagleLogs/
cp -r BeagleLogs ~/IITA_2021GS/output/
cp *_DCas21_6038_WA_REFimputed* ~/IITA_2021GS/output/
cp *_DCas21_6038_WA_REFimputed.vcf.gz ~/IITA_2021GS/output/
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
<-here::here("output/")
inPath<-here::here("output/")
outPathrequire(furrr); plan(multisession, workers = 18)
future_map(1:18,
~genomicMateSelectR::postImputeFilter(inPath=inPath,
inName=paste0("chr",.,"_DCas21_6038_WA_REFimputed"),
outPath=outPath,
outName=paste0("chr",.,"_DCas21_6038_WA_REFimputedAndFiltered")))
plan(sequential)
Check what’s left
::map(1:18,~system(paste0("zcat ",here::here("output/"),"chr",.,"_DCas21_6038_WA_REFimputedAndFiltered.vcf.gz | wc -l")))
purrr# 7580
# 3604
# 3685
# 3411
# 3721
# 3349
# 1716
# 3151
# 3286
# 2635
# 2897
# 2745
# 2625
# 5219
# 3519
# 2751
# 2612
# 2913
cd /workdir/mw489/IITA_2021GS/output/;
cp -r *_DCas21_6038_WA_REFimputed* ~/IITA_2021GS/output/
Need to create a genome-wide VCF with the RefPanel + DCas21_6038 VCFs merged.
The downstream preprocessing steps in the pipeline will take that as input to create haplotype and dosage matrices, etc.
cd /workdir/mw489/IITA_2021GS/
R;
require(furrr); plan(multisession, workers = 18)
# 1. Subset RefPanel to sites remaining after post-impute filter of DCas21_6038
future_map(1:18,~system(paste0("vcftools --gzvcf ","/workdir/mw489/IITA_2021GS/data/chr",
"_RefPanelAndGSprogeny_ReadyForGP_72719.vcf.gz"," ",
.,"--positions ","/workdir/mw489/IITA_2021GS/data/chr",.,
"_DCas21_6038_WA_REFimputed.sitesPassing"," ",
"--recode --stdout | bgzip -c -@ 24 > ",
"/workdir/mw489/IITA_2021GS/output/chr",.,
"_RefPanelAndGSprogeny72719_SubsetAndReadyToMerge.vcf.gz")))
plan(sequential)
# 2. Merge RefPanel and DCas21_6038
library(tidyverse); library(magrittr); library(genomicMateSelectR)
<-here::here("output/")
inPath<-here::here("output/")
outPathfuture_map(1:18,~mergeVCFs(inPath=inPath,
inVCF1=paste0("chr",.,"_RefPanelAndGSprogeny72719_SubsetAndReadyToMerge"),
inVCF2=paste0("chr",.,"_DCas21_6038_WA_REFimputedAndFiltered"),
outPath=outPath,
outName=paste0("chr",.,"_RefPanelAndGSprogeny_ReadyForGP_2021Aug08")))
# 3. Concatenate chromosomes
## Index with tabix first
future_map(1:18,~system(paste0("tabix -f -p vcf ",inPath,
"chr",.,"_RefPanelAndGSprogeny_ReadyForGP_2021Aug08.vcf.gz")))
plan(sequential)
## bcftools concat
system(paste0("bcftools concat ",
"--output ",outPath,
"AllChrom_RefPanelAndGSprogeny_ReadyForGP_2021Aug08.vcf.gz ",
"--output-type z --threads 18 ",
paste0(inPath,"chr",1:18,
"_RefPanelAndGSprogeny_ReadyForGP_2021Aug08.vcf.gz",
collapse = " ")))
cd /workdir/mw489/IITA_2021GS/output/
cp *_RefPanelAndGSprogeny_ReadyForGP_2021Aug08* ~/IITA_2021GS/output/
# vcftools --gzvcf AllChrom_RefPanelAndGSprogeny_ReadyForGP_2021Aug08.vcf.gz
# After filtering, kept 23332 out of 23332 Individuals
# After filtering, kept 61239 out of a possible 61239 Sites
Prepare training dataset: Download data from DB, “Clean” and format DB data.
Get BLUPs combining all trial data: Combine data from all trait-trials to get BLUPs for downstream genomic prediction. Fit mixed-model to multi-trial dataset and extract BLUPs, de-regressed BLUPs and weights. Include two rounds of outlier removal.
[uses imputed data as input] Validate the pedigree obtained from cassavabase: Before setting up a cross-validation scheme for predictions that depend on a correct pedigree, add a basic verification step to the pipeline. Not trying to fill unknown relationships or otherwise correct the pedigree. Assess evidence that relationship is correct, remove if incorrect.
[uses imputed data as input] Preprocess data files: Prepare haplotype and dosage matrices, GRMs, pedigree and BLUPs, genetic map and recombination frequency matrix, for use in predictions.
sessionInfo()