Last updated: 2021-07-29

Checks: 7 0

Knit directory: implementGMSinCassava/

This reproducible R Markdown analysis was created with workflowr (version 1.6.2). The Checks tab describes the reproducibility checks that were applied when the results were created. The Past versions tab lists the development history.


Great! Since the R Markdown file has been committed to the Git repository, you know the exact version of the code that produced these results.

Great job! The global environment was empty. Objects defined in the global environment can affect the analysis in your R Markdown file in unknown ways. For reproduciblity it’s best to always run the code in an empty environment.

The command set.seed(20210504) was run prior to running the code in the R Markdown file. Setting a seed ensures that any results that rely on randomness, e.g. subsampling or permutations, are reproducible.

Great job! Recording the operating system, R version, and package versions is critical for reproducibility.

Nice! There were no cached chunks for this analysis, so you can be confident that you successfully produced the results during this run.

Great job! Using relative paths to the files within your workflowr project makes it easier to run your code on other machines.

Great! You are using Git for version control. Tracking code development and connecting the code version to the results is critical for reproducibility.

The results in this page were generated with repository version bc85a7d. See the Past versions tab to see a history of the changes made to the R Markdown and HTML files.

Note that you need to be careful to ensure that all relevant files for the analysis have been committed to Git prior to generating the results (you can use wflow_publish or wflow_git_commit). workflowr only checks the R Markdown file, but you know if there are other scripts or data files that it depends on. Below is the status of the Git repository when the results were generated:


Ignored files:
    Ignored:    .DS_Store
    Ignored:    .Rhistory
    Ignored:    .Rproj.user/
    Ignored:    analysis/.DS_Store
    Ignored:    analysis/accuracies.png
    Ignored:    analysis/fig2.png
    Ignored:    analysis/fig3.png
    Ignored:    analysis/fig4.png
    Ignored:    code/.DS_Store
    Ignored:    data/.DS_Store

