Last updated: 2021-05-05

Checks: 7 0

Knit directory: NRCRI_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(20210427) 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 94ec811. 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:    data/.DS_Store

Untracked files:
    Untracked:  code/convertDart2vcf.R
    Untracked:  code/gsFunctions.R
    Untracked:  code/imputationFunctions.R
    Untracked:  data/DatabaseDownload_2021April29/
    Untracked:  data/GBSdataMasterList_31818.csv
    Untracked:  data/IITA_GBStoPhenoMaster_33018.csv
    Untracked:  data/NRCRI_GBStoPhenoMaster_40318.csv
    Untracked:  data/Report-DCas21-5841/
    Untracked:  data/chr1_RefPanelAndGSprogeny_ReadyForGP_72719.fam
    Untracked:  output/BeagleLogs/
    Untracked:  output/DosageMatrix_DCas21_5841_WA_REFimputedAndFiltered.rds
    Untracked:  output/DosageMatrix_NRCRI_2021May03.rds
    Untracked:  output/GEBV_NRCRI_ModelA_2021May03.csv
    Untracked:  output/GETGV_NRCRI_ModelADE_2021May03.csv
    Untracked:  output/Kinship_AD_NRCRI_2021May03.rds
    Untracked:  output/Kinship_A_NRCRI_2021May03.rds
    Untracked:  output/Kinship_D_NRCRI_2021May03.rds
    Untracked:  output/NRCRI_CleanedTrialData_2021May03.rds
    Untracked:  output/NRCRI_ExptDesignsDetected_2021May03.rds
    Untracked:  output/NRCRI_blupsForModelTraining_twostage_asreml_2021May03.rds
    Untracked:  output/NRCRI_trials_NOT_identifiable.csv
    Untracked:  output/OnlyChosen_germplasmName_to_FullSampleName_matches_NRCRI_2021May03.csv
    Untracked:  output/chr10_DCas21_5841_WA_REFimputed.INFO
    Untracked:  output/chr10_DCas21_5841_WA_REFimputed.hwe
    Untracked:  output/chr10_DCas21_5841_WA_REFimputed.log
    Untracked:  output/chr10_DCas21_5841_WA_REFimputed.sitesPassing
    Untracked:  output/chr10_DCas21_5841_WA_REFimputed.vcf.gz
    Untracked:  output/chr10_DCas21_5841_WA_REFimputedAndFiltered.alleleToCount
    Untracked:  output/chr10_DCas21_5841_WA_REFimputedAndFiltered.bed
    Untracked:  output/chr10_DCas21_5841_WA_REFimputedAndFiltered.bim
    Untracked:  output/chr10_DCas21_5841_WA_REFimputedAndFiltered.fam
    Untracked:  output/chr10_DCas21_5841_WA_REFimputedAndFiltered.log
    Untracked:  output/chr10_DCas21_5841_WA_REFimputedAndFiltered.nosex
    Untracked:  output/chr10_DCas21_5841_WA_REFimputedAndFiltered.raw
    Untracked:  output/chr10_DCas21_5841_WA_REFimputedAndFiltered.sitesWithAlleles
    Untracked:  output/chr10_DCas21_5841_WA_REFimputedAndFiltered.vcf.gz
    Untracked:  output/chr11_DCas21_5841_WA_REFimputed.INFO
    Untracked:  output/chr11_DCas21_5841_WA_REFimputed.hwe
    Untracked:  output/chr11_DCas21_5841_WA_REFimputed.log
    Untracked:  output/chr11_DCas21_5841_WA_REFimputed.sitesPassing
    Untracked:  output/chr11_DCas21_5841_WA_REFimputed.vcf.gz
    Untracked:  output/chr11_DCas21_5841_WA_REFimputedAndFiltered.alleleToCount
    Untracked:  output/chr11_DCas21_5841_WA_REFimputedAndFiltered.bed
    Untracked:  output/chr11_DCas21_5841_WA_REFimputedAndFiltered.bim
    Untracked:  output/chr11_DCas21_5841_WA_REFimputedAndFiltered.fam
    Untracked:  output/chr11_DCas21_5841_WA_REFimputedAndFiltered.log
    Untracked:  output/chr11_DCas21_5841_WA_REFimputedAndFiltered.nosex
    Untracked:  output/chr11_DCas21_5841_WA_REFimputedAndFiltered.raw
    Untracked:  output/chr11_DCas21_5841_WA_REFimputedAndFiltered.sitesWithAlleles
    Untracked:  output/chr11_DCas21_5841_WA_REFimputedAndFiltered.vcf.gz
    Untracked:  output/chr12_DCas21_5841_WA_REFimputed.INFO
    Untracked:  output/chr12_DCas21_5841_WA_REFimputed.hwe
    Untracked:  output/chr12_DCas21_5841_WA_REFimputed.log
    Untracked:  output/chr12_DCas21_5841_WA_REFimputed.sitesPassing
    Untracked:  output/chr12_DCas21_5841_WA_REFimputed.vcf.gz
    Untracked:  output/chr12_DCas21_5841_WA_REFimputedAndFiltered.alleleToCount
    Untracked:  output/chr12_DCas21_5841_WA_REFimputedAndFiltered.bed
    Untracked:  output/chr12_DCas21_5841_WA_REFimputedAndFiltered.bim
    Untracked:  output/chr12_DCas21_5841_WA_REFimputedAndFiltered.fam
    Untracked:  output/chr12_DCas21_5841_WA_REFimputedAndFiltered.log
    Untracked:  output/chr12_DCas21_5841_WA_REFimputedAndFiltered.nosex
    Untracked:  output/chr12_DCas21_5841_WA_REFimputedAndFiltered.raw
    Untracked:  output/chr12_DCas21_5841_WA_REFimputedAndFiltered.sitesWithAlleles
    Untracked:  output/chr12_DCas21_5841_WA_REFimputedAndFiltered.vcf.gz
    Untracked:  output/chr13_DCas21_5841_WA_REFimputed.INFO
    Untracked:  output/chr13_DCas21_5841_WA_REFimputed.hwe
    Untracked:  output/chr13_DCas21_5841_WA_REFimputed.log
    Untracked:  output/chr13_DCas21_5841_WA_REFimputed.sitesPassing
    Untracked:  output/chr13_DCas21_5841_WA_REFimputed.vcf.gz
    Untracked:  output/chr13_DCas21_5841_WA_REFimputedAndFiltered.alleleToCount
    Untracked:  output/chr13_DCas21_5841_WA_REFimputedAndFiltered.bed
    Untracked:  output/chr13_DCas21_5841_WA_REFimputedAndFiltered.bim
    Untracked:  output/chr13_DCas21_5841_WA_REFimputedAndFiltered.fam
    Untracked:  output/chr13_DCas21_5841_WA_REFimputedAndFiltered.log
    Untracked:  output/chr13_DCas21_5841_WA_REFimputedAndFiltered.nosex
    Untracked:  output/chr13_DCas21_5841_WA_REFimputedAndFiltered.raw
    Untracked:  output/chr13_DCas21_5841_WA_REFimputedAndFiltered.sitesWithAlleles
    Untracked:  output/chr13_DCas21_5841_WA_REFimputedAndFiltered.vcf.gz
    Untracked:  output/chr14_DCas21_5841_WA_REFimputed.INFO
    Untracked:  output/chr14_DCas21_5841_WA_REFimputed.hwe
    Untracked:  output/chr14_DCas21_5841_WA_REFimputed.log
    Untracked:  output/chr14_DCas21_5841_WA_REFimputed.sitesPassing
    Untracked:  output/chr14_DCas21_5841_WA_REFimputed.vcf.gz
    Untracked:  output/chr14_DCas21_5841_WA_REFimputedAndFiltered.alleleToCount
    Untracked:  output/chr14_DCas21_5841_WA_REFimputedAndFiltered.bed
    Untracked:  output/chr14_DCas21_5841_WA_REFimputedAndFiltered.bim
    Untracked:  output/chr14_DCas21_5841_WA_REFimputedAndFiltered.fam
    Untracked:  output/chr14_DCas21_5841_WA_REFimputedAndFiltered.log
    Untracked:  output/chr14_DCas21_5841_WA_REFimputedAndFiltered.nosex
    Untracked:  output/chr14_DCas21_5841_WA_REFimputedAndFiltered.raw
    Untracked:  output/chr14_DCas21_5841_WA_REFimputedAndFiltered.sitesWithAlleles
    Untracked:  output/chr14_DCas21_5841_WA_REFimputedAndFiltered.vcf.gz
    Untracked:  output/chr15_DCas21_5841_WA_REFimputed.INFO
    Untracked:  output/chr15_DCas21_5841_WA_REFimputed.hwe
    Untracked:  output/chr15_DCas21_5841_WA_REFimputed.log
    Untracked:  output/chr15_DCas21_5841_WA_REFimputed.sitesPassing
    Untracked:  output/chr15_DCas21_5841_WA_REFimputed.vcf.gz
    Untracked:  output/chr15_DCas21_5841_WA_REFimputedAndFiltered.alleleToCount
    Untracked:  output/chr15_DCas21_5841_WA_REFimputedAndFiltered.bed
    Untracked:  output/chr15_DCas21_5841_WA_REFimputedAndFiltered.bim
    Untracked:  output/chr15_DCas21_5841_WA_REFimputedAndFiltered.fam
    Untracked:  output/chr15_DCas21_5841_WA_REFimputedAndFiltered.log
    Untracked:  output/chr15_DCas21_5841_WA_REFimputedAndFiltered.nosex
    Untracked:  output/chr15_DCas21_5841_WA_REFimputedAndFiltered.raw
    Untracked:  output/chr15_DCas21_5841_WA_REFimputedAndFiltered.sitesWithAlleles
    Untracked:  output/chr15_DCas21_5841_WA_REFimputedAndFiltered.vcf.gz
    Untracked:  output/chr16_DCas21_5841_WA_REFimputed.INFO
    Untracked:  output/chr16_DCas21_5841_WA_REFimputed.hwe
    Untracked:  output/chr16_DCas21_5841_WA_REFimputed.log
    Untracked:  output/chr16_DCas21_5841_WA_REFimputed.sitesPassing
    Untracked:  output/chr16_DCas21_5841_WA_REFimputed.vcf.gz
    Untracked:  output/chr16_DCas21_5841_WA_REFimputedAndFiltered.alleleToCount
    Untracked:  output/chr16_DCas21_5841_WA_REFimputedAndFiltered.bed
    Untracked:  output/chr16_DCas21_5841_WA_REFimputedAndFiltered.bim
    Untracked:  output/chr16_DCas21_5841_WA_REFimputedAndFiltered.fam
    Untracked:  output/chr16_DCas21_5841_WA_REFimputedAndFiltered.log
    Untracked:  output/chr16_DCas21_5841_WA_REFimputedAndFiltered.nosex
    Untracked:  output/chr16_DCas21_5841_WA_REFimputedAndFiltered.raw
    Untracked:  output/chr16_DCas21_5841_WA_REFimputedAndFiltered.sitesWithAlleles
    Untracked:  output/chr16_DCas21_5841_WA_REFimputedAndFiltered.vcf.gz
    Untracked:  output/chr17_DCas21_5841_WA_REFimputed.INFO
    Untracked:  output/chr17_DCas21_5841_WA_REFimputed.hwe
    Untracked:  output/chr17_DCas21_5841_WA_REFimputed.log
    Untracked:  output/chr17_DCas21_5841_WA_REFimputed.sitesPassing
    Untracked:  output/chr17_DCas21_5841_WA_REFimputed.vcf.gz
    Untracked:  output/chr17_DCas21_5841_WA_REFimputedAndFiltered.alleleToCount
    Untracked:  output/chr17_DCas21_5841_WA_REFimputedAndFiltered.bed
    Untracked:  output/chr17_DCas21_5841_WA_REFimputedAndFiltered.bim
    Untracked:  output/chr17_DCas21_5841_WA_REFimputedAndFiltered.fam
    Untracked:  output/chr17_DCas21_5841_WA_REFimputedAndFiltered.log
    Untracked:  output/chr17_DCas21_5841_WA_REFimputedAndFiltered.nosex
    Untracked:  output/chr17_DCas21_5841_WA_REFimputedAndFiltered.raw
    Untracked:  output/chr17_DCas21_5841_WA_REFimputedAndFiltered.sitesWithAlleles
    Untracked:  output/chr17_DCas21_5841_WA_REFimputedAndFiltered.vcf.gz
    Untracked:  output/chr18_DCas21_5841_WA_REFimputed.INFO
    Untracked:  output/chr18_DCas21_5841_WA_REFimputed.hwe
    Untracked:  output/chr18_DCas21_5841_WA_REFimputed.log
    Untracked:  output/chr18_DCas21_5841_WA_REFimputed.sitesPassing
    Untracked:  output/chr18_DCas21_5841_WA_REFimputed.vcf.gz
    Untracked:  output/chr18_DCas21_5841_WA_REFimputedAndFiltered.alleleToCount
    Untracked:  output/chr18_DCas21_5841_WA_REFimputedAndFiltered.bed
    Untracked:  output/chr18_DCas21_5841_WA_REFimputedAndFiltered.bim
    Untracked:  output/chr18_DCas21_5841_WA_REFimputedAndFiltered.fam
    Untracked:  output/chr18_DCas21_5841_WA_REFimputedAndFiltered.log
    Untracked:  output/chr18_DCas21_5841_WA_REFimputedAndFiltered.nosex
    Untracked:  output/chr18_DCas21_5841_WA_REFimputedAndFiltered.raw
    Untracked:  output/chr18_DCas21_5841_WA_REFimputedAndFiltered.sitesWithAlleles
    Untracked:  output/chr18_DCas21_5841_WA_REFimputedAndFiltered.vcf.gz
    Untracked:  output/chr1_DCas21_5841_WA_REFimputed.INFO
    Untracked:  output/chr1_DCas21_5841_WA_REFimputed.hwe
    Untracked:  output/chr1_DCas21_5841_WA_REFimputed.log
    Untracked:  output/chr1_DCas21_5841_WA_REFimputed.sitesPassing
    Untracked:  output/chr1_DCas21_5841_WA_REFimputed.vcf.gz
    Untracked:  output/chr1_DCas21_5841_WA_REFimputedAndFiltered.alleleToCount
    Untracked:  output/chr1_DCas21_5841_WA_REFimputedAndFiltered.bed
    Untracked:  output/chr1_DCas21_5841_WA_REFimputedAndFiltered.bim
    Untracked:  output/chr1_DCas21_5841_WA_REFimputedAndFiltered.fam
    Untracked:  output/chr1_DCas21_5841_WA_REFimputedAndFiltered.log
    Untracked:  output/chr1_DCas21_5841_WA_REFimputedAndFiltered.nosex
    Untracked:  output/chr1_DCas21_5841_WA_REFimputedAndFiltered.raw
    Untracked:  output/chr1_DCas21_5841_WA_REFimputedAndFiltered.sitesWithAlleles
    Untracked:  output/chr1_DCas21_5841_WA_REFimputedAndFiltered.vcf.gz
    Untracked:  output/chr2_DCas21_5841_WA_REFimputed.INFO
    Untracked:  output/chr2_DCas21_5841_WA_REFimputed.hwe
    Untracked:  output/chr2_DCas21_5841_WA_REFimputed.log
    Untracked:  output/chr2_DCas21_5841_WA_REFimputed.sitesPassing
    Untracked:  output/chr2_DCas21_5841_WA_REFimputed.vcf.gz
    Untracked:  output/chr2_DCas21_5841_WA_REFimputedAndFiltered.alleleToCount
    Untracked:  output/chr2_DCas21_5841_WA_REFimputedAndFiltered.bed
    Untracked:  output/chr2_DCas21_5841_WA_REFimputedAndFiltered.bim
    Untracked:  output/chr2_DCas21_5841_WA_REFimputedAndFiltered.fam
    Untracked:  output/chr2_DCas21_5841_WA_REFimputedAndFiltered.log
    Untracked:  output/chr2_DCas21_5841_WA_REFimputedAndFiltered.nosex
    Untracked:  output/chr2_DCas21_5841_WA_REFimputedAndFiltered.raw
    Untracked:  output/chr2_DCas21_5841_WA_REFimputedAndFiltered.sitesWithAlleles
    Untracked:  output/chr2_DCas21_5841_WA_REFimputedAndFiltered.vcf.gz
    Untracked:  output/chr3_DCas21_5841_WA_REFimputed.INFO
    Untracked:  output/chr3_DCas21_5841_WA_REFimputed.hwe
    Untracked:  output/chr3_DCas21_5841_WA_REFimputed.log
    Untracked:  output/chr3_DCas21_5841_WA_REFimputed.sitesPassing
    Untracked:  output/chr3_DCas21_5841_WA_REFimputed.vcf.gz
    Untracked:  output/chr3_DCas21_5841_WA_REFimputedAndFiltered.alleleToCount
    Untracked:  output/chr3_DCas21_5841_WA_REFimputedAndFiltered.bed
    Untracked:  output/chr3_DCas21_5841_WA_REFimputedAndFiltered.bim
    Untracked:  output/chr3_DCas21_5841_WA_REFimputedAndFiltered.fam
    Untracked:  output/chr3_DCas21_5841_WA_REFimputedAndFiltered.log
    Untracked:  output/chr3_DCas21_5841_WA_REFimputedAndFiltered.nosex
    Untracked:  output/chr3_DCas21_5841_WA_REFimputedAndFiltered.raw
    Untracked:  output/chr3_DCas21_5841_WA_REFimputedAndFiltered.sitesWithAlleles
    Untracked:  output/chr3_DCas21_5841_WA_REFimputedAndFiltered.vcf.gz
    Untracked:  output/chr4_DCas21_5841_WA_REFimputed.INFO
    Untracked:  output/chr4_DCas21_5841_WA_REFimputed.hwe
    Untracked:  output/chr4_DCas21_5841_WA_REFimputed.log
    Untracked:  output/chr4_DCas21_5841_WA_REFimputed.sitesPassing
    Untracked:  output/chr4_DCas21_5841_WA_REFimputed.vcf.gz
    Untracked:  output/chr4_DCas21_5841_WA_REFimputedAndFiltered.alleleToCount
    Untracked:  output/chr4_DCas21_5841_WA_REFimputedAndFiltered.bed
    Untracked:  output/chr4_DCas21_5841_WA_REFimputedAndFiltered.bim
    Untracked:  output/chr4_DCas21_5841_WA_REFimputedAndFiltered.fam
    Untracked:  output/chr4_DCas21_5841_WA_REFimputedAndFiltered.log
    Untracked:  output/chr4_DCas21_5841_WA_REFimputedAndFiltered.nosex
    Untracked:  output/chr4_DCas21_5841_WA_REFimputedAndFiltered.raw
    Untracked:  output/chr4_DCas21_5841_WA_REFimputedAndFiltered.sitesWithAlleles
    Untracked:  output/chr4_DCas21_5841_WA_REFimputedAndFiltered.vcf.gz
    Untracked:  output/chr5_DCas21_5841_WA_REFimputed.INFO
    Untracked:  output/chr5_DCas21_5841_WA_REFimputed.hwe
    Untracked:  output/chr5_DCas21_5841_WA_REFimputed.log
    Untracked:  output/chr5_DCas21_5841_WA_REFimputed.sitesPassing
    Untracked:  output/chr5_DCas21_5841_WA_REFimputed.vcf.gz
    Untracked:  output/chr5_DCas21_5841_WA_REFimputedAndFiltered.alleleToCount
    Untracked:  output/chr5_DCas21_5841_WA_REFimputedAndFiltered.bed
    Untracked:  output/chr5_DCas21_5841_WA_REFimputedAndFiltered.bim
    Untracked:  output/chr5_DCas21_5841_WA_REFimputedAndFiltered.fam
    Untracked:  output/chr5_DCas21_5841_WA_REFimputedAndFiltered.log
    Untracked:  output/chr5_DCas21_5841_WA_REFimputedAndFiltered.nosex
    Untracked:  output/chr5_DCas21_5841_WA_REFimputedAndFiltered.raw
    Untracked:  output/chr5_DCas21_5841_WA_REFimputedAndFiltered.sitesWithAlleles
    Untracked:  output/chr5_DCas21_5841_WA_REFimputedAndFiltered.vcf.gz
    Untracked:  output/chr6_DCas21_5841_WA_REFimputed.INFO
    Untracked:  output/chr6_DCas21_5841_WA_REFimputed.hwe
    Untracked:  output/chr6_DCas21_5841_WA_REFimputed.log
    Untracked:  output/chr6_DCas21_5841_WA_REFimputed.sitesPassing
    Untracked:  output/chr6_DCas21_5841_WA_REFimputed.vcf.gz
    Untracked:  output/chr6_DCas21_5841_WA_REFimputedAndFiltered.alleleToCount
    Untracked:  output/chr6_DCas21_5841_WA_REFimputedAndFiltered.bed
    Untracked:  output/chr6_DCas21_5841_WA_REFimputedAndFiltered.bim
    Untracked:  output/chr6_DCas21_5841_WA_REFimputedAndFiltered.fam
    Untracked:  output/chr6_DCas21_5841_WA_REFimputedAndFiltered.log
    Untracked:  output/chr6_DCas21_5841_WA_REFimputedAndFiltered.nosex
    Untracked:  output/chr6_DCas21_5841_WA_REFimputedAndFiltered.raw
    Untracked:  output/chr6_DCas21_5841_WA_REFimputedAndFiltered.sitesWithAlleles
    Untracked:  output/chr6_DCas21_5841_WA_REFimputedAndFiltered.vcf.gz
    Untracked:  output/chr7_DCas21_5841_WA_REFimputed.INFO
    Untracked:  output/chr7_DCas21_5841_WA_REFimputed.hwe
    Untracked:  output/chr7_DCas21_5841_WA_REFimputed.log
    Untracked:  output/chr7_DCas21_5841_WA_REFimputed.sitesPassing
    Untracked:  output/chr7_DCas21_5841_WA_REFimputed.vcf.gz
    Untracked:  output/chr7_DCas21_5841_WA_REFimputedAndFiltered.alleleToCount
    Untracked:  output/chr7_DCas21_5841_WA_REFimputedAndFiltered.bed
    Untracked:  output/chr7_DCas21_5841_WA_REFimputedAndFiltered.bim
    Untracked:  output/chr7_DCas21_5841_WA_REFimputedAndFiltered.fam
    Untracked:  output/chr7_DCas21_5841_WA_REFimputedAndFiltered.log
    Untracked:  output/chr7_DCas21_5841_WA_REFimputedAndFiltered.nosex
    Untracked:  output/chr7_DCas21_5841_WA_REFimputedAndFiltered.raw
    Untracked:  output/chr7_DCas21_5841_WA_REFimputedAndFiltered.sitesWithAlleles
    Untracked:  output/chr7_DCas21_5841_WA_REFimputedAndFiltered.vcf.gz
    Untracked:  output/chr8_DCas21_5841_WA_REFimputed.INFO
    Untracked:  output/chr8_DCas21_5841_WA_REFimputed.hwe
    Untracked:  output/chr8_DCas21_5841_WA_REFimputed.log
    Untracked:  output/chr8_DCas21_5841_WA_REFimputed.sitesPassing
    Untracked:  output/chr8_DCas21_5841_WA_REFimputed.vcf.gz
    Untracked:  output/chr8_DCas21_5841_WA_REFimputedAndFiltered.alleleToCount
    Untracked:  output/chr8_DCas21_5841_WA_REFimputedAndFiltered.bed
    Untracked:  output/chr8_DCas21_5841_WA_REFimputedAndFiltered.bim
    Untracked:  output/chr8_DCas21_5841_WA_REFimputedAndFiltered.fam
    Untracked:  output/chr8_DCas21_5841_WA_REFimputedAndFiltered.log
    Untracked:  output/chr8_DCas21_5841_WA_REFimputedAndFiltered.nosex
    Untracked:  output/chr8_DCas21_5841_WA_REFimputedAndFiltered.raw
    Untracked:  output/chr8_DCas21_5841_WA_REFimputedAndFiltered.sitesWithAlleles
    Untracked:  output/chr8_DCas21_5841_WA_REFimputedAndFiltered.vcf.gz
    Untracked:  output/chr9_DCas21_5841_WA_REFimputed.INFO
    Untracked:  output/chr9_DCas21_5841_WA_REFimputed.hwe
    Untracked:  output/chr9_DCas21_5841_WA_REFimputed.log
    Untracked:  output/chr9_DCas21_5841_WA_REFimputed.sitesPassing
    Untracked:  output/chr9_DCas21_5841_WA_REFimputed.vcf.gz
    Untracked:  output/chr9_DCas21_5841_WA_REFimputedAndFiltered.alleleToCount
    Untracked:  output/chr9_DCas21_5841_WA_REFimputedAndFiltered.bed
    Untracked:  output/chr9_DCas21_5841_WA_REFimputedAndFiltered.bim
    Untracked:  output/chr9_DCas21_5841_WA_REFimputedAndFiltered.fam
    Untracked:  output/chr9_DCas21_5841_WA_REFimputedAndFiltered.log
    Untracked:  output/chr9_DCas21_5841_WA_REFimputedAndFiltered.nosex
    Untracked:  output/chr9_DCas21_5841_WA_REFimputedAndFiltered.raw
    Untracked:  output/chr9_DCas21_5841_WA_REFimputedAndFiltered.sitesWithAlleles
    Untracked:  output/chr9_DCas21_5841_WA_REFimputedAndFiltered.vcf.gz
    Untracked:  output/cvresults_ADE_1_2021May03.rds
    Untracked:  output/cvresults_ADE_2_2021May03.rds
    Untracked:  output/cvresults_A_2021May03.rds
    Untracked:  output/genomicPredictions_ModelADE_twostage_NRCRI_2021May03.rds
    Untracked:  output/genomicPredictions_ModelA_twostage_NRCRI_2021May03.rds
    Untracked:  output/genomicPredictions_NRCRI_2021May03.csv
    Untracked:  output/maxNOHAV_byStudy.csv

