Last updated: 2020-10-09

Checks: 7 0

Knit directory: NRCRI_2020GS/

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(20200421) 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 63fe5fa. See the Past versions tab to see a history of the changes made to the R Markdown and HTML files.

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


Ignored files:
    Ignored:    .DS_Store
    Ignored:    .Rhistory
    Ignored:    .Rproj.user/
    Ignored:    analysis/.DS_Store
    Ignored:    data/.DS_Store
    Ignored:    output/.DS_Store

Untracked files:
    Untracked:  CrossValidationFunction_PlusNRCRI_2020GSnotes.gslides
    Untracked:  output/DosageMatrix_NRCRI_SamplesForGP_2020April27.rds
    Untracked:  output/Kinship_AA_NRCRI_2020April27.rds
    Untracked:  output/Kinship_AD_NRCRI_2020April27.rds
    Untracked:  output/Kinship_A_NRCRI_2020April27.rds
    Untracked:  output/Kinship_DD_NRCRI_2020April27.rds
    Untracked:  output/Kinship_D_NRCRI_2020April27.rds
    Untracked:  output/chr10_DCas20_5440_WA_REFimputed.log
    Untracked:  output/chr10_DCas20_5440_WA_REFimputed.vcf.gz
    Untracked:  output/chr10_DCas20_5440_WA_REFimputedAndFiltered.bed
    Untracked:  output/chr10_DCas20_5440_WA_REFimputedAndFiltered.bim
    Untracked:  output/chr10_DCas20_5440_WA_REFimputedAndFiltered.fam
    Untracked:  output/chr10_DCas20_5440_WA_REFimputedAndFiltered.log
    Untracked:  output/chr10_DCas20_5440_WA_REFimputedAndFiltered.nosex
    Untracked:  output/chr10_DCas20_5440_WA_REFimputedAndFiltered.raw
    Untracked:  output/chr10_DCas20_5440_WA_REFimputedAndFiltered.vcf.gz
    Untracked:  output/chr11_DCas20_5440_WA_REFimputed.log
    Untracked:  output/chr11_DCas20_5440_WA_REFimputed.vcf.gz
    Untracked:  output/chr11_DCas20_5440_WA_REFimputedAndFiltered.bed
    Untracked:  output/chr11_DCas20_5440_WA_REFimputedAndFiltered.bim
    Untracked:  output/chr11_DCas20_5440_WA_REFimputedAndFiltered.fam
    Untracked:  output/chr11_DCas20_5440_WA_REFimputedAndFiltered.log
    Untracked:  output/chr11_DCas20_5440_WA_REFimputedAndFiltered.nosex
    Untracked:  output/chr11_DCas20_5440_WA_REFimputedAndFiltered.raw
    Untracked:  output/chr11_DCas20_5440_WA_REFimputedAndFiltered.vcf.gz
    Untracked:  output/chr12_DCas20_5440_WA_REFimputed.log
    Untracked:  output/chr12_DCas20_5440_WA_REFimputed.vcf.gz
    Untracked:  output/chr12_DCas20_5440_WA_REFimputedAndFiltered.bed
    Untracked:  output/chr12_DCas20_5440_WA_REFimputedAndFiltered.bim
    Untracked:  output/chr12_DCas20_5440_WA_REFimputedAndFiltered.fam
    Untracked:  output/chr12_DCas20_5440_WA_REFimputedAndFiltered.log
    Untracked:  output/chr12_DCas20_5440_WA_REFimputedAndFiltered.nosex
    Untracked:  output/chr12_DCas20_5440_WA_REFimputedAndFiltered.raw
    Untracked:  output/chr12_DCas20_5440_WA_REFimputedAndFiltered.vcf.gz
    Untracked:  output/chr13_DCas20_5440_WA_REFimputed.log
    Untracked:  output/chr13_DCas20_5440_WA_REFimputed.vcf.gz
    Untracked:  output/chr13_DCas20_5440_WA_REFimputedAndFiltered.bed
    Untracked:  output/chr13_DCas20_5440_WA_REFimputedAndFiltered.bim
    Untracked:  output/chr13_DCas20_5440_WA_REFimputedAndFiltered.fam
    Untracked:  output/chr13_DCas20_5440_WA_REFimputedAndFiltered.log
    Untracked:  output/chr13_DCas20_5440_WA_REFimputedAndFiltered.nosex
    Untracked:  output/chr13_DCas20_5440_WA_REFimputedAndFiltered.raw
    Untracked:  output/chr13_DCas20_5440_WA_REFimputedAndFiltered.vcf.gz
    Untracked:  output/chr14_DCas20_5440_WA_REFimputed.log
    Untracked:  output/chr14_DCas20_5440_WA_REFimputed.vcf.gz
    Untracked:  output/chr14_DCas20_5440_WA_REFimputedAndFiltered.bed
    Untracked:  output/chr14_DCas20_5440_WA_REFimputedAndFiltered.bim
    Untracked:  output/chr14_DCas20_5440_WA_REFimputedAndFiltered.fam
    Untracked:  output/chr14_DCas20_5440_WA_REFimputedAndFiltered.log
    Untracked:  output/chr14_DCas20_5440_WA_REFimputedAndFiltered.nosex
    Untracked:  output/chr14_DCas20_5440_WA_REFimputedAndFiltered.raw
    Untracked:  output/chr14_DCas20_5440_WA_REFimputedAndFiltered.vcf.gz
    Untracked:  output/chr15_DCas20_5440_WA_REFimputed.log
    Untracked:  output/chr15_DCas20_5440_WA_REFimputed.vcf.gz
    Untracked:  output/chr15_DCas20_5440_WA_REFimputedAndFiltered.bed
    Untracked:  output/chr15_DCas20_5440_WA_REFimputedAndFiltered.bim
    Untracked:  output/chr15_DCas20_5440_WA_REFimputedAndFiltered.fam
    Untracked:  output/chr15_DCas20_5440_WA_REFimputedAndFiltered.log
    Untracked:  output/chr15_DCas20_5440_WA_REFimputedAndFiltered.nosex
    Untracked:  output/chr15_DCas20_5440_WA_REFimputedAndFiltered.raw
    Untracked:  output/chr15_DCas20_5440_WA_REFimputedAndFiltered.vcf.gz
    Untracked:  output/chr16_DCas20_5440_WA_REFimputed.log
    Untracked:  output/chr16_DCas20_5440_WA_REFimputed.vcf.gz
    Untracked:  output/chr16_DCas20_5440_WA_REFimputedAndFiltered.bed
    Untracked:  output/chr16_DCas20_5440_WA_REFimputedAndFiltered.bim
    Untracked:  output/chr16_DCas20_5440_WA_REFimputedAndFiltered.fam
    Untracked:  output/chr16_DCas20_5440_WA_REFimputedAndFiltered.log
    Untracked:  output/chr16_DCas20_5440_WA_REFimputedAndFiltered.nosex
    Untracked:  output/chr16_DCas20_5440_WA_REFimputedAndFiltered.raw
    Untracked:  output/chr16_DCas20_5440_WA_REFimputedAndFiltered.vcf.gz
    Untracked:  output/chr17_DCas20_5440_WA_REFimputed.log
    Untracked:  output/chr17_DCas20_5440_WA_REFimputed.vcf.gz
    Untracked:  output/chr17_DCas20_5440_WA_REFimputedAndFiltered.bed
    Untracked:  output/chr17_DCas20_5440_WA_REFimputedAndFiltered.bim
    Untracked:  output/chr17_DCas20_5440_WA_REFimputedAndFiltered.fam
    Untracked:  output/chr17_DCas20_5440_WA_REFimputedAndFiltered.log
    Untracked:  output/chr17_DCas20_5440_WA_REFimputedAndFiltered.nosex
    Untracked:  output/chr17_DCas20_5440_WA_REFimputedAndFiltered.raw
    Untracked:  output/chr17_DCas20_5440_WA_REFimputedAndFiltered.vcf.gz
    Untracked:  output/chr18_DCas20_5440_WA_REFimputed.log
    Untracked:  output/chr18_DCas20_5440_WA_REFimputed.vcf.gz
    Untracked:  output/chr18_DCas20_5440_WA_REFimputedAndFiltered.bed
    Untracked:  output/chr18_DCas20_5440_WA_REFimputedAndFiltered.bim
    Untracked:  output/chr18_DCas20_5440_WA_REFimputedAndFiltered.fam
    Untracked:  output/chr18_DCas20_5440_WA_REFimputedAndFiltered.log
    Untracked:  output/chr18_DCas20_5440_WA_REFimputedAndFiltered.nosex
    Untracked:  output/chr18_DCas20_5440_WA_REFimputedAndFiltered.raw
    Untracked:  output/chr18_DCas20_5440_WA_REFimputedAndFiltered.vcf.gz
    Untracked:  output/chr1_DCas20_5440_WA_REFimputed.log
    Untracked:  output/chr1_DCas20_5440_WA_REFimputed.vcf.gz
    Untracked:  output/chr1_DCas20_5440_WA_REFimputedAndFiltered.bed
    Untracked:  output/chr1_DCas20_5440_WA_REFimputedAndFiltered.bim
    Untracked:  output/chr1_DCas20_5440_WA_REFimputedAndFiltered.fam
    Untracked:  output/chr1_DCas20_5440_WA_REFimputedAndFiltered.log
    Untracked:  output/chr1_DCas20_5440_WA_REFimputedAndFiltered.nosex
    Untracked:  output/chr1_DCas20_5440_WA_REFimputedAndFiltered.raw
    Untracked:  output/chr1_DCas20_5440_WA_REFimputedAndFiltered.vcf.gz
    Untracked:  output/chr2_DCas20_5440_WA_REFimputed.log
    Untracked:  output/chr2_DCas20_5440_WA_REFimputed.vcf.gz
    Untracked:  output/chr2_DCas20_5440_WA_REFimputedAndFiltered.bed
    Untracked:  output/chr2_DCas20_5440_WA_REFimputedAndFiltered.bim
    Untracked:  output/chr2_DCas20_5440_WA_REFimputedAndFiltered.fam
    Untracked:  output/chr2_DCas20_5440_WA_REFimputedAndFiltered.log
    Untracked:  output/chr2_DCas20_5440_WA_REFimputedAndFiltered.nosex
    Untracked:  output/chr2_DCas20_5440_WA_REFimputedAndFiltered.raw
    Untracked:  output/chr2_DCas20_5440_WA_REFimputedAndFiltered.vcf.gz
    Untracked:  output/chr3_DCas20_5440_WA_REFimputed.log
    Untracked:  output/chr3_DCas20_5440_WA_REFimputed.vcf.gz
    Untracked:  output/chr3_DCas20_5440_WA_REFimputedAndFiltered.bed
    Untracked:  output/chr3_DCas20_5440_WA_REFimputedAndFiltered.bim
    Untracked:  output/chr3_DCas20_5440_WA_REFimputedAndFiltered.fam
    Untracked:  output/chr3_DCas20_5440_WA_REFimputedAndFiltered.log
    Untracked:  output/chr3_DCas20_5440_WA_REFimputedAndFiltered.nosex
    Untracked:  output/chr3_DCas20_5440_WA_REFimputedAndFiltered.raw
    Untracked:  output/chr3_DCas20_5440_WA_REFimputedAndFiltered.vcf.gz
    Untracked:  output/chr4_DCas20_5440_WA_REFimputed.log
    Untracked:  output/chr4_DCas20_5440_WA_REFimputed.vcf.gz
    Untracked:  output/chr4_DCas20_5440_WA_REFimputedAndFiltered.bed
    Untracked:  output/chr4_DCas20_5440_WA_REFimputedAndFiltered.bim
    Untracked:  output/chr4_DCas20_5440_WA_REFimputedAndFiltered.fam
    Untracked:  output/chr4_DCas20_5440_WA_REFimputedAndFiltered.log
    Untracked:  output/chr4_DCas20_5440_WA_REFimputedAndFiltered.nosex
    Untracked:  output/chr4_DCas20_5440_WA_REFimputedAndFiltered.raw
    Untracked:  output/chr4_DCas20_5440_WA_REFimputedAndFiltered.vcf.gz
    Untracked:  output/chr5_DCas20_5440_WA_REFimputed.log
    Untracked:  output/chr5_DCas20_5440_WA_REFimputed.vcf.gz
    Untracked:  output/chr5_DCas20_5440_WA_REFimputedAndFiltered.bed
    Untracked:  output/chr5_DCas20_5440_WA_REFimputedAndFiltered.bim
    Untracked:  output/chr5_DCas20_5440_WA_REFimputedAndFiltered.fam
    Untracked:  output/chr5_DCas20_5440_WA_REFimputedAndFiltered.log
    Untracked:  output/chr5_DCas20_5440_WA_REFimputedAndFiltered.nosex
    Untracked:  output/chr5_DCas20_5440_WA_REFimputedAndFiltered.raw
    Untracked:  output/chr5_DCas20_5440_WA_REFimputedAndFiltered.vcf.gz
    Untracked:  output/chr6_DCas20_5440_WA_REFimputed.log
    Untracked:  output/chr6_DCas20_5440_WA_REFimputed.vcf.gz
    Untracked:  output/chr6_DCas20_5440_WA_REFimputedAndFiltered.bed
    Untracked:  output/chr6_DCas20_5440_WA_REFimputedAndFiltered.bim
    Untracked:  output/chr6_DCas20_5440_WA_REFimputedAndFiltered.fam
    Untracked:  output/chr6_DCas20_5440_WA_REFimputedAndFiltered.log
    Untracked:  output/chr6_DCas20_5440_WA_REFimputedAndFiltered.nosex
    Untracked:  output/chr6_DCas20_5440_WA_REFimputedAndFiltered.raw
    Untracked:  output/chr6_DCas20_5440_WA_REFimputedAndFiltered.vcf.gz
    Untracked:  output/chr7_DCas20_5440_WA_REFimputed.log
    Untracked:  output/chr7_DCas20_5440_WA_REFimputed.vcf.gz
    Untracked:  output/chr7_DCas20_5440_WA_REFimputedAndFiltered.bed
    Untracked:  output/chr7_DCas20_5440_WA_REFimputedAndFiltered.bim
    Untracked:  output/chr7_DCas20_5440_WA_REFimputedAndFiltered.fam
    Untracked:  output/chr7_DCas20_5440_WA_REFimputedAndFiltered.log
    Untracked:  output/chr7_DCas20_5440_WA_REFimputedAndFiltered.nosex
    Untracked:  output/chr7_DCas20_5440_WA_REFimputedAndFiltered.raw
    Untracked:  output/chr7_DCas20_5440_WA_REFimputedAndFiltered.vcf.gz
    Untracked:  output/chr8_DCas20_5440_WA_REFimputed.log
    Untracked:  output/chr8_DCas20_5440_WA_REFimputed.vcf.gz
    Untracked:  output/chr8_DCas20_5440_WA_REFimputedAndFiltered.bed
    Untracked:  output/chr8_DCas20_5440_WA_REFimputedAndFiltered.bim
    Untracked:  output/chr8_DCas20_5440_WA_REFimputedAndFiltered.fam
    Untracked:  output/chr8_DCas20_5440_WA_REFimputedAndFiltered.log
    Untracked:  output/chr8_DCas20_5440_WA_REFimputedAndFiltered.nosex
    Untracked:  output/chr8_DCas20_5440_WA_REFimputedAndFiltered.raw
    Untracked:  output/chr8_DCas20_5440_WA_REFimputedAndFiltered.vcf.gz
    Untracked:  output/chr9_DCas20_5440_WA_REFimputed.log
    Untracked:  output/chr9_DCas20_5440_WA_REFimputed.vcf.gz
    Untracked:  output/chr9_DCas20_5440_WA_REFimputedAndFiltered.bed
    Untracked:  output/chr9_DCas20_5440_WA_REFimputedAndFiltered.bim
    Untracked:  output/chr9_DCas20_5440_WA_REFimputedAndFiltered.fam
    Untracked:  output/chr9_DCas20_5440_WA_REFimputedAndFiltered.log
    Untracked:  output/chr9_DCas20_5440_WA_REFimputedAndFiltered.nosex
    Untracked:  output/chr9_DCas20_5440_WA_REFimputedAndFiltered.raw
    Untracked:  output/chr9_DCas20_5440_WA_REFimputedAndFiltered.vcf.gz
    Untracked:  workflowr_log.R