Untracked files:
    Untracked:  accuracies.png
    Untracked:  analysis/docs/
    Untracked:  analysis/speedUpPredCrossVar.Rmd
    Untracked:  data/AllChrom_RefPanelAndGSprogeny_ReadyForGP_72719.bed
    Untracked:  data/AllChrom_RefPanelAndGSprogeny_ReadyForGP_72719.bim
    Untracked:  data/AllChrom_RefPanelAndGSprogeny_ReadyForGP_72719.fam
    Untracked:  data/AllChrom_RefPanelAndGSprogeny_ReadyForGP_72719.hap.gz
    Untracked:  data/AllChrom_RefPanelAndGSprogeny_ReadyForGP_72719.log
    Untracked:  data/AllChrom_RefPanelAndGSprogeny_ReadyForGP_72719.nosex
    Untracked:  data/AllChrom_RefPanelAndGSprogeny_ReadyForGP_72719.sample
    Untracked:  data/AllChrom_RefPanelAndGSprogeny_ReadyForGP_72719.vcf.gz
    Untracked:  data/DatabaseDownload_2021May04/
    Untracked:  data/blups_forCrossVal.rds
    Untracked:  data/config.txt
    Untracked:  data/config_mw.txt
    Untracked:  data/dosages_IITA_2021May13.rds
    Untracked:  data/dosages_IITA_filtered_2021May13.rds
    Untracked:  data/genmap_2021May13.rds
    Untracked:  data/haps_IITA_2021May13.rds
    Untracked:  data/haps_IITA_filtered_2021May13.rds
    Untracked:  data/recombFreqMat_1minus2c_2021May13.rds
    Untracked:  fig2.png
    Untracked:  fig3.png
    Untracked:  figure/
    Untracked:  output/Cassava_HMII_V3_Marning_imputation_6-18-21.samples
    Untracked:  output/IITA_CleanedTrialData_2021May10.rds
    Untracked:  output/IITA_ExptDesignsDetected_2021May10.rds
    Untracked:  output/IITA_blupsForModelTraining_twostage_asreml_2021May10.rds
    Untracked:  output/IITA_trials_NOT_identifiable.csv
    Untracked:  output/alphaAssignOutput_iita_pedigree.txt.dams
    Untracked:  output/alphaAssignOutput_iita_pedigree.txt.dams.full
    Untracked:  output/alphaAssignOutput_iita_pedigree.txt.pedigree
    Untracked:  output/alphaAssignOutput_iita_pedigree.txt.pedigree.top
    Untracked:  output/alphaAssignOutput_iita_pedigree.txt.sires
    Untracked:  output/alphaAssignOutput_iita_pedigree.txt.sires.full
    Untracked:  output/crossValPredsA.rds
    Untracked:  output/crossValPredsAD.rds
    Untracked:  output/cvAD_1rep_markerEffects.rds
    Untracked:  output/cvAD_1rep_meanPredAccuracy.rds
    Untracked:  output/cvAD_1rep_parentfolds.rds
    Untracked:  output/cvAD_1rep_predAccuracy.rds
    Untracked:  output/cvAD_1rep_predMeans.rds
    Untracked:  output/cvAD_1rep_predVars.rds
    Untracked:  output/cvAD_1rep_varPredAccuracy.rds
    Untracked:  output/cvAD_5rep5fold_markerEffects.rds
    Untracked:  output/cvAD_5rep5fold_meanPredAccuracy.rds
    Untracked:  output/cvAD_5rep5fold_parentfolds.rds
    Untracked:  output/cvAD_5rep5fold_predMeans.rds
    Untracked:  output/cvAD_5rep5fold_predVars.rds
    Untracked:  output/cvAD_5rep5fold_varPredAccuracy.rds
    Untracked:  output/cvDirDom_5rep5fold_markerEffects.rds
    Untracked:  output/cvDirDom_5rep5fold_meanPredAccuracy.rds
    Untracked:  output/cvDirDom_5rep5fold_parentfolds.rds
    Untracked:  output/cvDirDom_5rep5fold_predMeans.rds
    Untracked:  output/cvDirDom_5rep5fold_predVars.rds
    Untracked:  output/cvDirDom_5rep5fold_varPredAccuracy.rds
    Untracked:  output/cvMeanPredAccuracyA.rds
    Untracked:  output/cvMeanPredAccuracyAD.rds
    Untracked:  output/cvPredMeansA.rds
    Untracked:  output/cvPredMeansAD.rds
    Untracked:  output/cvVarPredAccuracyA.rds
    Untracked:  output/cvVarPredAccuracyAD.rds
    Untracked:  output/genomicMatePredictions_top121parents_ModelAD.csv
    Untracked:  output/genomicMatePredictions_top121parents_ModelAD.rds
    Untracked:  output/genomicMatePredictions_top121parents_ModelDirDom.csv
    Untracked:  output/genomicMatePredictions_top121parents_ModelDirDom.rds
    Untracked:  output/genomicPredictions_ModelAD.csv
    Untracked:  output/genomicPredictions_ModelAD.rds
    Untracked:  output/genomicPredictions_ModelDirDom.csv
    Untracked:  output/genomicPredictions_ModelDirDom.rds
    Untracked:  output/kinship_A_IITA_2021May13.rds
    Untracked:  output/kinship_D_IITA_2021May13.rds
    Untracked:  output/kinship_domGenotypic_IITA_2021July5.rds
    Untracked:  output/markEffsTest.rds
    Untracked:  output/markerEffects.rds
    Untracked:  output/markerEffectsA.rds
    Untracked:  output/markerEffectsAD.rds
    Untracked:  output/maxNOHAV_byStudy.csv
    Untracked:  output/obsCrossMeansAndVars.rds
    Untracked:  output/parentfolds.rds
    Untracked:  output/ped2check_genome.rds
    Untracked:  output/ped2genos.txt
    Untracked:  output/pednames2keep.txt
    Untracked:  output/pednames_Prune100_25_pt25.log
    Untracked:  output/pednames_Prune100_25_pt25.nosex
    Untracked:  output/pednames_Prune100_25_pt25.prune.in
    Untracked:  output/pednames_Prune100_25_pt25.prune.out
    Untracked:  output/potential_dams.txt
    Untracked:  output/potential_sires.txt
    Untracked:  output/predVarTest.rds
    Untracked:  output/samples2keep_IITA_2021May13.txt
    Untracked:  output/samples2keep_IITA_MAFpt01_prune50_25_pt98.log
    Untracked:  output/samples2keep_IITA_MAFpt01_prune50_25_pt98.nosex
    Untracked:  output/samples2keep_IITA_MAFpt01_prune50_25_pt98.prune.in
    Untracked:  output/samples2keep_IITA_MAFpt01_prune50_25_pt98.prune.out
    Untracked:  output/samples2keep_notInPHGdb.txt
    Untracked:  output/test_cvAD_markerEffects.rds
    Untracked:  output/test_cvAD_meanPredAccuracy.rds
    Untracked:  output/test_cvAD_parentfolds.rds
    Untracked:  output/test_cvAD_predAccuracy.rds
    Untracked:  output/test_cvAD_predMeans.rds
    Untracked:  output/test_cvAD_predVars.rds
    Untracked:  output/test_cvAD_varPredAccuracy.rds
    Untracked:  output/top50crosses.csv
    Untracked:  output/verified_ped.txt

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/06-GenomicPredictions.Rmd) and HTML (docs/06-GenomicPredictions.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 c843dbd wolfemd 2021-07-29 Tidy, completed version.
Rmd 6eb6a62 wolfemd 2021-07-29 Debugging and full benchmark run work shown.
Rmd 1d017cb wolfemd 2021-07-25 Debugging completed for predictCrosses(). Work shown and tests passed also shown. Full run underway.
html 934141c wolfemd 2021-07-14 Build site.
html cc1eb4b wolfemd 2021-07-14 Build site.
Rmd 772750a wolfemd 2021-07-14 DirDom model and selection index calc fully integrated functions.
Rmd b43ee90 wolfemd 2021-07-12 Completed predictCrosses function, which predicts cross usefullness on SELINDs and component traits. Work is shown.
Rmd 0ac841c wolfemd 2021-07-11 Full genomic prediction including (1) genomic prediction of clone GBLUPs and (2) prediction of cross usefulness. (1) is completed. Work shown. (2) is TO DO still.

Previous step

  1. Parent-wise cross-validation: Compute parent-wise cross-validation folds using the validated pedigree. Fit models to get marker effects and make subsequent predictions of cross means and (co)variances.

Current steps

  1. Genomic prediction of clone GEBV/GETGV. Fit GBLUP model, using genotypic add-dom partition. NEW: modelType=“DirDom”, include genome-wide inbreeding effect in GEBV/GETGV predictions after backsolving SNP effects. For all models, extract GBLUPs and backsolve SNP effects for use in cross usefulness predictions (mean+variance predictions). ALSO NEW: selection index predictions.

  2. Genomic prediction of cross \(UC_{parent}\) and \(UC_{variety}\). Rank potential parents on SI. Predict all possible crosses of some portion of best parents.

Genomic prediction of clone GEBV/GETGV

Operate R within a singularity Linux shell within a screen shell.

# 1) start a screen shell 
screen; # or screen -r if re-attaching...
# 2) start the singularity Linux shell inside that
singularity shell /workdir/$USER/rocker.sif; 
# Project directory, so R will use as working dir.
cd /home/mw489/implementGMSinCassava/;
# 3) Start R
R

Load input data

require(tidyverse); require(magrittr); 
# 5 threads per Rsession for matrix math (openblas)
RhpcBLASctl::blas_set_num_threads(5)
# GENOMIC MATE SELECTION FUNCTIONS
source(here::here("code","gmsFunctions.R")) 
source(here::here("code","predCrossVar.R")) 

# GENOMIC RELATIONSHIP MATRICES (GRMS)
grms<-list(A=readRDS(file=here::here("output","kinship_A_IITA_2021May13.rds")),
           D=readRDS(file=here::here("output","kinship_domGenotypic_IITA_2021July5.rds")))

# DOSAGE MATRIX
dosages<-readRDS(file=here::here("data",
                                 "dosages_IITA_filtered_2021May13.rds"))

# BLUPs
blups<-readRDS(file=here::here("data","blups_forCrossVal.rds")) %>% 
  dplyr::select(-varcomp) %>% 
  rename(TrainingData=blups) # for compatibility with downstream functions

# SELECTION INDEX WEIGHTS
## from IYR+IK
## note that not ALL predicted traits are on index
SIwts<-c(logFYLD=20,
         HI=10,
         DM=15,
         MCMDS=-10,
         logRTNO=12,
         logDYLD=20,
         logTOPYLD=15,
         PLTHT=10) 

Run the “AD” and “DirDom” modelTypes built into runGenomicPredictions().

Output contains both GBLUPs for selection of indivuals and SNP effects to use as input for prediction of cross usefulness and subsequent mate selection.

start<-proc.time()[3]
gpreds_ad<-runGenomicPredictions(modelType="AD",selInd=TRUE, SIwts=SIwts,
                                 getMarkEffs=TRUE,
                                 returnPEV=FALSE,
                                 blups=blups,grms=grms,dosages=dosages,
                                 ncores=20,nBLASthreads=5)
runtime<-proc.time()[3]-start; runtime/60
saveRDS(gpreds_ad,file = here::here("output","genomicPredictions_ModelAD.rds"))

gpreds_dirdom<-runGenomicPredictions(modelType="DirDom",selInd=TRUE, SIwts=SIwts,
                                     getMarkEffs=TRUE,
                                     returnPEV=FALSE,
                                     blups=blups,grms=grms,dosages=dosages,
                                     ncores=20,nBLASthreads=5)
runtime<-proc.time()[3]-start; runtime/60
saveRDS(gpreds_dirdom,file = here::here("output","genomicPredictions_ModelDirDom.rds"))

Genomic mate predictions: cross usefulness

  1. Use GBLUPs on SELIND to choose some to fraction of the clones.
  2. For those selected parents, predict the SELIND usefulness for all pairwise matings.
# 1) start a screen shell 
screen; # or screen -r if re-attaching...
# 2) start the singularity Linux shell inside that
#singularity shell /workdir/$USER/rocker.sif; 
singularity shell ~/rocker2.sif; 
# Project directory, so R will use as working dir.
cd /home/mw489/implementGMSinCassava/;
# 3) Start R
R
require(tidyverse); require(magrittr); 
# 5 threads per Rsession for matrix math (openblas)
#RhpcBLASctl::blas_set_num_threads(5)
# GENOMIC MATE SELECTION FUNCTIONS
source(here::here("code","gmsFunctions.R")) 
source(here::here("code","predCrossVar.R")) 

# DOSAGE MATRIX
dosages<-readRDS(file=here::here("data",
                                 "dosages_IITA_filtered_2021May13.rds"))

# RECOMBINATION FREQUENCY MATRIX
recombFreqMat<-readRDS(file=here::here("data",
                                       "recombFreqMat_1minus2c_2021May13.rds"))
# HAPLOTYPE MATRIX
## keep only haplos for parents-in-the-pedigree
## those which will be used in prediction, saves memory
haploMat<-readRDS(file=here::here("data","haps_IITA_filtered_2021May13.rds"))
parents<-union(ped$sireID,ped$damID) 
parenthaps<-sort(c(paste0(parents,"_HapA"),
                   paste0(parents,"_HapB")))
haploMat<-haploMat[parenthaps,colnames(recombFreqMat)]

# SELECTION INDEX WEIGHTS
## from IYR+IK
## note that not ALL predicted traits are on index
SIwts<-c(logFYLD=20,
         HI=10,
         DM=15,
         MCMDS=-10,
         logRTNO=12,
         logDYLD=20,
         logTOPYLD=15,
         PLTHT=10) 

# SNP EFFECTS - FROM PREVIOUS STEP 
### Two models AD and DirDom
gpreds_ad<-readRDS(file = here::here("output","genomicPredictions_ModelAD.rds"))
gpreds_dirdom<-readRDS(file = here::here("output","genomicPredictions_ModelDirDom.rds"))
### Cor between SELIND GEBV and GETGV between models?
# left_join(gpreds_ad$gblups[[1]] %>% select(GID,predOf,SELIND) %>% rename(SELINDad=SELIND),
#           gpreds_dirdom$gblups[[1]] %>% select(GID,predOf,SELIND) %>% rename(SELINDdirdom=SELIND)) %>% 
#   group_by(predOf) %>% summarize(SELIND_corModels=cor(SELINDad,SELINDdirdom))
# predOf SELIND_corModels
# GEBV  0.9890091           
# GETGV 0.9373170   

# SELECTION OF CROSSES-TO-BE-PREDICTED
nParentsToSelect<-100
union_bestGEBVandGETGVdirdom<-union(gpreds_dirdom$gblups[[1]] %>% 
                                         filter(predOf=="GEBV") %>% 
                                         arrange(desc(SELIND)) %>% 
                                         slice(1:nParentsToSelect) %$% GID,
                                       gpreds_dirdom$gblups[[1]] %>% 
                                         filter(predOf=="GETGV") %>% 
                                         arrange(desc(SELIND)) %>% 
                                         slice(1:nParentsToSelect) %$% GID)
union_bestGEBVandGETGVad<-union(gpreds_ad$gblups[[1]] %>% 
                                         filter(predOf=="GEBV") %>% 
                                         arrange(desc(SELIND)) %>% 
                                         slice(1:nParentsToSelect) %$% GID,
                                       gpreds_ad$gblups[[1]] %>% 
                                         filter(predOf=="GETGV") %>% 
                                         arrange(desc(SELIND)) %>% 
                                         slice(1:nParentsToSelect) %$% GID)
union_bestGEBVandGETGV<-union(union_bestGEBVandGETGVdirdom,
                              union_bestGEBVandGETGVad)
length(union_bestGEBVandGETGV) 
# [1] 121 parents in top nParentsToSelect on SELIND for GEBV/GETGV - DirDom/AD model.

CrossesToPredict<-crosses2predict(union_bestGEBVandGETGV)
nrow(CrossesToPredict)
# [1] 7381 

Run the “AD” and “DirDom” modelTypes.

cbsulm15 - July 25 - 7:30pm

start<-proc.time()[3]
crossPreds_dirdom<-predictCrosses(modelType="DirDom",stdSelInt = 2.67, 
                                  selInd=TRUE, SIwts=SIwts,
                                  CrossesToPredict=CrossesToPredict,
                                  snpeffs=gpreds_dirdom$genomicPredOut[[1]],
                                  dosages=dosages,
                                  haploMat=haploMat,recombFreqMat=recombFreqMat,
                                  ncores=20,nBLASthreads=5)
runtime<-proc.time()[3]-start; runtime/60
saveRDS(crossPreds_dirdom,file = here::here("output","genomicMatePredictions_top121parents_ModelDirDom.rds"))
# elapsed
#  2195.6
# # A tibble: 1 x 2
#   tidyPreds              rawPreds        
#   <list>                 <list>          
# 1 <tibble [177,144 × 9]> <named list [2]>

# 36.6 hrs for 7381 crosses. Or about 5 hours per 1000 crosses

cbsulm17 - July 25 at 7:30pm

start<-proc.time()[3]
crossPreds_ad<-predictCrosses(modelType="AD",stdSelInt = 2.67, 
                              selInd=TRUE, SIwts=SIwts,
                              CrossesToPredict=CrossesToPredict,
                              snpeffs=gpreds_ad$genomicPredOut[[1]],
                              dosages=dosages,
                              haploMat=haploMat,recombFreqMat=recombFreqMat,
                              ncores=20,nBLASthreads=5)
runtime<-proc.time()[3]-start; runtime/60
saveRDS(crossPreds_ad,file = here::here("output","genomicMatePredictions_top121parents_ModelAD.rds"))
# elapsed
# 1511.56
# # A tibble: 1 x 2
#   tidyPreds              rawPreds        
#   <list>                 <list>          
# 1 <tibble [177,144 × 9]> <named list [2]>

# 1511.56 or 25.33 hrs for 7381 crosses 

# About 3.4 hrs per 1000 crosses?

Write tidy breeder-friendly predictions to disk

Add genetic groups and tidy format

library(tidyverse);

gpreds_ad<-readRDS(file = here::here("output","genomicPredictions_ModelAD.rds")) 
gpreds_ad$gblups[[1]] %>% 
  mutate(GeneticGroup=case_when(grepl("2013_|TMS13",GID)~"C1",
                                grepl("TMS14",GID)~"C2",
                                grepl("TMS15",GID)~"C3",
                                grepl("TMS18",GID)~"C4",
                                !grepl("2013_|TMS13|TMS14|TMS15|TMS18",GID)~"PreGS"),
         GeneticGroup=factor(GeneticGroup,levels = c("PreGS","C1","C2","C3","C4"))) %>% 
  relocate(GeneticGroup,.after = "predOf") %>% 
  arrange(predOf,desc(SELIND)) %>% 
  write.csv(.,file = here::here("output","genomicPredictions_ModelAD.csv"),
            row.names = F)

gpreds_dirdom<-readRDS(file = here::here("output","genomicPredictions_ModelDirDom.rds"))
gpreds_dirdom$gblups[[1]] %>% 
  mutate(GeneticGroup=case_when(grepl("2013_|TMS13",GID)~"C1",
                                grepl("TMS14",GID)~"C2",
                                grepl("TMS15",GID)~"C3",
                                grepl("TMS18",GID)~"C4",
                                !grepl("2013_|TMS13|TMS14|TMS15|TMS18",GID)~"PreGS"),
         GeneticGroup=factor(GeneticGroup,levels = c("PreGS","C1","C2","C3","C4"))) %>% 
  relocate(GeneticGroup,.after = "predOf") %>% 
  arrange(predOf,desc(SELIND)) %>% 
  write.csv(.,file = here::here("output","genomicPredictions_ModelDirDom.csv"),
            row.names = F)
crossPreds_dirdom<-readRDS(file = here::here("output","genomicMatePredictions_top121parents_ModelDirDom.rds"))
crossPreds_ad<-readRDS(file = here::here("output","genomicMatePredictions_top121parents_ModelAD.rds"))

crossPreds_ad$tidyPreds[[1]] %>% 
  mutate(sireGroup=case_when(grepl("2013_|TMS13",sireID)~"C1",
                             grepl("TMS14",sireID)~"C2",
                             grepl("TMS15",sireID)~"C3",
                             grepl("TMS18",sireID)~"C4",
                             !grepl("2013_|TMS13|TMS14|TMS15|TMS18",sireID)~"PreGS"),
         damGroup=case_when(grepl("2013_|TMS13",damID)~"C1",
                            grepl("TMS14",damID)~"C2",
                            grepl("TMS15",damID)~"C3",
                            grepl("TMS18",damID)~"C4",
                            !grepl("2013_|TMS13|TMS14|TMS15|TMS18",damID)~"PreGS"),
         CrossGroup=paste0(sireGroup,"x",damGroup)) %>% 
  relocate(contains("Group"),.before = "Nsegsnps") %>% 
  write.csv(.,file = here::here("output","genomicMatePredictions_top121parents_ModelAD.csv"),
            row.names = F)

crossPreds_dirdom$tidyPreds[[1]] %>% 
  mutate(sireGroup=case_when(grepl("2013_|TMS13",sireID)~"C1",
                             grepl("TMS14",sireID)~"C2",
                             grepl("TMS15",sireID)~"C3",
                             grepl("TMS18",sireID)~"C4",
                             !grepl("2013_|TMS13|TMS14|TMS15|TMS18",sireID)~"PreGS"),
         damGroup=case_when(grepl("2013_|TMS13",damID)~"C1",
                            grepl("TMS14",damID)~"C2",
                            grepl("TMS15",damID)~"C3",
                            grepl("TMS18",damID)~"C4",
                            !grepl("2013_|TMS13|TMS14|TMS15|TMS18",damID)~"PreGS"),
         CrossGroup=paste0(sireGroup,"x",damGroup)) %>% 
  relocate(contains("Group"),.before = "Nsegsnps") %>% 
  write.csv(.,file = here::here("output","genomicMatePredictions_top121parents_ModelDirDom.csv"),
            row.names = F)

Write CSV’s

# ## Format and write GEBV
# predModelA %>% 
#   select(Trait,genomicPredOut) %>% 
#   unnest(genomicPredOut) %>% 
#   select(-varcomps) %>% 
#   unnest(gblups) %>% 
#   select(-GETGV,-contains("PEV")) %>%
#   spread(Trait,GEBV) %>% 
#   mutate(Group=case_when(GID %in% nrTP ~ "nrTP",
#                          GID %in% c1a ~ "C1a",
#                          GID %in% c1b ~ "C1b",
#                          GID %in% c2a ~ "C2a",
#                          GID %in% c2b ~ "C2b",
#                          GID %in% c3a ~ "C3a",
#                          GID %in% c3b ~ "C3b")) %>% 
#   select(Group,GID,any_of(traits)) %>% 
#   arrange(desc(Group)) %>% 
#   write.csv(., file = here::here("output","GEBV_NRCRI_ModelA_2021May03.csv"), row.names = F)
# 
# ## Format and write GETGV
# predModelADE %>% 
#   select(Trait,genomicPredOut) %>% 
#   unnest(genomicPredOut) %>% 
#   select(-varcomps) %>% 
#   unnest(gblups) %>% 
#   select(GID,Trait,GETGV) %>% 
#   spread(Trait,GETGV) %>% 
#   mutate(Group=case_when(GID %in% nrTP ~ "nrTP",
#                          GID %in% c1a ~ "C1a",
#                          GID %in% c1b ~ "C1b",
#                          GID %in% c2a ~ "C2a",
#                          GID %in% c2b ~ "C2b",
#                          GID %in% c3a ~ "C3a",
#                          GID %in% c3b ~ "C3b")) %>% 
#   select(Group,GID,any_of(traits)) %>% 
#   arrange(desc(Group)) %>% 
#   write.csv(., file = here::here("output","GETGV_NRCRI_ModelADE_2021May03.csv"), row.names = F)
# 
# ### Make a unified "tidy" long-form: 
# predModelA %>% 
#   select(Trait,genomicPredOut) %>% 
#   unnest(genomicPredOut) %>% 
#   select(-varcomps) %>% 
#   unnest(gblups) %>% 
#   select(-GETGV) %>% 
#   full_join(predModelADE %>% 
#               select(Trait,genomicPredOut) %>% 
#               unnest(genomicPredOut) %>% 
#               select(-varcomps) %>% 
#               unnest(gblups) %>% 
#               rename(GEBV_modelADE=GEBV,
#                      PEV_modelADE=PEVa) %>% 
#               select(-genomicPredOut)) %>% 
#   mutate(Group=case_when(GID %in% nrTP ~ "nrTP",
#                          GID %in% c1a ~ "C1a",
#                          GID %in% c1b ~ "C1b",
#                          GID %in% c2a ~ "C2a",
#                          GID %in% c2b ~ "C2b",
#                          GID %in% c3a ~ "C3a",
#                          GID %in% c3b ~ "C3b")) %>% 
#   relocate(Group,.before = GID) %>% 
#   write.csv(., file = here::here("output","genomicPredictions_NRCRI_2021May03.csv"), row.names = F)

Results

See Results: Home for plots and summary tables.


sessionInfo()