AlphaSimR: Practical implementation of genomic selection in AlphaSimR
In this part of the vignette, we will implement the genomic selection in a Maize pipeline. Two scenarios will be implemented after a fifteen-year Burn-In period. The first scenario will account only for truncated phenotypic selection. In the second scenario, we will implement genomic selection in the pipeline. So, in year 4, the individuals will be selected based on the estimated breeding values that came from a genomic model (ridge regression model). In addition, the parents will be selected based on ‘ebv’.
for(year in 1:burninYears){
p = P[year]
cat("Working on year:",year,"\n")
source("aux_files/UpdateParents.R") # Pick new parents based on last year's data
source("aux_files/UpdateTesters.R") # Pick new testers and hybrid parents
source("aux_files/AdvanceYearPS.R") # Advances yield trials by a year
source("aux_files/WriteRecordsGS.R") # Write records for GS predictions
source("aux_files/UpdateResults.R") # Track summary data
}
# Saving the info
save.image("results/BURNIN.RData")
# 3.0 Loading the scenarios
load("results/BURNIN.RData")
for(year in (burninYears+1):(burninYears+futureYears)){
p = P[year]
# 3.1 Loop
cat("Working on year:",year,"\n")
source("aux_files/UpdateParents.R") # Pick new parents based on last year's data
source("aux_files/UpdateTesters.R") # Pick new testers and hybrid parents
source("aux_files/AdvanceYearPS.R") # Advances yield trials by a year
source("aux_files/UpdateResults.R") # Track summary data
}
# 3.2 Recording results
output1 = data.frame(scenario=rep("PS", 35), # Scenario name
MeanG_pop,
MeanA_pop,
VarG_pop,
stringsAsFactors=FALSE)
# 3.3 Saving the results as RDS
saveRDS(output1,"results/Results_PS.rds")
# 3.0 Loading the scenarios
load("results/BURNIN.RData")
for(year in (burninYears+1):(burninYears+futureYears)){
p = P[year]
cat("Working on year:",year,"\n")
if(year == (burninYears+1)){
source('aux_files/fillGS.R')
}
source("aux_files/UpdateParents_GS.R") # Pick new parents based on last year's data
source("aux_files/UpdateTesters.R") # Pick new testers and hybrid parents
source("aux_files/AdvanceYearGS.R") # advance the populations
source("aux_files/WriteRecordsGS.R") # Track records for GS
source("aux_files/UpdateResults.R") # Track summary data
}
# 3.2 Recording results
output1 = data.frame(scenario=rep("GS", 35), # Scenario name
MeanG_pop,
MeanA_pop,
VarG_pop,
stringsAsFactors=FALSE)
# 3.3 Saving the results as RDS
saveRDS(output1,"results/Results_GS.rds")
# Loading the results
Scenario1 = readRDS("results/Results_PS.rds")
Scenario2 = readRDS("results/Results_GS.rds")
# Plot hybrid mean of genetic values over time
meanRanges = range(c(Scenario1$MeanG_pop[15:35], Scenario2$MeanG_pop[15:35]))
plot(x = 15:35, y = Scenario1$MeanG_pop[15:35], type = "l", col = "black", lwd = 3,
xlab = "Year", ylab = "Mean of genetic values", ylim = meanRanges)
lines(x = 15:35, y = Scenario2$MeanG_pop[15:35], type = "l", col = "blue", lwd = 3)
legend(x = "topleft", legend = c('Pheno', 'GS'), title = "Scenarios",
lwd = 3, lty = c(1, 1), col = c("black", "blue"), bty = "n")
University of Florida, mresende@ufl.edu↩︎
University of Florida, deamorimpeixotom@ufl.edu↩︎