An Introduction to BSL

Shiori Yabe

Hiroyoshi Iwata

Jean-Luc Jannink

2018-02-08

BreedingSchemeLanguage is a package that simulates plant breeding using phenotypic or genomic selection. All package functions simulate recognizable breeding tasks that can be assembled into breeding schemes. For example, users can simulate phenotyping in multiple (possibly correlated) locations over years, calculate the cost of the simulated breeding scheme, and compare multiple breeding strategies. Reasonable defaults are given for each function, but many aspects are customizable. Functions are context dependent, e.g, by default, the phenotype() function will generate phenotypes for the last population created.

Start using BreedingSchemeLanguage

Load the BreedingSchemeLanguage. Find a temporary directory to work with for this vignette.

library(BreedingSchemeLanguage)
## Loading required package: snowfall
## Loading required package: snow
## Loading required package: Rcpp
simTempDir <- tempdir()

Define simulation settings

Define the genetic architecture of the plant species and other whole simulation settings. Because generating historical haplotypes is rather slow, save them so they can be reused.

simEnv <- defineSpecies(nSim=3, saveDataFileName=paste(simTempDir, "simSpecies", sep="/"))

Specify environmental variances and breeding costs

locCor <- matrix(c(1, 0.6, 0.3, 
                   0.6, 1, 0.8, 
                   0.3, 0.8, 1)
                 , 3)
errVars <- c(Preliminary=4, Advanced=1)
defineVariances(locCorrelations=locCor, plotTypeErrVars=errVars)
plotCosts <- c(Preliminary=2, Advanced=5)
defineCosts(phenoCost=plotCosts)

Initialize the breeding population from historical haplotypes.

initializePopulation()

Simulate breeding schemes

Estimate the per se or own performance of individuals in the initial breeding population and select based on these values.

phenotype(locations=1:3, years=1:2, plotType="Preliminary")
predictValue()
select()

Cross to create progeny, phenotype them then select using pedigree information

cross()
phenotype(plotType="Advanced", locations=3, years=3)
predictValue(sharingInfo="pedigree")
select()

Genomic selection among progeny produced by selfing

selfFertilize(nProgeny=120)
genotype()
predictValue(sharingInfo="markers", locations=3)
select()
cross()

Plot the results

cycleMeans <- plotData(addDataFileName=paste(simTempDir, "simPlot", sep="/"))

Start a new simulation from the same historical haplotypes

First, it is best to delete the previous simulation environment, then load the data using the name given at the beginning of the vignette. Simple simulation using defaults.

if (exists("simEnv")){
rm(list=names(simEnv), envir=simEnv)
rm(simEnv)
}
simEnv <- defineSpecies(loadData=paste(simTempDir, "simSpecies", sep="/"))
initializePopulation()
phenotype()
select()
cross()
phenotype()
select()
cross()
phenotype()
select()
cross()
cycleMeans <- plotData(add=TRUE, addDataFileName=paste(simTempDir, "simPlot", sep="/"))

Clean up after the vignette

fr <- file.remove(paste(simTempDir, "simSpecies.RData", sep="/"))
fr <- file.remove(paste(simTempDir, "simPlot.rds", sep="/"))