Unstaged changes:
    Modified:   README.md

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/01-cleanTPdata.Rmd) and HTML (docs/01-cleanTPdata.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 94ec811 wolfemd 2021-05-05 Completed prediction. Build site and push to GitHub / Cassavabase FTP server. Share to NRCRI.
html e8b3eeb wolfemd 2021-05-03 Build site.
Rmd c887639 wolfemd 2021-05-03 Publish site up through cleanTPdata step to generate cleaned TP data before continuing pipeline.

Follow outlined GenomicPredictionChecklist and previous pipeline to process cassavabase data for ultimate genomic prediction.

Below we will clean and format training data.

  • Inputs: “Raw” field trial data
  • Expected outputs: “Cleaned” field trial data

[User input] Cassavabase download

Downloaded all NRCRI field trials.

  1. Cassavabase search wizard:

  2. Selected all NRCRI trials currently available. Make a list. Named it ALL_NRCRI_TRIALS_2021April29.

  3. Go to Manage –> Download here. Download phenotypes (plot-basis only) and meta-data as CSV using the corresponding boxes / drop-downs.

    • TRIED TO DOWNLOAD META-DATA, BUT DB IS GIVING “SERVER ERROR”
    • This happened last year too, must have something to do with NRCRI trials in the list?
  4. Store flatfiles, unaltered in directory data/DatabaseDownload_2021April29/.

rm(list=ls())
library(tidyverse); library(magrittr);
source(here::here("code","gsFunctions.R"))

Read DB data directly from the Cassavabase FTP server.

dbdata<-readDBdata(phenotypeFile = here::here("data/DatabaseDownload_2021April29","2021-04-30T144108phenotype_download.csv"))

Group and select trials to analyze

Make TrialType Variable

dbdata<-makeTrialTypeVar(dbdata) 
dbdata %>% 
  count(TrialType) %>% rmarkdown::paged_table()

Comparing to 2020: Slightly more C1b data, twice as much C2a, 3 times as much C2b, 7000 more plots with no identified trial type.

Trials NOT included

Looking at the studyName’s of trials getting NA for TrialType, which can’t be classified at present.

Here is the list of trials I am not including.

dbdata %>% filter(is.na(TrialType)) %$% unique(studyName) %>% 
  write.csv(.,file = here::here("output","NRCRI_trials_NOT_identifiable.csv"), row.names = F)

Wrote to disk a CSV in the output/ sub-directory.

Should any of these trials have been included?

dbdata %>% 
  filter(is.na(TrialType)) %$% unique(studyName)
  [1] "06cetEarlyBulkingUM"        "06SeedlingsEarlyBulkingUM" 
  [3] "07EarlyBulkingUM"           "07pytEarlyBulkingUM"       
  [5] "08EarlyBulkingIB"           "08EarlyBulkingOT"          
  [7] "08EarlyBulkingUM"           "09pytIgariam"              
  [9] "09pytOtobi"                 "09pytUmudike"              
 [11] "10cetNR10BseriesUM"         "10cetNR10seriesUM"         
 [13] "10uytCIATsetAUM"            "10uytCIATsetBKA"           
 [15] "10uytUM"                    "11aytNR09seriesUM"         
 [17] "11cetNR11seriesUM"          "11clonal63cpUM"            
 [19] "11cmd48gpUM"                "11EarlyBulkingDrtKA"       
 [21] "11UMUyellowRTuyt"           "11uyt10RepeatUM"           
 [23] "12CETearlyBulkingDrtkano"   "12PYT36genpyramOtobi"      
 [25] "12PYT75genpyramUM"          "13AYT12yrtOtobi"           
 [27] "13AYT259mpopdOtobi"         "13AYT25umu"                
 [29] "13AYT35gpOtobii"            "13AYT60gpumu"              
 [31] "13AYT70mpopfOtobi"          "13CET261umu"               
 [33] "13mlt12yrtIG"               "13PYT144mpopumu"           
 [35] "13PYT17mpopfumu"            "13pyt20nr12UM"             
 [37] "13UYT12yrtumu"              "13uyt15umu"                
 [39] "14cCET150umu"               "14CET12Highbetacaroumu"    
 [41] "14CET178mpopumu"            "14clonal35ctasetbUM"       
 [43] "14clonal35ctaUM"            "14highbetacaro12umu"       
 [45] "14iHighbetacaroIghariam"    "14PYT21highbetacaroumu"    
 [47] "14PYT25wrtumu"              "14tHighBetaCaroOtobi"      
 [49] "14UYT12umu"                 "15ayt11nr13UM"             
 [51] "15ayt12wrtUM"               "15nextgen351cgm-amUM"      
 [53] "15uyt10hbcUM"               "16uyt10hcbUM"              
 [55] "17C2aSeedling Nursery"      "17cet200yellowrt_umu"      
 [57] "17ppdyieldexperimentUM"     "17pyt30yellowrtumu"        
 [59] "17uyt10yellowrt_umu"        "17uyt12yellowrt_umu"       
 [61] "17uyt13yellowrt_umu"        "18AYT13yrtOtobi"           
 [63] "18AYT13yrtumu"              "18C2bSeedlingNurseryumu"   
 [65] "18introLatAmeumu"           "18pyt_lgbariam"            
 [67] "18PYTmealiness_umu"         "18pyt_otobi"               
 [69] "18UYT12yrtIgbariam"         "18UYT12yrtOtobi"           
 [71] "18UYT12yrtumu_1"            "18UYT12yrtumu_2"           
 [73] "19C3SeedlingNursery_umu"    "19cetcftumu_1"             
 [75] "19cetcftumu_2"              "19cetcftumu_3"             
 [77] "19crossingblockCETubiaja"   "19introLatAmeumu"          
 [79] "19S1CETumu"                 "19UYTumudike"              
 [81] "2020regionaltrial12Otobi"   "2020regionaltrial16Otobi"  
 [83] "2020regionaltrial17Otobi"   "2020regionaltrial21Otobi"  
 [85] "2020regionaltrial23Umudike" "2020regionaltrial24Otobi"  
 [87] "2020regionaltrial29Otobi"   "2020regionaltrial36Otobi"  
 [89] "2020regionaltrial3Otobi"    "2020regionaltrial46Umudike"
 [91] "2020regionaltrial50Otobi"   "2020regionaltrial9Otobi"   
 [93] "20AYTintroLatAmeAgo-Owu"    "20AYTintroLatAmekano"      
 [95] "20AYTintroLatAmeOnne"       "20AYTintroLatAmeUmudike"   
 [97] "20C4crossingblockCETubiaja" "20CFT1AYTumu"              
 [99] "20CFT2AYTumu"               "20CFT3AYTmum"              
[101] "20event2D8083CFTumu"        "20event3D9001CFTumu"       
[103] "20eventD5001CFTumu"         "20NRS1pytubiaja"           
[105] "20NRS1pytumu"               "20NRS1pytumudike"          
[107] "20pyt_GPR_ikenne_set1"      "20pyt_GPR_ikenne_set2"     
[109] "20pyt_GPR_ikenne_set3"      "20pyt_GPR_ikenne_set4"     
[111] "20pyt_GPR_umu_Set1"         "20pyt_GPR_umu_Set2"        
[113] "20pyt_GPR_umu_Set3"         "20pyt_GPR_umu_Set4"        
[115] "20pytNUEset1umudike"        "20pytNUEset2umudike"       
[117] "20pytNUEumu_2"              "20pytNUset1igbariam"       
[119] "20pytNUset2igbariam"        "20seedlingnurseryumu"      
[121] "20uytnrcri_iita_reg_oto"    "20uytnrcri_iita_reg_umu"   
[123] "CETCrossingblock19_ubiaja"  "Ikenne2019RootPhenotyping" 
[125] "PYT 2010"                   "Umudike2013set1CGM"        
[127] "Umudike2013set2CGM"         "Umudike2019RootPhenotyping"

Should any of these trials have been included?
Especially among the following new trials (post 2018):

dbdata %>% 
  filter(is.na(TrialType),
         as.numeric(studyYear)>2018) %$% unique(studyName)
 [1] "19C3SeedlingNursery_umu"    "19cetcftumu_1"             
 [3] "19cetcftumu_2"              "19cetcftumu_3"             
 [5] "19crossingblockCETubiaja"   "19introLatAmeumu"          
 [7] "19S1CETumu"                 "19UYTumudike"              
 [9] "2020regionaltrial12Otobi"   "2020regionaltrial16Otobi"  
[11] "2020regionaltrial17Otobi"   "2020regionaltrial21Otobi"  
[13] "2020regionaltrial23Umudike" "2020regionaltrial24Otobi"  
[15] "2020regionaltrial29Otobi"   "2020regionaltrial36Otobi"  
[17] "2020regionaltrial3Otobi"    "2020regionaltrial46Umudike"
[19] "2020regionaltrial50Otobi"   "2020regionaltrial9Otobi"   
[21] "20AYTintroLatAmeAgo-Owu"    "20AYTintroLatAmekano"      
[23] "20AYTintroLatAmeOnne"       "20AYTintroLatAmeUmudike"   
[25] "20C4crossingblockCETubiaja" "20CFT1AYTumu"              
[27] "20CFT2AYTumu"               "20CFT3AYTmum"              
[29] "20event2D8083CFTumu"        "20event3D9001CFTumu"       
[31] "20eventD5001CFTumu"         "20NRS1pytubiaja"           
[33] "20NRS1pytumu"               "20NRS1pytumudike"          
[35] "20pyt_GPR_ikenne_set1"      "20pyt_GPR_ikenne_set2"     
[37] "20pyt_GPR_ikenne_set3"      "20pyt_GPR_ikenne_set4"     
[39] "20pyt_GPR_umu_Set1"         "20pyt_GPR_umu_Set2"        
[41] "20pyt_GPR_umu_Set3"         "20pyt_GPR_umu_Set4"        
[43] "20pytNUEset1umudike"        "20pytNUEset2umudike"       
[45] "20pytNUEumu_2"              "20pytNUset1igbariam"       
[47] "20pytNUset2igbariam"        "20seedlingnurseryumu"      
[49] "20uytnrcri_iita_reg_oto"    "20uytnrcri_iita_reg_umu"   
[51] "CETCrossingblock19_ubiaja"  "Ikenne2019RootPhenotyping" 
[53] "Umudike2019RootPhenotyping"

Remove unclassified trials

dbdata %<>% 
    filter(!is.na(TrialType)) 
dbdata %>% 
    group_by(programName) %>% 
    summarize(N=n()) %>% rmarkdown::paged_table()
#   18591   (now including a ~5K plot seedling nursery) plots

Making a table of abbreviations for renaming

dbdata %>% colnames %>% grep("dry.matter",.,value = T)
[1] "dry.matter.content.by.specific.gravity.method.CO_334.0000160"
[2] "dry.matter.content.percentage.CO_334.0000092"                
traitabbrevs<-tribble(~TraitAbbrev,~TraitName,
        "CMD1S","cassava.mosaic.disease.severity.1.month.evaluation.CO_334.0000191",
        "CMD3S","cassava.mosaic.disease.severity.3.month.evaluation.CO_334.0000192",
        "CMD6S","cassava.mosaic.disease.severity.6.month.evaluation.CO_334.0000194",
        "CMD9S","cassava.mosaic.disease.severity.9.month.evaluation.CO_334.0000193",
        "CGM","Cassava.green.mite.severity.CO_334.0000033",
        "CGMS1","cassava.green.mite.severity.first.evaluation.CO_334.0000189",
        "CGMS2","cassava.green.mite.severity.second.evaluation.CO_334.0000190",
        "DM","dry.matter.content.percentage.CO_334.0000092",
        "DMsg","dry.matter.content.by.specific.gravity.method.CO_334.0000160",
        "PLTHT","plant.height.measurement.in.cm.CO_334.0000018",
        "BRNHT1","first.apical.branch.height.measurement.in.cm.CO_334.0000106",
        "SHTWT","fresh.shoot.weight.measurement.in.kg.per.plot.CO_334.0000016",
        "RTWT","fresh.storage.root.weight.per.plot.CO_334.0000012",
        "RTNO","root.number.counting.CO_334.0000011",
        "TCHART","total.carotenoid.by.chart.1.8.CO_334.0000161",
        "NOHAV","plant.stands.harvested.counting.CO_334.0000010")

traitabbrevs %>% rmarkdown::paged_table()

Run function renameAndSelectCols() to rename columns and remove everything unecessary

dbdata<-renameAndSelectCols(traitabbrevs,indata=dbdata,customColsToKeep = c("TrialType","observationUnitName"))

QC Trait values

dbdata<-dbdata %>% 
  mutate(CMD1S=ifelse(CMD1S<1 | CMD1S>5,NA,CMD1S),
         CMD3S=ifelse(CMD3S<1 | CMD3S>5,NA,CMD3S),
         CMD6S=ifelse(CMD6S<1 | CMD6S>5,NA,CMD6S),
         CMD9S=ifelse(CMD9S<1 | CMD9S>5,NA,CMD9S),
         # CBSD3S=ifelse(CBSD3S<1 | CBSD3S>5,NA,CBSD3S),
         # CBSD6S=ifelse(CBSD6S<1 | CBSD6S>5,NA,CBSD6S),
         # CBSD9S=ifelse(CBSD9S<1 | CBSD9S>5,NA,CMD9S),
         # CBSDRS=ifelse(CBSDRS<1 | CBSDRS>5,NA,CBSDRS),
         CGM=ifelse(CGM<1 | CGM>5,NA,CGM),
         CGMS1=ifelse(CGMS1<1 | CGMS1>5,NA,CGMS1),
         CGMS2=ifelse(CGMS2<1 | CGMS2>5,NA,CGMS2),
         DM=ifelse(DM>100 | DM<=0,NA,DM),
         DMsg=ifelse(DMsg>100 | DMsg<=0,NA,DMsg),
         RTWT=ifelse(RTWT==0 | NOHAV==0 | is.na(NOHAV),NA,RTWT),
         SHTWT=ifelse(SHTWT==0 | NOHAV==0 | is.na(NOHAV),NA,SHTWT),
         RTNO=ifelse(RTNO==0 | NOHAV==0 | is.na(NOHAV),NA,RTNO),
         NOHAV=ifelse(NOHAV==0,NA,NOHAV),
         NOHAV=ifelse(NOHAV>42,NA,NOHAV),
         RTNO=ifelse(!RTNO %in% 1:10000,NA,RTNO))

Post-QC traits

Harvest index

dbdata<-dbdata %>% 
    mutate(HI=RTWT/(RTWT+SHTWT))

Unit area traits

I anticipate this will not be necessary as it will be computed before or during data upload.

For calculating fresh root yield:

  1. PlotSpacing: Area in \(m^2\) per plant. plotWidth and plotLength metadata would hypothetically provide this info, but is missing for vast majority of trials. Therefore, use info from Fola.
  2. maxNOHAV: Instead of ExpectedNOHAV. Need to know the max number of plants in the area harvested. For some trials, only the inner (or “net”) plot is harvested, therefore the PlantsPerPlot meta-variable will not suffice. Besides, the PlantsPerPlot information is missing for the vast majority of trials. Instead, use observed max(NOHAV) for each trial. We use this plus the PlotSpacing to calc. the area over which the RTWT was measured. During analysis, variation in the actual number of plants harvested will be accounted for.
dbdata<-dbdata %>% 
    mutate(PlotSpacing=ifelse(programName!="IITA",1,
                              ifelse(studyYear<2013,1,
                              ifelse(TrialType %in% c("CET","GeneticGain","ExpCET"),1,0.8))))
maxNOHAV_byStudy<-dbdata %>% 
  group_by(programName,locationName,studyYear,studyName,studyDesign) %>% 
  summarize(MaxNOHAV=max(NOHAV, na.rm=T)) %>% 
  ungroup() %>% 
  mutate(MaxNOHAV=ifelse(MaxNOHAV=="-Inf",NA,MaxNOHAV))

write.csv(maxNOHAV_byStudy %>% arrange(studyYear),file=here::here("output","maxNOHAV_byStudy.csv"), row.names = F)

This next part is copied from my 2020 NRCRI analysis

Previously, I took these values as is. I am unsatisfied with that. The trial number is small enough I’m going to curate manually below. I hope this gives better yield results.

maxNOHAV_byStudy %<>%
  mutate(MaxNOHAV=ifelse(studyName=="18C2acrossingblockCETubiaja",8,MaxNOHAV),
         MaxNOHAV=ifelse(studyName=="13TP1CET518kano",5,MaxNOHAV),
         MaxNOHAV=ifelse(studyName=="17C1aAYTGSkano",10,MaxNOHAV),
         MaxNOHAV=ifelse(studyName=="18C1bAYTGSOtobi",10,MaxNOHAV),
         MaxNOHAV=ifelse(studyName=="16C1aCETnonGSOtobi",5,MaxNOHAV),
         MaxNOHAV=ifelse(studyName=="17C1bCETkano",5,MaxNOHAV),
         MaxNOHAV=ifelse(studyName=="16C1aCETnonGSOtobi",5,MaxNOHAV),
         MaxNOHAV=ifelse(studyName=="18C1bAYTGSset2umu",10,MaxNOHAV))

Now back the standard workflow.

# I log transform yield traits 
# to satisfy homoskedastic residuals assumption 
# of linear mixed models
dbdata<-left_join(dbdata,maxNOHAV_byStudy) %>% 
  mutate(RTWT=ifelse(NOHAV>MaxNOHAV,NA,RTWT),
         SHTWT=ifelse(NOHAV>MaxNOHAV,NA,SHTWT),
         RTNO=ifelse(NOHAV>MaxNOHAV,NA,RTNO),
         HI=ifelse(NOHAV>MaxNOHAV,NA,HI),
         FYLD=RTWT/(MaxNOHAV*PlotSpacing)*10,
         DYLD=FYLD*(DM/100),
         logFYLD=log(FYLD),
         logDYLD=log(DYLD),
         logTOPYLD=log(SHTWT/(MaxNOHAV*PlotSpacing)*10),
         logRTNO=log(RTNO),
         PropNOHAV=NOHAV/MaxNOHAV) 
# remove non transformed / per-plot (instead of per area) traits
dbdata %<>% select(-RTWT,-SHTWT,-RTNO,-FYLD,-DYLD)

Season-wide mean disease severity

# [NEW AS OF APRIL 2021]
## VERSION with vs. without CBSD
## Impervious to particular timepoints between 1, 3, 6 and 9 scores

# Without CBSD (West Africa)
dbdata<-dbdata %>% 
  mutate(MCMDS=rowMeans(.[,colnames(.) %in% c("CMD1S","CMD3S","CMD6S","CMD9S")], na.rm = T)) %>% 
  select(-any_of(c("CMD1S","CMD3S","CMD6S","CMD9S")))

# With CBSD (East Africa)
# dbdata<-dbdata %>% 
#   mutate(MCMDS=rowMeans(.[,colnames(.) %in% c("CMD1S","CMD3S","CMD6S","CMD9S")], na.rm = T),
#          MCBSDS=rowMeans(.[,colnames(.) %in% c("CBSD1S","CBSD3S","CBSD6S","CBSD9S")], na.rm = T)) %>% 
#   select(-any_of(c("CMD1S","CMD3S","CMD6S","CMD9S","CBSD1S","CBSD3S","CBSD6S","CBSD9S")))

[User input] Assign genos to phenos

This step is mostly copy-pasted from previous processing of IITA- and NRCRI-specific data.

Uses 4 flat files, which are available e.g. here. Specifically, IITA_GBStoPhenoMaster_33018.csv, GBSdataMasterList_31818.csv and NRCRI_GBStoPhenoMaster_40318.csv and chr1_RefPanelAndGSprogeny_ReadyForGP_72719.fam. I copy them to the data/ sub-directory for the current analysis.

In addition, DArT-only samples are now expected to also have phenotypes. Therefore, checking for matches in new flatfiles, deposited in the data/ (see code below).

library(tidyverse); library(magrittr)
gbs2phenoMaster<-dbdata %>% 
  select(germplasmName) %>% 
  distinct %>% 
  left_join(read.csv(here::here("data","NRCRI_GBStoPhenoMaster_40318.csv"), 
                     stringsAsFactors = F)) %>% 
  mutate(FullSampleName=ifelse(grepl("C2a",germplasmName,ignore.case = T) & 
                                 is.na(FullSampleName),germplasmName,FullSampleName)) %>% 
  filter(!is.na(FullSampleName)) %>% 
  select(germplasmName,FullSampleName) %>% 
  bind_rows(dbdata %>% 
              select(germplasmName) %>% 
              distinct %>% 
              left_join(read.csv(here::here("data","IITA_GBStoPhenoMaster_33018.csv"), 
                                 stringsAsFactors = F)) %>% 
              filter(!is.na(FullSampleName)) %>% 
              select(germplasmName,FullSampleName)) %>% 
  bind_rows(dbdata %>% 
              select(germplasmName) %>% 
              distinct %>% 
              left_join(read.csv(here::here("data","GBSdataMasterList_31818.csv"), 
                                 stringsAsFactors = F) %>% 
                          select(DNASample,FullSampleName) %>% 
                          rename(germplasmName=DNASample)) %>% 
              filter(!is.na(FullSampleName)) %>% 
              select(germplasmName,FullSampleName)) %>% 
  bind_rows(dbdata %>% 
              select(germplasmName) %>% 
              distinct %>% 
              mutate(germplasmSynonyms=ifelse(grepl("^UG",germplasmName,ignore.case = T),
                                              gsub("UG","Ug",germplasmName),germplasmName)) %>% 
              left_join(read.csv(here::here("data","GBSdataMasterList_31818.csv"), 
                                 stringsAsFactors = F) %>% 
                          select(DNASample,FullSampleName) %>% 
                          rename(germplasmSynonyms=DNASample)) %>% 
              filter(!is.na(FullSampleName)) %>% 
              select(germplasmName,FullSampleName)) %>%  
  bind_rows(dbdata %>% 
              select(germplasmName) %>% 
              distinct %>% 
              mutate(germplasmSynonyms=ifelse(grepl("^TZ",germplasmName,
                                                    ignore.case = T),
                                              gsub("TZ","",germplasmName),germplasmName)) %>% 
              left_join(read.csv(here::here("data","GBSdataMasterList_31818.csv"), 
                                 stringsAsFactors = F) %>% 
                          select(DNASample,FullSampleName) %>% 
                          rename(germplasmSynonyms=DNASample)) %>% 
              filter(!is.na(FullSampleName)) %>%
              select(germplasmName,FullSampleName)) %>% 
  distinct %>% 
  left_join(read.csv(here::here("data","GBSdataMasterList_31818.csv"), 
                     stringsAsFactors = F) %>% 
              select(FullSampleName,OrigKeyFile,Institute) %>% 
              rename(OriginOfSample=Institute)) %>% 
  mutate(OrigKeyFile=ifelse(grepl("C2a",germplasmName,ignore.case = T),
                            ifelse(is.na(OrigKeyFile),"LavalGBS",OrigKeyFile),
                            OrigKeyFile),
         OriginOfSample=ifelse(grepl("C2a",germplasmName,ignore.case = T),
                               ifelse(is.na(OriginOfSample),"NRCRI",OriginOfSample),
                               OriginOfSample))

## NEW: check for germName-DArT name matches
germNamesWithoutGBSgenos<-dbdata %>% 
  select(programName,germplasmName) %>% 
  distinct %>% 
  left_join(gbs2phenoMaster) %>% 
  filter(is.na(FullSampleName)) %>% 
  select(-FullSampleName)
## NEW: check for germName-DArT name matches
germNamesWithoutGBSgenos<-dbdata %>% 
  select(programName,germplasmName) %>% 
  distinct %>% 
  left_join(gbs2phenoMaster) %>% 
  filter(is.na(FullSampleName)) %>% 
  select(-FullSampleName)

germNamesWithDArT<-germNamesWithoutGBSgenos %>% 
  inner_join(read.table(here::here("data","chr1_RefPanelAndGSprogeny_ReadyForGP_72719.fam"), 
                        header = F, stringsAsFactors = F)$V2 %>% 
               grep("TMS16|TMS17|TMS18|TMS19|TMS20",.,value = T, ignore.case = T) %>% 
               tibble(dartName=.) %>% 
               separate(dartName,c("germplasmName","dartID"),"_",extra = 'merge',remove = F)) %>% 
  group_by(germplasmName) %>% 
  slice(1) %>% 
  ungroup() %>% 
  rename(FullSampleName=dartName) %>% 
  mutate(OrigKeyFile="DArTseqLD", OriginOfSample="IITA") %>% 
  select(-dartID)
print(paste0(nrow(germNamesWithDArT)," germNames with DArT-only genos"))
[1] "0 germNames with DArT-only genos"
# first, filter to just program-DNAorigin matches
germNamesWithGenos<-dbdata %>% 
  select(programName,germplasmName) %>% 
  distinct %>% 
  left_join(gbs2phenoMaster) %>% 
  filter(!is.na(FullSampleName))
print(paste0(nrow(germNamesWithGenos)," germNames with GBS genos"))
[1] "3235 germNames with GBS genos"
# program-germNames with locally sourced GBS samples
germNamesWithGenos_HasLocalSourcedGBS<-germNamesWithGenos %>% 
  filter(programName==OriginOfSample) %>% 
  select(programName,germplasmName) %>% 
  semi_join(germNamesWithGenos,.) %>% 
  group_by(programName,germplasmName) %>% # select one DNA per germplasmName per program
  slice(1) %>% ungroup() 
print(paste0(nrow(germNamesWithGenos_HasLocalSourcedGBS)," germNames with local GBS genos"))
[1] "2712 germNames with local GBS genos"
# the rest (program-germNames) with GBS but coming from a different breeding program
germNamesWithGenos_NoLocalSourcedGBS<-germNamesWithGenos %>% 
  filter(programName==OriginOfSample) %>% 
  select(programName,germplasmName) %>% 
  anti_join(germNamesWithGenos,.) %>% 
  # select one DNA per germplasmName per program
  group_by(programName,germplasmName) %>% 
  slice(1) %>% ungroup() 
print(paste0(nrow(germNamesWithGenos_NoLocalSourcedGBS)," germNames without local GBS genos"))
[1] "212 germNames without local GBS genos"
genosForPhenos<-bind_rows(germNamesWithGenos_HasLocalSourcedGBS,
                        germNamesWithGenos_NoLocalSourcedGBS) %>% 
  bind_rows(germNamesWithDArT)

print(paste0(nrow(genosForPhenos)," total germNames with genos either GBS or DArT"))
[1] "2924 total germNames with genos either GBS or DArT"
dbdata %<>% 
    left_join(genosForPhenos) 

# Create a new identifier, GID
## Equals the value SNP data name (FullSampleName) 
## else germplasmName if no SNP data
dbdata %<>% 
  mutate(GID=ifelse(is.na(FullSampleName),germplasmName,FullSampleName))
#  going to check against SNP data
snps<-readRDS(file=url(paste0("ftp://ftp.cassavabase.org/marnin_datasets/NGC_BigData/",
                              "DosageMatrix_RefPanelAndGSprogeny_ReadyForGP_73019.rds")))
rownames_snps<-rownames(snps); rm(snps); gc()
          used (Mb) gc trigger   (Mb) limit (Mb)  max used   (Mb)
Ncells 1260427 67.4    2306572  123.2         NA   2306572  123.2
Vcells 3894731 29.8  727217682 5548.3      65536 756131983 5768.9
# current matches to SNP data
dbdata %>% 
  distinct(GID,germplasmName,FullSampleName) %>% 
  semi_join(tibble(GID=rownames_snps)) %>% nrow() #
[1] 1340
dbdata %>% 
  distinct(GID,germplasmName,FullSampleName) %>% 
  semi_join(tibble(GID=rownames_snps)) %>% 
  filter(grepl("c1",GID,ignore.case = F)) # no C1 clones currently match
# A tibble: 0 x 3
# … with 3 variables: germplasmName <chr>, FullSampleName <chr>, GID <chr>
dbdata %>% 
  distinct(GID,germplasmName,FullSampleName) %>% 
  semi_join(tibble(GID=rownames_snps)) %>% 
  filter(grepl("c2",GID,ignore.case = F)) # no C2 clones either
# A tibble: 0 x 3
# … with 3 variables: germplasmName <chr>, FullSampleName <chr>, GID <chr>
dbdata %>% 
  distinct(GID,germplasmName,FullSampleName) %>% 
  anti_join(tibble(GID=rownames_snps)) %>% 
  filter(grepl("c1|c2",GID,ignore.case = T)) # definitely there are both C1 and C2 phenotypes
# A tibble: 2,440 x 3
   germplasmName   FullSampleName GID            
   <chr>           <chr>          <chr>          
 1 NR16F100C1bP001 <NA>           NR16F100C1bP001
 2 NR16F100C1bP002 <NA>           NR16F100C1bP002
 3 NR16F104C1bP001 <NA>           NR16F104C1bP001
 4 NR16F105C1bP001 <NA>           NR16F105C1bP001
 5 NR16F105C1bP002 <NA>           NR16F105C1bP002
 6 NR16F106C1bP001 <NA>           NR16F106C1bP001
 7 NR16F107C1bP002 <NA>           NR16F107C1bP002
 8 NR16F107C1bP004 <NA>           NR16F107C1bP004
 9 NR16F108C1bP001 <NA>           NR16F108C1bP001
10 NR16F109C1bP001 <NA>           NR16F109C1bP001
# … with 2,430 more rows
# and there are C1 and C2 genotypes
rownames_snps %>% grep("c1",.,value = T,ignore.case = T) %>% length # [1] 
[1] 1762
rownames_snps %>% grep("c2",.,value = T,ignore.case = T) %>% length # [1]  
[1] 4291
germ2snps<-dbdata %>% 
  distinct(germplasmName,FullSampleName) %>% 
  semi_join(tibble(FullSampleName=rownames_snps)) %>% 
  bind_rows(dbdata %>% 
              distinct(germplasmName,FullSampleName) %>% 
              anti_join(tibble(FullSampleName=rownames_snps)) %>% 
              filter(grepl("c1a",germplasmName,ignore.case = T)) %>% 
              select(-FullSampleName) %>% 
              left_join(tibble(FullSampleName=rownames_snps) %>% 
                          filter(grepl("c1a",FullSampleName,ignore.case = T)) %>% 
                          separate(FullSampleName,c("dartID","germplasmName"),"\\.\\.\\.",extra = 'merge',remove = F) %>% 
                          select(-dartID))) %>% 
  bind_rows(dbdata %>% 
              distinct(germplasmName,FullSampleName) %>% 
              anti_join(tibble(FullSampleName=rownames_snps)) %>% 
              filter(grepl("C1b",germplasmName,ignore.case = T)) %>% 
              filter(grepl("NR16C1b",germplasmName,ignore.case = T)) %>% 
              select(-FullSampleName) %>%
              left_join(tibble(FullSampleName=rownames_snps) %>% 
                          filter(grepl("c1b",FullSampleName,ignore.case = T)) %>% 
                          separate(FullSampleName,c("germplasmName","GBS_ID"),":",extra = 'merge',remove = F) %>% 
                          select(-GBS_ID) %>% 
                          mutate(germplasmName=gsub("C1b","",germplasmName),
                                 germplasmName=paste0("NR16C1b",germplasmName)))) %>% 
  bind_rows(dbdata %>% 
              distinct(germplasmName,FullSampleName) %>% 
              anti_join(tibble(FullSampleName=rownames_snps)) %>% 
              filter(grepl("C1b",germplasmName,ignore.case = T)) %>% 
              filter(!grepl("NR16C1b",germplasmName,ignore.case = T)) %>% 
              select(-FullSampleName) %>% 
              left_join(tibble(FullSampleName=rownames_snps) %>% 
                          filter(grepl("c1b",FullSampleName,ignore.case = T)) %>% 
                          separate(FullSampleName,c("germplasmName","GBS_ID"),":",extra = 'merge',remove = F) %>% 
                          select(-GBS_ID) %>% 
                          mutate(germplasmName=paste0("NR16",germplasmName)))) %>% 
  bind_rows(dbdata %>% 
              distinct(germplasmName,FullSampleName) %>% 
              anti_join(tibble(FullSampleName=rownames_snps)) %>% 
              filter(grepl("c2",germplasmName,ignore.case = T)) %>% 
              select(-FullSampleName) %>% 
              left_join(tibble(FullSampleName=rownames_snps) %>% 
                          filter(grepl("c2",FullSampleName,ignore.case = T),
                                 grepl("\\.\\.\\.",FullSampleName)) %>% 
                          separate(FullSampleName,c("dartID","germplasmName"),"\\.\\.\\.",extra = 'merge',remove = F) %>% 
                          select(-dartID))) %>% 
  distinct
germ2snps %>% 
  count(germplasmName) %>% arrange(desc(n))
# A tibble: 3,780 x 2
   germplasmName       n
   <chr>           <int>
 1 NR16C1bF185P001     4
 2 NR16F185C1bP001     4
 3 NR16C1bF170P019     3
 4 NR16C1bF170P020     3
 5 NR16C1bF180P002     3
 6 NR16F180C1bP002     3
 7 NR16F182C1bP001     3
 8 NR16C1bF171P002     2
 9 NR16C1bF179P001     2
10 NR16C1bF179P002     2
# … with 3,770 more rows
germ2snps %>% 
  count(FullSampleName) %>% arrange(desc(n))
# A tibble: 3,304 x 2
   FullSampleName                     n
   <chr>                          <int>
 1 <NA>                             357
 2 F116C1bP006:CA7RRANXX:3:499841     3
 3 F123C1bP002:CA7RRANXX:4:499895     3
 4 F123C1bP006:CA7RRANXX:4:499899     3
 5 F12C1bP018:CABV7ANXX:5:503932      3
 6 F135C1bP001:CABJYANXX:5:505238     3
 7 F136C1bP002:CABJYANXX:5:505240     3
 8 F140C1bP001:CABJYANXX:5:505270     3
 9 F152C1bP010:CA7RRANXX:5:499961     3
10 F152C1bP014:CA7RRANXX:5:499965     3
# … with 3,294 more rows
length(unique(dbdata$FullSampleName)) # [1] 
[1] 2911
table(unique(dbdata$FullSampleName) %in% rownames_snps)

FALSE  TRUE 
 1584  1327 
# FALSE  TRUE 
#  
dbdata %>% 
  select(-GID,-FullSampleName) %>% 
  left_join(germ2snps) %$%
  length(unique(FullSampleName)) # [1] 
[1] 3304
dbdata %>% 
  select(-GID,-FullSampleName) %>% 
  left_join(germ2snps) %$%
  table(unique(FullSampleName) %in% rownames_snps) 

FALSE  TRUE 
    1  3303 
# FALSE  TRUE 
#    

# Merge updated pheno-to-SNP matches to raw pheno DF
dbdata %<>% 
  select(-GID,-FullSampleName) %>% 
  left_join(germ2snps) %>% 
  # Re-create the GID identifier
  ## Equals the value SNP data name (FullSampleName) 
  ## else germplasmName if no SNP data
  mutate(GID=ifelse(is.na(FullSampleName),germplasmName,FullSampleName))

Write lists for matching genos-to-phenos

dbdata %>% 
  distinct(GID,germplasmName,FullSampleName) %>% 
  write.csv(.,
            file = here::here("output","OnlyChosen_germplasmName_to_FullSampleName_matches_NRCRI_2021May03.csv"), 
            row.names = F)

Output “cleaned” file

saveRDS(dbdata,file=here::here("output","NRCRI_CleanedTrialData_2021May03.rds"))

Detect experimental designs

The next step is to check the experimental design of each trial. If you are absolutely certain of the usage of the design variables in your dataset, you might not need this step.

Examples of reasons to do the step below:

  • Some trials appear to be complete blocked designs and the blockNumber is used instead of replicate, which is what most use.
  • Some complete block designs have nested, incomplete sub-blocks, others simply copy the “replicate” variable into the “blockNumber variable”
  • Some trials have only incomplete blocks but the incomplete block info might be in the replicate and/or the blockNumber column

One reason it might be important to get this right is that the variance among complete blocks might not be the same among incomplete blocks. If we treat a mixture of complete and incomplete blocks as part of the same random-effect (replicated-within-trial), we assume they have the same variance.

Also error variances might be heterogeneous among different trial-types (blocking scheme available) and/or plot sizes (maxNOHAV).

Start with cleaned data from previous step.

rm(list=ls()); gc()
          used (Mb) gc trigger   (Mb) limit (Mb)  max used   (Mb)
Ncells 1220275 65.2    2306572  123.2         NA   2306572  123.2
Vcells 2301934 17.6  581774146 4438.6      65536 756131983 5768.9
library(tidyverse); library(magrittr);
source(here::here("code","gsFunctions.R"))
dbdata<-readRDS(here::here("output","NRCRI_CleanedTrialData_2021May03.rds"))
dbdata %>% head %>% rmarkdown::paged_table()

Detect designs

dbdata<-detectExptDesigns(dbdata)
dbdata %>% 
    count(programName,CompleteBlocks,IncompleteBlocks) %>% rmarkdown::paged_table()

Output file

saveRDS(dbdata,file=here::here("output","NRCRI_ExptDesignsDetected_2021May03.rds"))

Next step

  1. 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.

sessionInfo()
R version 4.0.3 (2020-10-10)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Big Sur 10.16

Matrix products: default
BLAS:   /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRblas.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/4.0/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     

other attached packages:
 [1] magrittr_2.0.1  forcats_0.5.1   stringr_1.4.0   dplyr_1.0.5    
 [5] purrr_0.3.4     readr_1.4.0     tidyr_1.1.3     tibble_3.1.1   
 [9] ggplot2_3.3.3   tidyverse_1.3.1 workflowr_1.6.2

loaded via a namespace (and not attached):
 [1] tidyselect_1.1.0  xfun_0.22         bslib_0.2.4       haven_2.4.0      
 [5] colorspace_2.0-0  vctrs_0.3.7       generics_0.1.0    htmltools_0.5.1.1
 [9] yaml_2.2.1        utf8_1.2.1        rlang_0.4.10      jquerylib_0.1.3  
[13] later_1.1.0.1     pillar_1.6.0      withr_2.4.2       glue_1.4.2       
[17] DBI_1.1.1         dbplyr_2.1.1      readxl_1.3.1      modelr_0.1.8     
[21] lifecycle_1.0.0   cellranger_1.1.0  munsell_0.5.0     gtable_0.3.0     
[25] rvest_1.0.0       evaluate_0.14     knitr_1.32        httpuv_1.5.5     
[29] fansi_0.4.2       broom_0.7.6       Rcpp_1.0.6        promises_1.2.0.1 
[33] backports_1.2.1   scales_1.1.1      jsonlite_1.7.2    fs_1.5.0         
[37] hms_1.0.0         digest_0.6.27     stringi_1.5.3     rprojroot_2.0.2  
[41] grid_4.0.3        here_1.0.1        cli_2.4.0         tools_4.0.3      
[45] sass_0.3.1        crayon_1.4.1      whisker_0.4       pkgconfig_2.0.3  
[49] ellipsis_0.3.1    xml2_1.3.2        reprex_2.0.0      lubridate_1.7.10 
[53] rstudioapi_0.13   assertthat_0.2.1  rmarkdown_2.7     httr_1.4.2       
[57] R6_2.5.0          git2r_0.28.0      compiler_4.0.3