Unstaged changes:
    Modified:   analysis/04-CrossValidation.Rmd
    Modified:   data/NRCRI_CleanedTrialData_2020April21.rds
    Modified:   data/NRCRI_ExptDesignsDetected_2020April21.rds
    Modified:   output/NRCRI_CuratedTrials_2020April27.rds
    Modified:   output/nrcri_blupsForModelTraining_2020April27.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/03-GetBLUPs.Rmd) and HTML (docs/03-GetBLUPs.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 8506715 wolfemd 2020-10-08 Changes remaining uncommited since “final” anlaysis in April/May.
html f3f6163 wolfemd 2020-04-28 Build site.
Rmd 8c45991 wolfemd 2020-04-28 Publish the first set of analyses and files for NRCRI 2020 GS.

Previous step

  1. Curate by trait-trial: Model each trait-trial separately, remove outliers, get BLUPs.

Objective

Two-stage genomic prediction refers to the following procedure:

Stage 1: Fit a linear mixed model to the data without genomic data. Individuals (e.g. clones / accessions) are modeled as independent and identically distributed (i.i.d.) random effects. The BLUPs for this random effect represent the measurable total genetic values of each individual. All the experimental design variation, e.g. replication and blocking effects have been controlled for in the creation of our new response variable, the BLUPs from the gneotype random effect.

Stage 2: Using a modified version of the BLUPs from step 1 as the response variable, fit a genomic prediction model, which now has reduced size because the number of observations is now the same as the number of individuals.

NOTE: In the animal breeding literature single-step often refers to predictions that combine pedigree and marker information simultaneously. That is not our meaning here.

The code below represents Stage I.

Set-up training datasets

This next step fits models to each trait, combining curated data (BLUPs) from each trial, which we computed in the previous step.

rm(list=ls())
library(tidyverse); library(magrittr);
dbdata<-readRDS(file=here::here("output","NRCRI_CuratedTrials_2020April27.rds"))
traits<-c("CGM","CGMS1","CGMS2","MCMDS","DM","PLTHT","BRNHT1","HI","logFYLD","logTOPYLD","logRTNO")

Starting with the curated trial data (which correspond to per-trait, per-trial BLUPs) from the previous step.

Nest by trait. Need to restructure the data from per-trial BLUPs by regrouping by trait.

nestForMultiTrialAnalysis<-function(curatedTrialData){
  nested_trialdata<-curatedTrialData %>% 
    # remove trait-trial models that failed
    filter(!is.na(H2)) %>% 
    # remove some per-trial summaries we don't want at this stage
    select(-H2,-VarComps,-Model,-Noutliers,-propMiss) %>% 
    unnest(BLUPs) %>% 
    nest(MultiTrialTraitData=c(-Trait))
  return(nested_trialdata)
}
dbdata<-nestForMultiTrialAnalysis(dbdata)
dbdata %>% mutate(N_blups=map_dbl(MultiTrialTraitData,nrow))
# A tibble: 10 x 3
   Trait     MultiTrialTraitData    N_blups
   <chr>     <list>                   <dbl>
 1 CGMS1     <tibble [10,152 × 12]>   10152
 2 CGMS2     <tibble [5,461 × 12]>     5461
 3 MCMDS     <tibble [6,952 × 12]>     6952
 4 PLTHT     <tibble [5,163 × 12]>     5163
 5 BRNHT1    <tibble [3,523 × 12]>     3523
 6 HI        <tibble [6,352 × 12]>     6352
 7 logFYLD   <tibble [6,355 × 12]>     6355
 8 logTOPYLD <tibble [6,352 × 12]>     6352
 9 logRTNO   <tibble [6,118 × 12]>     6118
10 DM        <tibble [3,699 × 12]>     3699
dbdata$MultiTrialTraitData[[1]] %>% count(GID)
# A tibble: 3,638 x 2
   GID         n
   <chr>   <int>
 1 101330      2
 2 101403      2
 3 101431      2
 4 101447      1
 5 101499      1
 6 101634      1
 7 10499       1
 8 106224      5
 9 10649       2
10 1070576     1
# … with 3,628 more rows

Question for NRCRI

Where is the data from Ugo Ikeogu’s (and subsequent) work on NIRs? I’m thinking someone needs to be trying to use esp. the DM NIRs data for genomic prediction!?

Model multiple trials

The function below takes de-regressed BLUPs as response and corresponding weights on error variances are applied. Output includes BLUPs for each clone that combine data across trials and are suitable for downstream genomic prediction work.

# curatedTrialData<-dbdata$MultiTrialTraitData[[1]]
# rm(curatedTrialData)
fitMultiTrialModel<-function(curatedTrialData,GID="GID"){
  require(lme4)
  modelFormula<-paste0("drgBLUP ~ (1|",GID,")")
  fit_model<-possibly(function(modelFormula,curatedTrialData){
    model_out<-lmer(as.formula(modelFormula),
                    data=curatedTrialData,
                    weights = WT)
    return(model_out) },
    otherwise = NA)
  model_out<-fit_model(modelFormula,curatedTrialData)
  summary(model_out)
  if(is.na(model_out)){
    out <-tibble(H2=NA,VarComps=list(NULL),BLUPs=list(NULL),Model=modelFormula) 
  } else {
    varcomps<-as.data.frame(VarCorr(model_out))[,c("grp","vcov")] %>%
      spread(grp,vcov)
    Vg<-varcomps$GID
    H2<-Vg/(Vg+varcomps$Residual)
    BLUP<-ranef(model_out, condVar=TRUE)[[GID]]
    PEV <- c(attr(BLUP, "postVar"))
    blups<-tibble(GID=rownames(BLUP),BLUP=BLUP$`(Intercept)`,PEV=PEV) %>% 
      mutate(REL=1-(PEV/Vg),
             drgBLUP=BLUP/REL,
             WT=(1-H2)/((0.1 + (1-REL)/REL)*H2))
    out <- tibble(H2=H2, 
                  VarComps=list(varcomps), 
                  BLUPs=list(blups),
                  Model=modelFormula) }
  return(out) 
}

Run the function with the simplest possible loop using the purrr function map().

dbdata %<>% 
  mutate(modelOutput=map(MultiTrialTraitData,fitMultiTrialModel))
dbdata %>% 
  select(-MultiTrialTraitData) %>% 
  unnest(modelOutput)
# A tibble: 10 x 5
   Trait          H2 VarComps         BLUPs                Model            
   <chr>       <dbl> <list>           <list>               <chr>            
 1 CGMS1     0.113   <df[,2] [1 × 2]> <tibble [3,226 × 6]> drgBLUP ~ (1|GID)
 2 CGMS2     0.00168 <df[,2] [1 × 2]> <tibble [2,333 × 6]> drgBLUP ~ (1|GID)
 3 MCMDS     0.0796  <df[,2] [1 × 2]> <tibble [3,597 × 6]> drgBLUP ~ (1|GID)
 4 PLTHT     0.0556  <df[,2] [1 × 2]> <tibble [2,703 × 6]> drgBLUP ~ (1|GID)
 5 BRNHT1    0.0337  <df[,2] [1 × 2]> <tibble [1,981 × 6]> drgBLUP ~ (1|GID)
 6 HI        0.127   <df[,2] [1 × 2]> <tibble [3,292 × 6]> drgBLUP ~ (1|GID)
 7 logFYLD   0.0341  <df[,2] [1 × 2]> <tibble [3,302 × 6]> drgBLUP ~ (1|GID)
 8 logTOPYLD 0.0678  <df[,2] [1 × 2]> <tibble [3,200 × 6]> drgBLUP ~ (1|GID)
 9 logRTNO   0.0305  <df[,2] [1 × 2]> <tibble [3,218 × 6]> drgBLUP ~ (1|GID)
10 DM        0.105   <df[,2] [1 × 2]> <tibble [2,425 × 6]> drgBLUP ~ (1|GID)

Output file

saveRDS(dbdata,file=here::here("output","nrcri_blupsForModelTraining_2020April27.rds"))
# dbdata<-readRDS(here::here("output","nrcri_blupsForModelTraining_2020April21.rds"))
# dbdata %>% 
#   #filter(studyName=="18C2acrossingblockCETubiaja") %>% 
#   select(Trait,modelOutput) %>% 
#   unnest(modelOutput) %>% 
#   select(Trait,BLUPs) %>% 
#   unnest(BLUPs) %>% 
#   filter(grepl("c2",GID,ignore.case = T)) %>% count(GID)

Next step

  1. Check prediction accuracy: Evaluate prediction accuracy with cross-validation.

sessionInfo()
R version 4.0.2 (2020-06-22)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Mojave 10.14.6

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] lme4_1.1-23     Matrix_1.2-18   magrittr_1.5    forcats_0.5.0  
 [5] stringr_1.4.0   dplyr_1.0.2     purrr_0.3.4     readr_1.3.1    
 [9] tidyr_1.1.2     tibble_3.0.3    ggplot2_3.3.2   tidyverse_1.3.0
