Last updated: 2021-03-24

Checks: 7 0

Knit directory: PredictOutbredCrossVar/

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(20191123) 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 f73b05f. 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:    output/.DS_Store

Untracked files:
    Untracked:  Icon
    Untracked:  PredictOutbredCrossVarMS_ResponseToReviews_R1.gdoc
    Untracked:  figure/
    Untracked:  manuscript/
    Untracked:  output/crossPredictions/
    Untracked:  output/gblups_DirectionalDom_parentwise_crossVal_folds.rds
    Untracked:  output/gblups_geneticgroups.rds
    Untracked:  output/gblups_parentwise_crossVal_folds.rds
    Untracked:  output/mtMarkerEffects/

Unstaged changes:
    Modified:   analysis/NGCleadersCall.Rmd
    Modified:   code/fitDirectionalDomMtBRR.R
    Modified:   code/fitmtBRR.R
    Modified:   code/getDirectionalDomGenomicBLUPs.R
    Modified:   code/getDirectionalDomMtCrossMeanPreds.R
    Modified:   code/getDirectionalDomMtCrossVarBVpreds.R
    Modified:   code/getDirectionalDomMtCrossVarTGVpreds.R
    Modified:   code/getDirectionalDomVarComps.R
    Modified:   code/getGenomicBLUPs.R
    Modified:   code/getMtCrossMeanPreds.R
    Modified:   code/getMtCrossVarPreds.R
    Modified:   code/getUntestedMtCrossVarPreds.R
    Modified:   code/getVarComps.R
    Modified:   data/blups_forawcdata.rds
    Modified:   data/genmap_awc_May2020.rds
    Modified:   data/parentwise_crossVal_folds.rds
    Modified:   data/ped_awc.rds
    Modified:   data/selection_index_weights_4traits.rds
    Modified:   output/CrossesToPredict_top100stdSI_and_209originalParents.rds
    Modified:   output/accuraciesMeans.rds
    Modified:   output/accuraciesUC.rds
    Modified:   output/accuraciesVars.rds
    Modified:   output/crossRealizations/realizedCrossMeans.rds
    Modified:   output/crossRealizations/realizedCrossMeans_BLUPs.rds
    Modified:   output/crossRealizations/realizedCrossMetrics.rds
    Modified:   output/crossRealizations/realizedCrossVars.rds
    Modified:   output/crossRealizations/realizedCrossVars_BLUPs.rds
    Modified:   output/crossRealizations/realized_cross_means_and_covs_traits.rds
    Modified:   output/crossRealizations/realized_cross_means_and_vars_selindices.rds
    Modified:   output/ddEffects.rds
    Modified:   output/gebvs_ModelA_GroupAll_stdSI.rds
    Modified:   output/obsVSpredMeans.rds
    Modified:   output/obsVSpredUC.rds
    Modified:   output/obsVSpredVars.rds
    Modified:   output/pmv_DirectionalDom_varcomps_geneticgroups.rds
    Modified:   output/pmv_varcomps_geneticgroups.rds
    Modified:   output/pmv_varcomps_geneticgroups_tidy_includingSIvars.rds
    Modified:   output/propHomozygous.rds
    Modified:   output/top100stdSI.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/SupplementaryTables.Rmd) and HTML (docs/SupplementaryTables.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 f73b05f wolfemd 2021-03-24 Update to match revised manuscript. Several comparisons moved to Appendix to streamline primary results, figures, etc.
html 4de1330 wolfemd 2021-02-01 Build site.
Rmd 883b1d4 wolfemd 2021-02-01 Update the syntax highlighting and code-block formatting throughout for
Rmd 6a10c30 wolfemd 2021-01-04 Submission and GitHub ready version.
html 6a10c30 wolfemd 2021-01-04 Submission and GitHub ready version.

SI Dataset

Initiate

library(writexl)
suptables<-list()

Table S1: Selection indices

Table S1: Selection indices. For each trait, the standard deviation of BLUPs (blupSD), which were divided by “unscaled” index weights for the StdSI and BiofortSI indices to get StdSI and BiofortSI weights used throughout the study.

library(tidyverse); library(magrittr); 
indices<-readRDS(file=here::here("data","selection_index_weights_4traits.rds"))
suptables[["TableS01"]]<-indices
indices %>% rmarkdown::paged_table()

Table S2: Summary of cross-validation scheme

Table S2: Summary of cross-validation scheme. For each fold of each Rep, the number of parents in the test-set (Ntestparents) is given along with the number of clones in the corresponding training (Ntraintset) and testing (Ntestset) datasets and the number of crosses to predict (NcrossesToPredict).

library(tidyverse); library(magrittr)
parentfolds<-readRDS(file = here::here("data","parentwise_crossVal_folds.rds"))
ped<-readRDS(here::here("data","ped_awc.rds")) %>%
  distinct(sireID,damID)
parentfolds %<>% 
  mutate(CrossesToPredict=map(testparents,~filter(ped,sireID %in% . | damID %in% .)))
parentfold_summary<-parentfolds %>% 
  rename(Rep=id,Fold=id2) %>% 
  mutate(Ntestparents=map_dbl(testparents,length),
         Ntrainset=map_dbl(trainset,length),
         Ntestset=map_dbl(testset,length),
         NcrossesToPredict=map_dbl(CrossesToPredict,nrow)) %>% 
  select(Rep,Fold,starts_with("N"))
suptables[["TableS02"]]<-parentfold_summary
parentfold_summary %>% rmarkdown::paged_table()

Table S3: Test-parents

Table S3: Test-parents. For each fold of each cross-validation repeat, the set of parents whose crosses are to be predicted is listed.

testparents<-parentfolds %>% 
  rename(Rep=id,Fold=id2) %>% 
  select(Rep,Fold,testparents) %>% 
  unnest(testparents)
suptables[["TableS03"]]<-testparents
testparents %>% head %>% rmarkdown::paged_table()

Table S4: Training-Testing partitions of germplasm

Table S4: Training-Testing partitions of germplasm. For each fold of each repeat, the genotype ID (germplasmName) of all clones in the “trainset” and “testset” are given.

train_test_germplasmNames<-parentfolds %>% 
  rename(Rep=id,Fold=id2) %>% 
  select(Rep,Fold,trainset,testset) %>% 
  pivot_longer(cols = c(trainset,testset), names_to = "Set", values_to = "germplasmName") %>% 
  unnest(germplasmName)
suptables[["TableS04"]]<-train_test_germplasmNames
train_test_germplasmNames %>% head %>% rmarkdown::paged_table()

Table S5: Crosses to predict each fold

Table S5: Crosses to predict each fold. For each fold of each repeat, the sireID and damID are given for each cross-to-be-predicted.

CrossesToPredict<-parentfolds %>% 
  rename(Rep=id,Fold=id2) %>% 
  select(Rep,Fold,CrossesToPredict) %>% 
  unnest(CrossesToPredict)
suptables[["TableS05"]]<-CrossesToPredict
CrossesToPredict %>% head %>% rmarkdown::paged_table()

Table S6: Predicted and observed cross means

Table S6: Predicted and observed cross means. For each fold of each repeat, each cross distinguished by a unique pair of sireID and damID is given. The genetic model used (Models A, AD, DirDomAD, DirDomBV), whether the prediction is of mean breeding value (predOf=MeanBV) or mean total genetic value (predOf=MeanTGV), the trait (BiofortSI or StdSI), type of observation (ValidationData: GBLUPs or iidBLUPs) and corresponding prediction (predMean) and observations (obsMean) are shown.

obsVSpredMeans<-readRDS(here::here("output","obsVSpredMeans.rds"))
write.csv(obsVSpredMeans,file = here::here("manuscript", "SupplementaryTable06.csv"), row.names = F)
# suptables[["TableS06"]]<-obsVSpredMeans
obsVSpredMeans %>% str
tibble [199,296 × 10] (S3: tbl_df/tbl/data.frame)
 $ Repeat        : chr [1:199296] "Repeat1" "Repeat1" "Repeat1" "Repeat1" ...
 $ Fold          : chr [1:199296] "Fold1" "Fold1" "Fold1" "Fold1" ...
 $ Model         : chr [1:199296] "A" "A" "A" "A" ...
 $ sireID        : chr [1:199296] "IITA-TMS-BAD9200068" "IITA-TMS-BAD9200068" "IITA-TMS-BAD9200068" "IITA-TMS-BAD9200068" ...
 $ damID         : chr [1:199296] "IITA-TMS-IBA000211" "IITA-TMS-IBA000211" "IITA-TMS-IBA940006" "IITA-TMS-IBA940006" ...
 $ predOf        : chr [1:199296] "MeanBV" "MeanBV" "MeanBV" "MeanBV" ...
 $ Trait         : chr [1:199296] "stdSI" "biofortSI" "stdSI" "biofortSI" ...
 $ predMean      : num [1:199296] 6.68 -3.63 4.74 4.26 6.42 ...
 $ obsMean       : num [1:199296] 8.056 -6.795 -4.541 -0.138 4.009 ...
 $ ValidationData: chr [1:199296] "GBLUPs" "GBLUPs" "GBLUPs" "GBLUPs" ...
obsVSpredMeans %>% count(Model,predOf,ValidationData) %>% spread(predOf,n) %>% rmarkdown::paged_table()

Table S7: Predicted cross variances

Table S7: Predicted cross variances. All predictions of cross-variance from the cross-validation scheme are detailed. For each fold of each repeat and each unique cross (sireID x damID). Both variances (Trait1==Trait2) and co-variances (Trait1!=Trait2) are given. The genetic model used (Model: A, AD, DirDomAD, DirDomBV), the variance component being predicted (VarComp=VarA or VarD), along with the number of segregating SNPs in the family (Nsegsnps) and the time taken in seconds for computation, per family (totcomputetime) are given. The predictions based on the variance of posterior means (VPM) and the posterior mean variances (PMV) are both shown.

library(tidyverse); library(magrittr); library(predCrossVar)
# Tidy predicted Vars for Models A and AD
predictedCrossVars<-list.files(here::here("output/crossPredictions")) %>% 
  grep("predictedCrossVars_chunk",.,value = T) %>% 
  map_df(.,~readRDS(here::here("output/crossPredictions",.))) %>% 
  select(Repeat,Fold,Model,crossVars) %>% 
  mutate(crossVars=map(crossVars,
                       function(crossVars){
                         out<-crossVars$predictedCrossVars$varcovars %>% 
                           mutate(varcomps=map(varcomps,~.$predictedfamvars)) %>% 
                           unnest(varcomps) %>% 
                           unnest(predVars)
                         return(out)})) %>% 
  unnest(crossVars)

predictedDirDomCrossVars<-bind_rows(list.files(here::here("output/crossPredictions")) %>% 
                      grep("predictedDirectionalDomCrossVarBVs_chunk",.,value = T) %>% 
                      grep("_15Dec2020.rds",.,value = T) %>% 
                      map_df(.,~readRDS(here::here("output/crossPredictions",.))) %>% 
                      select(Repeat,Fold,crossVars) %>% 
                      mutate(Model="DirDomBV"),
                    list.files(here::here("output/crossPredictions")) %>% 
                      grep("predictedDirectionalDomCrossVarTGVs_chunk",.,value = T) %>% 
                      grep("_15Dec2020.rds",.,value = T) %>% 
                      map_df(.,~readRDS(here::here("output/crossPredictions",.))) %>% 
                      select(Repeat,Fold,crossVars) %>% 
                      mutate(Model="DirDomAD")) %>% 
  mutate(crossVars=map(crossVars,
                       function(crossVars){
                         out<-crossVars$predictedCrossVars$varcovars %>% 
                           mutate(varcomps=map(varcomps,~.$predictedfamvars)) %>% 
                           unnest(varcomps) %>% 
                           unnest(predVars)
                         return(out)})) %>% 
  unnest(crossVars)
# ### Combine all predicted vars into table
predictedCrossVars<-bind_rows(predictedCrossVars,
                              predictedDirDomCrossVars)
rm(predictedDirDomCrossVars); gc()
          used (Mb) gc trigger  (Mb) limit (Mb) max used  (Mb)
Ncells 1174101 62.8    3794854 202.7         NA  4743567 253.4
Vcells 7657545 58.5   15984759 122.0      65536 13149346 100.4
saveRDS(predictedCrossVars,file=here::here("output/crossPredictions","TableS7_predictedCrossVars.rds"))

predictedCrossVars<-readRDS(file=here::here("output/crossPredictions","TableS7_predictedCrossVars.rds"))
write.csv(predictedCrossVars,file = here::here("manuscript", "SupplementaryTable07.csv"), row.names = F)
#suptables[["TableS07"]]<-predictedCrossVars
predictedCrossVars %>% str
tibble [249,120 × 12] (S3: tbl_df/tbl/data.frame)
 $ Repeat        : chr [1:249120] "Repeat1" "Repeat1" "Repeat1" "Repeat1" ...
 $ Fold          : chr [1:249120] "Fold1" "Fold1" "Fold1" "Fold1" ...
 $ Model         : chr [1:249120] "A" "A" "A" "A" ...
 $ Trait1        : chr [1:249120] "DM" "DM" "DM" "DM" ...
 $ Trait2        : chr [1:249120] "DM" "DM" "DM" "DM" ...
 $ sireID        : chr [1:249120] "IITA-TMS-MM964019" "IITA-TMS-MM964019" "IITA-TMS-IBA960557" "IITA-TMS-IBA960869" ...
 $ damID         : chr [1:249120] "IITA-TMS-IBA011273" "IITA-TMS-IBA011371" "IITA-TMS-IBA940006" "IITA-TMS-IBA940006" ...
 $ VarComp       : chr [1:249120] "VarA" "VarA" "VarA" "VarA" ...
 $ VPM           : num [1:249120] 0.369 0.381 0.356 0.359 0.347 ...
 $ PMV           : num [1:249120] 4.29 4.4 4.05 4.31 4.15 ...
 $ Nsegsnps      : int [1:249120] 10583 10189 9788 10070 9749 9814 10601 9804 11309 11424 ...
 $ totcomputetime: Named num [1:249120] 16.6 15.6 13 14.1 12.9 ...
  ..- attr(*, "names")= chr [1:249120] "elapsed" "elapsed" "elapsed" "elapsed" ...
predictedCrossVars %>% count(Model,VarComp) %>% rmarkdown::paged_table()

Table S8: Predicted versus observed cross variances

Table S8: Predicted versus observed cross variances. From the cross-validation analysis. For each fold of each repeat, each cross distinguished by a unique pair of sireID and damID is given. The genetic model used (Model: A, AD, DirDomAD, DirDomBV), whether the prediction is of family variance in breeding value (predOf=VarBV) or variance in total genetic value (predOf=VarTGV), the trait (BiofortSI or StdSI), type of observation (ValidationData: GBLUPs or iidBLUPs) and corresponding prediction (predVar) and observations (obsVar) are shown. The predictions are based on either only the variance of posterior means (VarMethod=VPM) or the posterior mean variances (VarMethod=PMV). The family size (number of genotyped offspring, FamSize) or number of offspring with direct phenotypes (Nobs) are used to weight the correlation (CorrWeight) between observed and predicted family variances.

obsVSpredVars<-readRDS(here::here("output","obsVSpredVars.rds"))
write.csv(obsVSpredVars,file = here::here("manuscript", "SupplementaryTable08.csv"), row.names = F)
#suptables[["TableS08"]]<-obsVSpredVars
obsVSpredVars %>% str
tibble [797,184 × 15] (S3: tbl_df/tbl/data.frame)
 $ Repeat        : chr [1:797184] "Repeat1" "Repeat1" "Repeat1" "Repeat1" ...
 $ Fold          : chr [1:797184] "Fold1" "Fold1" "Fold1" "Fold1" ...
 $ Model         : chr [1:797184] "A" "A" "A" "A" ...
 $ sireID        : chr [1:797184] "IITA-TMS-BAD9200068" "IITA-TMS-BAD9200068" "IITA-TMS-BAD9200068" "IITA-TMS-BAD9200068" ...
 $ damID         : chr [1:797184] "IITA-TMS-IBA000211" "IITA-TMS-IBA000211" "IITA-TMS-IBA000211" "IITA-TMS-IBA000211" ...
 $ Trait1        : chr [1:797184] "biofortSI" "biofortSI" "DM" "DM" ...
 $ Trait2        : chr [1:797184] "biofortSI" "biofortSI" "DM" "DM" ...
 $ VarMethod     : chr [1:797184] "PMV" "VPM" "PMV" "VPM" ...
 $ predVar       : num [1:797184] 55.3669 5.8562 4.3495 0.355 -0.0762 ...
 $ predOf        : chr [1:797184] "VarBV" "VarBV" "VarBV" "VarBV" ...
 $ obsVar        : num [1:797184] 14.574 14.574 2.303 2.303 -0.045 ...
 $ ValidationData: chr [1:797184] "GBLUPs" "GBLUPs" "GBLUPs" "GBLUPs" ...
 $ FamSize       : num [1:797184] 13 13 13 13 13 13 13 13 13 13 ...
 $ Nobs          : num [1:797184] 6 6 6 6 6 6 6 6 6 6 ...
 $ CorrWeight    : num [1:797184] 13 13 13 13 13 13 13 13 13 13 ...
obsVSpredVars %>% count(Model,predOf,VarMethod,ValidationData) %>% spread(ValidationData,n) %>% rmarkdown::paged_table()

Table S9: Predicted vs observed UC

Table S9: Predicted versus observed UC. For each fold of each repeat, each cross distinguished by a unique pair of sireID and damID is given. The predicted usefulness criterion (predUC) was computed as the predMean + realIntensity*predSD, where predMean is the predicted family mean and predSD is the predicted genetic standard deviation. The genetic model used (Model: A, AD, DirDomAD, DirDomBV), whether the prediction is of family variance in breeding value (predOf=VarBV) or variance in total genetic value (predOf=VarTGV), the trait (BiofortSI or StdSI) and corresponding prediction (predUC) and observations (obsUC) are shown. The family size (number of genotyped offspring, FamSize) is shown along with the realized selection intensity (realIntensity) for each selection stage in the breeding pipeline (Parent, CET, PYT, AYT, UYT) and also a constant intensity value (Stage=ConstIntensity).

obsVSpredUC<-readRDS(here::here("output","obsVSpredUC.rds"))
write.csv(obsVSpredUC,file = here::here("manuscript", "SupplementaryTable09.csv"), row.names = F)
#suptables[["TableS09"]]<-obsVSpredUC
obsVSpredUC %>% str
tibble [391,848 × 15] (S3: tbl_df/tbl/data.frame)
 $ Repeat       : chr [1:391848] "Repeat1" "Repeat1" "Repeat1" "Repeat1" ...
 $ Fold         : chr [1:391848] "Fold1" "Fold1" "Fold1" "Fold1" ...
 $ Model        : chr [1:391848] "A" "A" "A" "A" ...
 $ sireID       : chr [1:391848] "IITA-TMS-IBA030075" "IITA-TMS-IBA030075" "IITA-TMS-IBA030075" "IITA-TMS-IBA030075" ...
 $ damID        : chr [1:391848] "IITA-TMS-IBA940006" "IITA-TMS-IBA940006" "IITA-TMS-IBA940006" "IITA-TMS-IBA940006" ...
 $ Trait        : chr [1:391848] "biofortSI" "biofortSI" "DM" "DM" ...
 $ VarMethod    : chr [1:391848] "PMV" "VPM" "PMV" "VPM" ...
 $ predOf       : chr [1:391848] "BV" "BV" "BV" "BV" ...
 $ predMean     : num [1:391848] 4.49 4.49 1.4605 1.4605 0.0746 ...
 $ predSD       : num [1:391848] 7.263 2.294 2.055 0.626 0.186 ...
 $ FamSize      : num [1:391848] 38 38 38 38 38 38 38 38 38 38 ...
 $ realIntensity: num [1:391848] 2.32 2.32 2.32 2.32 2.32 ...
 $ Stage        : chr [1:391848] "Parent" "Parent" "Parent" "Parent" ...
 $ predUC       : num [1:391848] 21.327 9.807 6.225 2.913 0.505 ...
 $ obsUC        : num [1:391848] -0.886 -0.886 1.805 1.805 0.121 ...
obsVSpredUC %>% count(Model,predOf,VarMethod,Stage) %>% spread(VarMethod,n) %>% rmarkdown::paged_table()

Table S10: Accuracies predicting the mean

Table S10: Accuracies predicting the mean. For each fold of each repeat, the accuracy predicting family means (Accuracy) is given. The genetic model used (Model: A, AD, DirDomAD, DirDomBV), whether the prediction is of mean breeding value (predOf=MeanBV) or mean total genetic value (predOf=MeanTGV), the trait (BiofortSI or StdSI), type of observation (ValidationData: GBLUPs or iidBLUPs) are shown.

accMeans<-readRDS(here::here("output","accuraciesMeans.rds"))
suptables[["TableS10"]]<-accMeans
accMeans %>% str
tibble [1,200 × 7] (S3: tbl_df/tbl/data.frame)
 $ Repeat        : chr [1:1200] "Repeat1" "Repeat1" "Repeat1" "Repeat1" ...
 $ Fold          : chr [1:1200] "Fold1" "Fold1" "Fold1" "Fold1" ...
 $ Model         : chr [1:1200] "A" "A" "AD" "AD" ...
 $ predOf        : chr [1:1200] "MeanBV" "MeanBV" "MeanTGV" "MeanTGV" ...
 $ Trait         : chr [1:1200] "stdSI" "biofortSI" "stdSI" "biofortSI" ...
 $ ValidationData: chr [1:1200] "GBLUPs" "GBLUPs" "GBLUPs" "GBLUPs" ...
 $ Accuracy      : num [1:1200] 0.525 0.626 0.441 0.564 0.446 ...
#accMeans %>% count(Model,predOf,ValidationData,Trait) %>% spread(Trait,n) %>% rmarkdown::paged_table()

Table S11: Accuracies predicting the variances

Table S11: Accuracy of predicting the variances. For each fold of each repeat the estimated accuracy of predicting family variances is given. Accuracy was computed the correlation between predicted and observed variance, either weighted by family size (AccuracyWtCor) or not (AccuracyCor). The genetic model used (Model: A, AD, DirDomAD, DirDomBV), whether the prediction is of family variance in breeding value (predOf=VarBV) or variance in total genetic value (predOf=VarTGV), the trait (BiofortSI or StdSI), type of observation (ValidationData: GBLUPs or iidBLUPs) are shown. The predictions are based on either only the variance of posterior means (VarMethod=VPM) or the posterior mean variances (VarMethod=PMV).

accVars<-readRDS(here::here("output","accuraciesVars.rds"))
suptables[["TableS11"]]<-accVars
accVars %>% str
tibble [4,800 × 10] (S3: tbl_df/tbl/data.frame)
 $ Repeat        : chr [1:4800] "Repeat1" "Repeat1" "Repeat1" "Repeat1" ...
 $ Fold          : chr [1:4800] "Fold1" "Fold1" "Fold1" "Fold1" ...
 $ Model         : chr [1:4800] "A" "A" "A" "A" ...
 $ Trait1        : chr [1:4800] "biofortSI" "biofortSI" "DM" "DM" ...
 $ Trait2        : chr [1:4800] "biofortSI" "biofortSI" "DM" "DM" ...
 $ VarMethod     : chr [1:4800] "PMV" "VPM" "PMV" "VPM" ...
 $ predOf        : chr [1:4800] "VarBV" "VarBV" "VarBV" "VarBV" ...
 $ ValidationData: chr [1:4800] "GBLUPs" "GBLUPs" "GBLUPs" "GBLUPs" ...
 $ AccuracyWtCor : num [1:4800] 0.0679 0.1221 0.0302 0.1362 -0.0429 ...
 $ AccuracyCor   : num [1:4800] 0.0818 0.1916 0.0392 0.1186 -0.0373 ...
accVars %>% #mutate(Trait1_Trait2=paste0(Trait1,"_",Trait2)) %>% 
  count(Model,predOf,VarMethod,ValidationData) %>% rmarkdown::paged_table()

Table S12: Accuracies predicting the usefulness criteria

Table S12: Accuracy predicting the usefulness criteria. For each fold of each repeat the estimated accuracy of predicting family usefulness criteria is given. Accuracy was computed as the correlation between predicted UC and observed UC (mean of selected offspring), either weighted by family size (AccuracyWtCor) or not (AccuracyCor). The genetic model used (Model: A, AD, DirDomAD, DirDomBV), whether the prediction is of UC in breeding value (predOf=VarBV) or UC in total genetic value (predOf=VarTGV), the trait (BiofortSI or StdSI), type of observation (ValidationData: GBLUPs or iidBLUPs) are shown. The predictions of cross variance used to compute the UC are based on either only the variance of posterior means (VarMethod=VPM) or the posterior mean variances (VarMethod=PMV).

accUC<-readRDS(here::here("output","accuraciesUC.rds"))
suptables[["TableS12"]]<-accUC
accUC %>% str
tibble [4,200 × 9] (S3: tbl_df/tbl/data.frame)
 $ Repeat       : chr [1:4200] "Repeat1" "Repeat1" "Repeat1" "Repeat1" ...
 $ Fold         : chr [1:4200] "Fold1" "Fold1" "Fold1" "Fold1" ...
 $ Model        : chr [1:4200] "A" "A" "A" "A" ...
 $ Trait        : chr [1:4200] "biofortSI" "biofortSI" "DM" "DM" ...
 $ VarMethod    : chr [1:4200] "PMV" "VPM" "PMV" "VPM" ...
 $ predOf       : chr [1:4200] "BV" "BV" "BV" "BV" ...
 $ Stage        : chr [1:4200] "Parent" "Parent" "Parent" "Parent" ...
 $ AccuracyWtCor: num [1:4200] 0.479 0.705 0.69 0.76 0.753 ...
 $ AccuracyCor  : num [1:4200] 0.187 0.472 0.672 0.796 0.511 ...
accUC %>%
  count(Model,predOf,VarMethod,Stage,Trait) %>% spread(Trait,n) %>% rmarkdown::paged_table()

Table S13: Realized within-cross selection metrics

Table S13: Realized within-cross selection metrics. Table summarizing measurements made of selection within each cross (unique sireID-damID). Summaries included: family size (FamSize), number (NmembersUsedAsParent) and proportion of members used as parents (propUsedAsParent), mean GEBV and GETGV of top 1% of each family (meanTop1pctGEBV, meanTop1pctGETGV), for each selection index Trait (Trait: BiofortSI, StdSI), proportion of each family that has been phenotyped (propPhenotyped, NmembersPhenotyped) and past each stage of the breeding pipeline (propPast and NmembersPast CET, PYT, AYT) and finally the corresponding realized intensity of selection for each stage (e.g. realIntensityAYT).

realizedcrossmetrics<-readRDS(file=here::here("output/crossRealizations","realizedCrossMetrics.rds"))
realizedcrossmetrics %<>% 
  select(-Repeat,-Fold,-Model,-contains("realizedUC")) %>% 
  ungroup() %>% 
  distinct %>% 
  arrange(desc(FamSize))
suptables[["TableS13"]]<-realizedcrossmetrics
realizedcrossmetrics %>% str
tibble [49,824 × 21] (S3: tbl_df/tbl/data.frame)
 $ sireID              : chr [1:49824] "IITA-TMS-IBA011412" "IITA-TMS-IBA011412" "IITA-TMS-IBA011412" "IITA-TMS-IBA011412" ...
 $ damID               : chr [1:49824] "IITA-TMS-IBA020129" "IITA-TMS-IBA020129" "IITA-TMS-IBA020129" "IITA-TMS-IBA020129" ...
 $ Trait               : chr [1:49824] "stdSI" "biofortSI" "DM" "logFYLD" ...
 $ FamSize             : num [1:49824] 72 72 72 72 72 72 72 72 72 72 ...
 $ NmembersUsedAsParent: num [1:49824] 5 5 5 5 5 5 5 5 5 5 ...
 $ propUsedAsParent    : num [1:49824] 0.0694 0.0694 0.0694 0.0694 0.0694 ...
 $ meanTop1pctGEBV     : num [1:49824] 2.735 15.09 0.231 0.23 1.092 ...
 $ NmembersPhenotyped  : num [1:49824] 71 71 71 71 71 71 71 71 71 71 ...
 $ NmembersPastCET     : num [1:49824] 13 13 13 13 13 13 13 13 13 13 ...
 $ NmembersPastPYT     : num [1:49824] 6 6 6 6 6 6 6 6 6 6 ...
 $ NmembersPastAYT     : num [1:49824] 0 0 0 0 0 0 0 0 0 0 ...
 $ propPhenotyped      : num [1:49824] 0.986 0.986 0.986 0.986 0.986 ...
 $ propPastCET         : num [1:49824] 0.181 0.181 0.181 0.181 0.181 ...
 $ propPastPYT         : num [1:49824] 0.0833 0.0833 0.0833 0.0833 0.0833 ...
 $ propPastAYT         : num [1:49824] 0 0 0 0 0 0 0 0 0 0 ...
 $ meanTop1pctGETGV    : num [1:49824] 4.923 14.044 0.989 0.323 1.377 ...
 $ realIntensityParent : num [1:49824] 1.92 1.92 1.92 1.92 1.92 ...
 $ realIntensityCET    : num [1:49824] 0.0359 0.0359 0.0359 0.0359 0.0359 ...
 $ realIntensityPYT    : num [1:49824] 1.46 1.46 1.46 1.46 1.46 ...
 $ realIntensityAYT    : num [1:49824] 1.84 1.84 1.84 1.84 1.84 ...
 $ realIntensityUYT    : num [1:49824] NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN ...

Table S14: Proportion homozygous per clone

Table S14: Genome-wide proportion of SNPs that are homozygous, for each clone (GID=germplasmName).

library(tidyverse); library(magrittr); library(rsample); library(predCrossVar)
ped<-readRDS(here::here("data","ped_awc.rds"))
snps<-readRDS(here::here("data","dosages_awc.rds"))
snps %<>% 
  .[rownames(snps) %in% ped$FullSampleName,] %>% 
  remove_invariant(.); dim(snps) # [1]  3199 33370
f<-getPropHom(snps)
propHom<-tibble(GID=names(f), PropSNP_homozygous=as.numeric(f))
saveRDS(propHom,file=here::here("output","propHomozygous.rds"))
propHom<-readRDS(file=here::here("output","propHomozygous.rds"))
suptables[["TableS14"]]<-propHom
head(propHom) %>% rmarkdown::paged_table()

Table S15: Variance estimates for genetic groups

Table S15: Variance-covariance estimates for each genetic group. Summary of the population-level genetic variance estimates in each genetic group (GG=C0, TMS13=C1, TMS14=C2, TMS15=C3), for each genetic model (Model: A, AD, DirDomA, DirDomAD), each variance (Trait1==Trait2) and covariance (Trait1!=Trait2). The estimates are computed both based on the variance of posterior means (VarMethod=VPM) and the posterior mean variances (VarMethod=PMV). The “Method” refers to whether linkage disequilibrium is accounted for (M2) or not (M1).

varcomps_geneticgroups<-readRDS(here::here("output","pmv_varcomps_geneticgroups_tidy_includingSIvars.rds"))
varcomps_geneticgroups %<>% 
  spread(VarComp,Var) %>% 
  mutate_if(is.numeric,~round(.,6)) %>% 
  mutate(propDom=ifelse(!is.na(VarD),round(VarD/(VarA+VarD),2),0)) %>% 
  select(-outName) %>%
  arrange(VarMethod,desc(Method))
suptables[["TableS15"]]<-varcomps_geneticgroups
varcomps_geneticgroups %>% rmarkdown::paged_table()
varcomps_geneticgroups %>% count(Method,VarMethod) %>% rmarkdown::paged_table()
varcomps_geneticgroups %>% count(Group,Model) %>% spread(Model,n) %>% rmarkdown::paged_table()

Table S16: Directional dominance effects estimates

Table S16: Directional dominance effects estimates. Based on the directional dominance model, the genome-wide posterior mean (InbreedingEffect) and posterior standard deviation (InbreedingEffectSD) inbreeding effect is given. Estimates are provided for each trait, genetic group (Group), and each repeat-fold of the cross-validation study.

ddEffects<-readRDS(file=here::here("output","ddEffects.rds"))
ddEffects %<>% 
  mutate(Group=ifelse(is.na(Group),"ParentwiseCV",Group))
suptables[["TableS16"]]<-ddEffects
ddEffects %>% rmarkdown::paged_table()
ddEffects %>% count(Group,Dataset,Trait) %>% spread(Trait,n) %>% arrange(Dataset)
# A tibble: 7 x 6
  Group        Dataset          DM logFYLD MCMDS TCHART
  <chr>        <chr>         <int>   <int> <int>  <int>
1 All          GeneticGroups     1       1     1      1
2 GG           GeneticGroups     1       1     1      1
3 TMS13        GeneticGroups     1       1     1      1
4 TMS14        GeneticGroups     1       1     1      1
5 TMS15        GeneticGroups     1       1     1      1
6 ParentwiseCV testset          25      25    25     25
7 ParentwiseCV trainset         25      25    25     25

Table S17: Predictions of untested crosses

Table S17: Predictions of untested crosses. Compiled predictions of 47,083 possible crosses (sireID x damID) of 306 parents. Predictions were made with two additive-dominance genetic models: either with (Model=DirDomAD) or without (Model=ClassicAD) a directional dominance term. The predictions included are the cross mean (predMeanBV,predMeanGV), standard deviation (predSdBV,predSdGV) and usefulness (predUCparent,predUCvariety) in terms of breeding (BV) and total genetic (GV) value. Additional information provided for each cross include: whether the cross is a self (IsSelf=T/F), has previously been made (CrossPrevMade=Yes/No), the number of segregating SNPs expected in the family (Nsegsnps) and the parental GEBV (sireGEBV, damGEBV).

library(tidyverse); library(magrittr);
predUntestedCrossMeans<-readRDS(here::here("output/crossPredictions","predictedUntestedCrossMeans_SelIndices.rds"))
#predUntestedCrossMeans %>% count(Model)
predUntestedCrossVars<-readRDS(here::here("output/crossPredictions","predictedUntestedCrossVars_SelIndices.rds"))
#predUntestedCrossVars %>% count(Model,predOf)
predUntestedCrosses<-predUntestedCrossMeans %>% 
  left_join(predUntestedCrossVars %>% 
              rename(Trait=Trait1) %>% select(-Trait2) %>% 
              mutate(Model=ifelse(Model %in% c("A","AD"),"ClassicAD","DirDom")) %>% 
              spread(predOf,predVar))
#
predUntestedCrosses %<>% 
  mutate(VarTGV=VarA+VarD,
         predSdBV=sqrt(VarBV),
         predSdTGV=sqrt(VarTGV)) %>% 
  select(-VarBV,-VarTGV,-VarA,-VarD) %>% 
# Mean prop. selected is 2% for "parents" and 5% for "varieties" (AYT stage). 
# Since in general, we want to use fewer crosses with more progeny, let's use 1% (std. sel. intensity = 2.67) for predicting UC.
# predCrossVar::intensity(0.01) %>% round(.,2) # [1] 2.67
  mutate(predUCparent=predMeanBV+(2.67*predSdBV),
         predUCvariety=predMeanGV+(2.67*predSdTGV))
ped<-readRDS(here::here("data","ped_awc.rds"))
predUntestedCrosses %<>% 
  left_join(ped %>% distinct(sireID,damID) %>% mutate(CrossPrevMade="Yes")) %>% 
  mutate(CrossPrevMade=ifelse(is.na(CrossPrevMade),"No",CrossPrevMade),
         IsSelf=ifelse(sireID==damID,TRUE,FALSE))
rm(ped)
predUntestedCrosses %>% str
tibble [188,332 × 15] (S3: tbl_df/tbl/data.frame)
 $ sireID       : chr [1:188332] "IITA-TMS-BAD9200061" "IITA-TMS-BAD9200061" "IITA-TMS-BAD9200061" "IITA-TMS-BAD9200061" ...
 $ damID        : chr [1:188332] "IITA-TMS-BAD9200061" "IITA-TMS-BAD9200061" "IITA-TMS-BAD9200061" "IITA-TMS-BAD9200061" ...
 $ Model        : chr [1:188332] "ClassicAD" "ClassicAD" "DirDom" "DirDom" ...
 $ Trait        : chr [1:188332] "stdSI" "biofortSI" "stdSI" "biofortSI" ...
 $ sireGEBV     : num [1:188332] -1.86 -8.1 -2.77 -8.81 -1.86 ...
 $ damGEBV      : num [1:188332] -1.86 -8.1 -2.77 -8.81 1.52 ...
 $ predMeanBV   : num [1:188332] -1.86 -8.1 -2.77 -8.81 -0.17 ...
 $ predMeanGV   : num [1:188332] 4.07 -2.5 12.66 -1.76 12.32 ...
 $ Nsegsnps     : num [1:188332] 5223 5223 5223 5223 7789 ...
 $ predSdBV     : num [1:188332] 2.92 2.44 3.27 2.65 3.18 ...
 $ predSdTGV    : num [1:188332] 3.69 2.94 3.38 2.63 3.78 ...
 $ predUCparent : num [1:188332] 5.94 -1.58 5.95 -1.75 8.31 ...
 $ predUCvariety: num [1:188332] 13.93 5.36 21.68 5.26 22.42 ...
 $ CrossPrevMade: chr [1:188332] "No" "No" "No" "No" ...
 $ IsSelf       : logi [1:188332] TRUE TRUE TRUE TRUE FALSE FALSE ...
write.csv(predUntestedCrosses,file = here::here("manuscript", "SupplementaryTable17.csv"), row.names = F)
#suptables[["TableS17"]]<-predUntestedCrosses

Table S18: Long-form table of predictions about untested crosses

Table S18: Long-form table of predictions about untested crosses. Compiled predictions of 47,083 possible crosses (sireID x damID) of 306 parents. Predictions were made with two additive-dominance genetic models: either with (Model=DirDomAD) or without (Model=ClassicAD) a directional dominance term. The predictions (Pred) included are of the cross mean (PredOf=Mean), standard deviation (PredOf=Sd) and usefulness (PredOf=UC) in terms of breeding (Component=BV) and total genetic (Component=GV) value. Additional information provided for each cross include: whether the cross is a self (IsSelf=T/F) and has previously been made (CrossPrevMade=Yes/No).

predBVs<-predUntestedCrosses %>%
  select(sireID,damID,IsSelf,CrossPrevMade,Model,Trait,predMeanBV,predSdBV,predUCparent) %>% 
  rename(predMean=predMeanBV,
         predSd=predSdBV,
         predUC=predUCparent) %>% 
  pivot_longer(cols = c(predMean,predSd,predUC), names_to = "PredOf", values_to = "Pred",names_prefix = "pred")

predTGVs<-predUntestedCrosses %>%
  select(sireID,damID,IsSelf,CrossPrevMade,Model,Trait,predMeanGV,predSdTGV,predUCvariety) %>% 
  rename(predMean=predMeanGV,
         predSd=predSdTGV,
         predUC=predUCvariety) %>% 
  pivot_longer(cols = c(predMean,predSd,predUC), names_to = "PredOf", values_to = "Pred",names_prefix = "pred")

predUntestedCrosses_long<-bind_rows(predBVs %>% mutate(Component="BV"),
                                    predTGVs %>% mutate(Component="TGV"))
# predUntestedCrosses_long %<>% 
#   left_join(predUntestedCrosses_long %>% 
#               group_by(Trait,Model,PredOf,Component) %>%  
#               summarise(top1pct = quantile(Pred, 0.99)) %>% 
#               ungroup()) %>% 
#   mutate(Selected=ifelse(Pred>=top1pct,"Selected","NotSelected")) %>% 
#   mutate_all(~`attributes<-`(.,NULL))
predUntestedCrosses_long %>% str
tibble [1,129,992 × 9] (S3: tbl_df/tbl/data.frame)
 $ sireID       : chr [1:1129992] "IITA-TMS-BAD9200061" "IITA-TMS-BAD9200061" "IITA-TMS-BAD9200061" "IITA-TMS-BAD9200061" ...
 $ damID        : chr [1:1129992] "IITA-TMS-BAD9200061" "IITA-TMS-BAD9200061" "IITA-TMS-BAD9200061" "IITA-TMS-BAD9200061" ...
 $ IsSelf       : logi [1:1129992] TRUE TRUE TRUE TRUE TRUE TRUE ...
 $ CrossPrevMade: chr [1:1129992] "No" "No" "No" "No" ...
 $ Model        : chr [1:1129992] "ClassicAD" "ClassicAD" "ClassicAD" "ClassicAD" ...
 $ Trait        : chr [1:1129992] "stdSI" "stdSI" "stdSI" "biofortSI" ...
 $ PredOf       : chr [1:1129992] "Mean" "Sd" "UC" "Mean" ...
 $ Pred         : num [1:1129992] -1.86 2.92 5.94 -8.1 2.44 ...
 $ Component    : chr [1:1129992] "BV" "BV" "BV" "BV" ...
predUntestedCrosses_long %>% 
  count(Trait,Model,PredOf,Component) %>% spread(Trait,n) %>% rmarkdown::paged_table()
write.csv(predUntestedCrosses_long,file = here::here("manuscript", "SupplementaryTable18.csv"), row.names = F)
#suptables[["TableS18"]]<-predUntestedCrosses_long
rm(list=grep("suptables",ls(),invert = T, value = T)); gc()
          used (Mb) gc trigger  (Mb) limit (Mb) max used  (Mb)
Ncells 1205621 64.4    3794854 202.7         NA  4743567 253.4
Vcells 3694063 28.2   48780348 372.2      65536 60796521 463.9

Table S19: Top 50 crosses selected by each criterion

Table S19: Top 50 crosses (sireID x damID) selected by each of 16 predictions of 47,083 crosses. Predictions for each trait were made with two additive-dominance genetic models: either with (Model=DirDomAD) or without (Model=ClassicAD) a directional dominance term. The predictions (Pred) selected on are of the cross mean (PredOf=Mean), standard deviation (PredOf=Sd) and usefulness (PredOf=UC) in terms of breeding (Component=BV) and total genetic (Component=GV) value. Additional information provided for each cross include: whether the cross is a self (IsSelf=T/F) and has previously been made (CrossPrevMade=Yes/No).

library(tidyverse); library(magrittr); library(ggforce)
predUntestedCrosses<-read.csv(here::here("manuscript","SupplementaryTable18.csv"),stringsAsFactors = F)
top50crosses<-predUntestedCrosses %>% 
  filter(PredOf!="Sd") %>%
  group_by(Trait,Model,PredOf,Component) %>% 
  slice_max(order_by = Pred,n=50) %>% ungroup()
suptables[["TableS19"]]<-top50crosses
top50crosses %>% str
tibble [800 × 9] (S3: tbl_df/tbl/data.frame)
 $ sireID       : chr [1:800] "IITA-TMS-IBA011412" "IITA-TMS-IBA011412" "IITA-TMS-IBA011412" "IITA-TMS-IBA011412" ...
 $ damID        : chr [1:800] "IITA-TMS-IBA011412" "TMS14F1166P0002" "TMS14F1123P0001" "IITA-TMS-IBA011371" ...
 $ IsSelf       : logi [1:800] TRUE FALSE FALSE FALSE FALSE TRUE ...
 $ CrossPrevMade: chr [1:800] "No" "No" "No" "No" ...
 $ Model        : chr [1:800] "ClassicAD" "ClassicAD" "ClassicAD" "ClassicAD" ...
 $ Trait        : chr [1:800] "biofortSI" "biofortSI" "biofortSI" "biofortSI" ...
 $ PredOf       : chr [1:800] "Mean" "Mean" "Mean" "Mean" ...
 $ Pred         : num [1:800] 18 17.6 17.6 17.6 17.3 ...
 $ Component    : chr [1:800] "BV" "BV" "BV" "BV" ...

Write SupplementaryTables.xlsx

writexl::write_xlsx(suptables,path = here::here("manuscript","SupplementaryTables.xlsx"),format_headers =FALSE)

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] ggforce_0.3.3      predCrossVar_0.1.0 magrittr_2.0.1     forcats_0.5.1     
 [5] stringr_1.4.0      dplyr_1.0.5        purrr_0.3.4        readr_1.4.0       
 [9] tidyr_1.1.3        tibble_3.1.0       ggplot2_3.3.3      tidyverse_1.3.0   
[13] writexl_1.3.1      workflowr_1.6.2   

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