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/05-GetGEBVs.Rmd
) and HTML (docs/05-GetGEBVs.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 | 94e7f31 | wolfemd | 2020-04-28 | Host with GitHub. |
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. |
Current Step
library(tidyverse); library(magrittr);
A<-readRDS(file=here::here("output","Kinship_A_NRCRI_2020April27.rds"))
D<-readRDS(file=here::here("output","Kinship_A_NRCRI_2020April27.rds"))
#AA<-readRDS(file=here::here("output","Kinship_AA_NRCRI_2020April27.rds"))
AD<-readRDS(file=here::here("output","Kinship_AD_NRCRI_2020April27.rds"))
#DD<-readRDS(file=here::here("output","Kinship_DD_NRCRI_2020April27.rds"))
blups_iita<-readRDS(file=here::here("data","iita_blupsForCrossVal_outliersRemoved_73019.rds"))
blups_iita<-blups_iita %>%
dplyr::select(Trait,blups) %>%
unnest(blups) %>%
dplyr::select(-`std error`) %>%
filter(GID %in% rownames(A),
!grepl("TMS13F|TMS14F|TMS15F|2013_",GID)) # don't want IITA GS progenies
blups_nrcri<-readRDS(file=here::here("output","nrcri_blupsForModelTraining_2020April27.rds"))
blups_nrcri<-blups_nrcri %>%
dplyr::select(Trait,modelOutput) %>%
unnest(modelOutput) %>%
dplyr::select(Trait,BLUPs) %>%
unnest(BLUPs) %>%
filter(GID %in% rownames(A))
blups<-blups_nrcri %>%
nest(TrainingData=-Trait) %>%
mutate(Dataset="NRCRIalone") %>%
bind_rows(blups_nrcri %>%
bind_rows(blups_iita %>% filter(Trait %in% blups_nrcri$Trait)) %>%
nest(TrainingData=-Trait) %>%
mutate(Dataset="IITAaugmented"))
blups
#' @param blups nested data.frame with list-column "TrainingData" containing BLUPs
#' @param modelType string, A, AD or ADE representing model with Additive-only, Add. plus Dominance, and Add. plus Dom. plus. Epistasis (AA+AD+DD), respectively.
#' @param grms list of GRMs. Any genotypes in the GRMs get predicted with, or without phenotypes. Each element is named either A, D, AA, AD, DD. Matrices supplied must match required by A, AD and ADE models. For ADE grms=list(A=A,D=D,AA=AA,AD=AD,DD=DD).
runGenomicPredictions<-function(blups,modelType,grms,ncores=1,gid="GID",...){
require(sommer);
runOnePred<-possibly(function(trainingdata,modelType,grms){
trainingdata[[paste0(gid,"a")]]<-factor(trainingdata[[gid]],levels=rownames(grms[["A"]]))
if(modelType %in% c("AD","ADE")){ trainingdata[[paste0(gid,"d")]]<-factor(trainingdata[[gid]],levels=rownames(grms[["D"]]))
if(modelType=="ADE"){
#trainingdata[[paste0(gid,"aa")]]<-factor(trainingdata[[gid]],levels=rownames(grms[["AA"]]))
trainingdata[[paste0(gid,"ad")]]<-factor(trainingdata[[gid]],levels=rownames(grms[["AD"]]))
diag(grms[["AD"]])<-diag(grms[["AD"]])+1e-06
#trainingdata[[paste0(gid,"dd")]]<-factor(trainingdata[[gid]],levels=rownames(grms[["DD"]]))
}
}
# Set-up random model statements
randFormula<-paste0("~vs(",gid,"a,Gu=A)")
if(modelType %in% c("AD","ADE")){
randFormula<-paste0(randFormula,"+vs(",gid,"d,Gu=D)")
if(modelType=="ADE"){
randFormula<-paste0(randFormula,"+vs(",gid,"ad,Gu=AD)")
# "+vs(",gid,"aa,Gu=AA)",
# "+vs(",gid,"dd,Gu=DD)")
}
}
# Fit genomic prediction model
fit <- mmer(fixed = drgBLUP ~1,
random = as.formula(randFormula),
weights = WT,
data=trainingdata)
# Gather the BLUPs
gblups<-tibble(GID=as.character(names(fit$U[[paste0("u:",gid,"a")]]$drgBLUP)),
GEBV=as.numeric(fit$U[[paste0("u:",gid,"a")]]$drgBLUP))
if(modelType %in% c("AD","ADE")){
gblups %<>% mutate(GEDD=as.numeric(fit$U[[paste0("u:",gid,"d")]]$drgBLUP))
if(modelType=="ADE"){
gblups %<>% mutate(#GEEDaa=as.numeric(fit$U[[paste0("u:",gid,"aa")]]$drgBLUP),
GEEDad=as.numeric(fit$U[[paste0("u:",gid,"ad")]]$drgBLUP))
#GEEDdd=as.numeric(fit$U[[paste0("u:",gid,"dd")]]$drgBLUP))
}
}
# Calc GETGVs
## Note that for modelType=="A", GEBV==GETGV
gblups %<>%
mutate(GETGV=rowSums(.[,grepl("GE",colnames(.))]))
varcomps<-summary(fit)$varcomp
out<-tibble(gblups=list(gblups),varcomps=list(varcomps))
return(out)
},otherwise = NA)
## Run models across all train-test splits
## Parallelize
require(furrr); plan(multiprocess); options(mc.cores=ncores);
predictions<-blups %>%
mutate(genomicPredOut=future_map(TrainingData,~runOnePred(trainingdata=.,
modelType=modelType,grms=grms)))
return(predictions)
}
cbsulm18 (88 cores; 512GB)
Model A
options(future.globals.maxSize= 1500*1024^2)
predModelA<-runGenomicPredictions(blups,modelType="A",grms=list(A=A),gid="GID",ncores=1)
saveRDS(predModelA,file = here::here("output","genomicPredictions_ModelA_NRCRI_2020April27.rds"))
Model ADE
library(tidyverse); library(magrittr);
predModelA<-readRDS(file = here::here("output","genomicPredictions_ModelA_NRCRI_2020April27.rds"))
predModelADE<-readRDS(file = here::here("output","genomicPredictions_ModelADE_NRCRI_2020April27.rds"))
predModelA %>%
dplyr::select(Trait,Dataset,genomicPredOut) %>%
unnest(genomicPredOut) %>%
select(-varcomps) %>%
unnest(gblups) %>%
select(-GETGV) %>% rename(GEBV_A=GEBV) %>%
left_join(predModelADE %>%
mutate(islgl=map_lgl(genomicPredOut,is.logical)) %>%
filter(islgl==FALSE) %>%
dplyr::select(Trait,Dataset,genomicPredOut) %>%
unnest(genomicPredOut) %>%
select(-varcomps) %>%
unnest(gblups) %>%
select(Trait,Dataset,GID,GEBV) %>% rename(GEBV_ADE=GEBV)) %>%
mutate(GeneticGroup=NA,
GeneticGroup=ifelse(grepl("NR17F",GID,ignore.case = T),"C2a",
ifelse(grepl("C2bF",GID,ignore.case = T),"C2b",
ifelse(grepl("^F",GID) & !grepl("C1b",GID),"C1a",
ifelse(grepl("C1b",GID,
ignore.case = T),"C1b","TrainingPop"))))) %>%
ggplot(.,aes(x=GEBV_A,y=GEBV_ADE,color=GeneticGroup)) +
geom_point() + theme_bw() + geom_abline(slope=1, color='darkred') +
facet_wrap(~Trait, scales = 'free') +
labs(title="Compare GEBV from A-only model to GEBV from A+D+E model")
Version | Author | Date |
---|---|---|
f3f6163 | wolfemd | 2020-04-28 |
predModelADE %>%
mutate(islgl=map_lgl(genomicPredOut,is.logical)) %>%
filter(islgl==FALSE) %>%
dplyr::select(Trait,Dataset,genomicPredOut) %>%
unnest(genomicPredOut) %>%
select(-varcomps) %>%
unnest(gblups) %>%
select(Trait,Dataset,GID,GEBV,GETGV) %>%
mutate(GeneticGroup=NA,
GeneticGroup=ifelse(grepl("NR17F",GID,ignore.case = T),"C2a",
ifelse(grepl("C2bF",GID,ignore.case = T),"C2b",
ifelse(grepl("^F",GID) & !grepl("C1b",GID),"C1a",
ifelse(grepl("C1b",GID,
ignore.case = T),"C1b","TrainingPop"))))) %>%
ggplot(.,aes(x=GEBV,y=GETGV,color=GeneticGroup)) +
geom_point() + theme_bw() + geom_abline(slope=1, color='darkred') +
facet_wrap(~Trait, scales = 'free') +
labs(title="Model: ADE - Compare GEBV to GETGV")
Version | Author | Date |
---|---|---|
f3f6163 | wolfemd | 2020-04-28 |
predModelA %>%
dplyr::select(Trait,Dataset,genomicPredOut) %>%
unnest(genomicPredOut) %>%
select(-varcomps) %>%
unnest(gblups) %>%
select(-GETGV) %>%
spread(Trait,GEBV) %>%
mutate(GeneticGroup=NA,
GeneticGroup=ifelse(grepl("NR17F",GID,ignore.case = T),"C2a",
ifelse(grepl("C2bF",GID,ignore.case = T),"C2b",
ifelse(grepl("^F",GID) & !grepl("C1b",GID),"C1a",
ifelse(grepl("C1b",GID,
ignore.case = T),"C1b","TrainingPop"))))) %>%
nest(GEBVs=-Dataset) %>%
mutate(write=map2(Dataset,GEBVs,~write.csv(x = .y, file = here::here("output",paste0("GEBV_NRCRI_",.x,"_ModelA_2020April27.csv")))))
# A tibble: 2 x 3
Dataset GEBVs write
<chr> <list> <list>
1 IITAaugmented <tibble [7,062 × 12]> <NULL>
2 NRCRIalone <tibble [7,062 × 12]> <NULL>
## Format and write GEBV
predModelADE %>%
mutate(islgl=map_lgl(genomicPredOut,is.logical)) %>%
filter(islgl==FALSE) %>%
dplyr::select(Trait,Dataset,genomicPredOut) %>%
unnest(genomicPredOut) %>%
select(-varcomps) %>%
unnest(gblups) %>%
select(Trait,Dataset,GID,GEBV) %>%
spread(Trait,GEBV) %>%
mutate(GeneticGroup=NA,
GeneticGroup=ifelse(grepl("NR17F",GID,ignore.case = T),"C2a",
ifelse(grepl("C2bF",GID,ignore.case = T),"C2b",
ifelse(grepl("^F",GID) & !grepl("C1b",GID),"C1a",
ifelse(grepl("C1b",GID,
ignore.case = T),"C1b","TrainingPop"))))) %>%
nest(GEBVs=-Dataset) %>%
mutate(write=map2(Dataset,GEBVs,~write.csv(x = .y, file = here::here("output",paste0("GEBV_NRCRI_",.x,"_ModelADE_2020April27.csv")))))
# A tibble: 2 x 3
Dataset GEBVs write
<chr> <list> <list>
1 IITAaugmented <tibble [7,062 × 10]> <NULL>
2 NRCRIalone <tibble [7,062 × 10]> <NULL>
## Format and write GETGV
predModelADE %>%
mutate(islgl=map_lgl(genomicPredOut,is.logical)) %>%
filter(islgl==FALSE) %>%
dplyr::select(Trait,Dataset,genomicPredOut) %>%
unnest(genomicPredOut) %>%
select(-varcomps) %>%
unnest(gblups) %>%
select(Trait,Dataset,GID,GETGV) %>%
spread(Trait,GETGV) %>%
mutate(GeneticGroup=NA,
GeneticGroup=ifelse(grepl("NR17F",GID,ignore.case = T),"C2a",
ifelse(grepl("C2bF",GID,ignore.case = T),"C2b",
ifelse(grepl("^F",GID) & !grepl("C1b",GID),"C1a",
ifelse(grepl("C1b",GID,
ignore.case = T),"C1b","TrainingPop"))))) %>%
nest(GETGVs=-Dataset) %>%
mutate(write=map2(Dataset,GETGVs,
~write.csv(x = .y,
file = here::here("output",paste0("GETGV_NRCRI_",.x,"_ModelADE_2020April27.csv")))))
# A tibble: 2 x 3
Dataset GETGVs write
<chr> <list> <list>
1 IITAaugmented <tibble [7,062 × 10]> <NULL>
2 NRCRIalone <tibble [7,062 × 10]> <NULL>
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] magrittr_1.5 forcats_0.5.0 stringr_1.4.0 dplyr_1.0.2
[5] purrr_0.3.4 readr_1.3.1 tidyr_1.1.2 tibble_3.0.3
[9] ggplot2_3.3.2 tidyverse_1.3.0 workflowr_1.6.2
loaded via a namespace (and not attached):
[1] tidyselect_1.1.0 xfun_0.18 haven_2.3.1 colorspace_1.4-1
[5] vctrs_0.3.4 generics_0.0.2 htmltools_0.5.0 yaml_2.2.1
[9] utf8_1.1.4 blob_1.2.1 rlang_0.4.7 later_1.1.0.1
[13] pillar_1.4.6 withr_2.3.0 glue_1.4.2 DBI_1.1.0
[17] dbplyr_1.4.4 modelr_0.1.8 readxl_1.3.1 lifecycle_0.2.0
[21] munsell_0.5.0 gtable_0.3.0 cellranger_1.1.0 rvest_0.3.6
[25] evaluate_0.14 labeling_0.3 knitr_1.30 httpuv_1.5.4
[29] fansi_0.4.1 broom_0.7.0 Rcpp_1.0.5 promises_1.1.1
[33] backports_1.1.10 scales_1.1.1 jsonlite_1.7.1 farver_2.0.3
[37] fs_1.5.0 hms_0.5.3 digest_0.6.25 stringi_1.5.3
[41] rprojroot_1.3-2 grid_4.0.2 here_0.1 cli_2.0.2
[45] tools_4.0.2 crayon_1.3.4 whisker_0.4 pkgconfig_2.0.3
[49] ellipsis_0.3.1 xml2_1.3.2 reprex_0.3.0 lubridate_1.7.9
[53] rstudioapi_0.11 assertthat_0.2.1 rmarkdown_2.4 httr_1.4.2
[57] R6_2.4.1 git2r_0.27.1 compiler_4.0.2