[13] workflowr_1.6.2

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.5       lubridate_1.7.9  here_0.1         lattice_0.20-41 
 [5] assertthat_0.2.1 rprojroot_1.3-2  digest_0.6.25    utf8_1.1.4      
 [9] R6_2.4.1         cellranger_1.1.0 backports_1.1.10 reprex_0.3.0    
[13] evaluate_0.14    httr_1.4.2       pillar_1.4.6     rlang_0.4.7     
[17] readxl_1.3.1     minqa_1.2.4      rstudioapi_0.11  nloptr_1.2.2.2  
[21] whisker_0.4      blob_1.2.1       rmarkdown_2.4    splines_4.0.2   
[25] statmod_1.4.34   munsell_0.5.0    broom_0.7.0      compiler_4.0.2  
[29] httpuv_1.5.4     modelr_0.1.8     xfun_0.18        pkgconfig_2.0.3 
[33] htmltools_0.5.0  tidyselect_1.1.0 fansi_0.4.1      crayon_1.3.4    
[37] dbplyr_1.4.4     withr_2.3.0      later_1.1.0.1    MASS_7.3-53     
[41] grid_4.0.2       nlme_3.1-149     jsonlite_1.7.1   gtable_0.3.0    
[45] lifecycle_0.2.0  DBI_1.1.0        git2r_0.27.1     scales_1.1.1    
[49] cli_2.0.2        stringi_1.5.3    fs_1.5.0         promises_1.1.1  
[53] xml2_1.3.2       ellipsis_0.3.1   generics_0.0.2   vctrs_0.3.4     
[57] boot_1.3-25      tools_4.0.2      glue_1.4.2       hms_0.5.3       
[61] yaml_2.2.1       colorspace_1.4-1 rvest_0.3.6      knitr_1.30      
[65] haven_2.3.1