Similar to the previous examples, a bash script is outlined below that illustrates the impact of different genotyping strategies on the
long term genetic trend when generating breeding values using single step genomic BLUP (ssgblup). The scenarios include no genotyping, only
genotype a proportion or genotype every selection candidate. A total of 15 replicates were generated. After a scenario is done the directory
where the replicates are saved is renamed within the bash script.
Similar to Example 6, the important files are saved within the renamed replicate folder within each scenario. The replicate number is appended to the file name.
Outlined below is a more detailed explanation of the major differences in the phenotyping scenarios:
- parents_ebv: Genotype a proportion of selection candidates with high ebv and all selected parents.
- parents_random: Genotype a proportion of selection candidates at random and all selected parents.
- parents_offspring: Genotype all selection candidates.
Utilizing the R code outlined below the following plot was generated to illustrate how to loop through each scenario and generate plots
that describe the impact of reducing the number of genotyped animals on the true breeding value genetic trend.
R-Code
rm(list=ls()); gc()
library(ggplot2); library(tidyverse)
wd <- "/Users/jeremyhoward/Documents/39_GenoDiver_C++Code/WebsiteExamples/Example15/"
scen <- c("reps_pblup","reps_random_0.20","reps_ebv_0.20","reps_random_0.40","reps_ebv_0.40","reps_random_0.60" ,"reps_ebv_0.60","reps_random_0.80" ,"reps_ebv_0.80","reps_all")
reps <- c(1500:1514)
for(i in 1:length(scen))
{
for(j in 1:length(reps))
{
filename <- paste(wd,scen[i],"/Summary_Statistics_DataFrame_Performance_",reps[j],sep="")
df <- read_table2(file=filename,col_names = TRUE,col_type = "dccccccccccccc") %>%
mutate(index_tbv = as.numeric(matrix(unlist(strsplit(index_tbv, "[()]")), ncol = 2, byrow = TRUE)[, 1]),
Method = paste(unlist(strsplit(scen[i],"_"))[2:length(unlist(strsplit(scen[i],"_")))],collapse = '_'),
Rep = reps[j]) %>%
select(Generation,Method,Rep,index_tbv)
if(j == 1 & i == 1){summarytable <- df}
if(j > 1 | i > 1){summarytable <- rbind(summarytable,df);}
}
}
means <- aggregate(index_tbv ~ Generation + Method, data=summarytable,FUN=mean)
sds <- aggregate(index_tbv ~ Generation + Method, data=summarytable,FUN=sd)
plotdf <- cbind(means,sds[,3]); rm(means,sds)
names(plotdf) <- c("Generation","Method","Mean","SD")
pd <- position_dodge(0.20)
ggplot(plotdf, aes(x=as.factor(Generation), y=Mean, group=Method, colour=Method)) +
geom_errorbar(aes(ymin=Mean-SD, ymax=Mean+SD), colour="black", width=.4, size = 0.5, position=pd) +
geom_point(size=2.0) + geom_line(size=0.50) + theme_bw() +
labs(title = "Genetic Trend", x = "Generation", y = "Mean True Breeding Value") +
theme(plot.title = element_text(size = 16,hjust = 0.5),axis.title = element_text(size = 12),
legend.position="bottom",axis.text=element_text(size=10))