simBsOpt: R6 Class Representing a Breeding Scheme

simBsOptR Documentation

R6 Class Representing a Breeding Scheme

Description

simBsOpt object store specific information of simulation results of breeding scheme.

Public fields

simBsName

[character] Name of this simulation of breeding schemes

bsInfoInit

[bsInfo] breeding scheme info (see:bsInfo)

breederInfoInit

[breederInfo] breeder info (see:breederInfo)

lociEffMethod

[character] How to compute loci effects (use true QTL effects ("true") or estimated marker effects ("estimated"))

trainingPopType

[character] Training population consists of all populations created in the breeding scheme for 'trainingPopType = "all"', or consists of the latest population in breeding scheme for 'trainingPopType = "latest"'.

trainingPopInit

[character / numeric] Training population names or No.s (not generations!!) for initial population

trainingIndNamesInit

[character] Names of training individuals for initia; population

methodMLRInit

[character] Methods for estimating marker effects for initial population. The following methods are offered:

"Ridge", "LASSO", "ElasticNet", "RR-BLUP", "GBLUP", "BayesA" (uni-trait), "BayesB" (uni-trait), "BayesC" (uni-trait), "BRR", "BL" (uni-trait), "SpikeSlab" (multi-trait)

multiTraitInit

[logical] Use multiple-trait model for estimation of marker effects or not for initial population

nIterSimulation

[numeric] Number of iterations for this simulation setting

nGenerationProceed

[numeric] Number of generations to be proceeded

nGenerationProceedSimulation

[numeric] Number of generations to be proceeded in simulation for optimizing policy

setGoalAsFinalGeneration

[logical] Set goal for simulation of breeding scheme as the real final generation

performOptimization

[logical] Perform optimization of policy in each generation or not

useFirstOptimizedValue

[logical] Perform optimization of policy only for the initial population and use the optimized hyperprameters permanently.

sameAcrossGeneration

[logical] Use same hyper prameter across generations or not

hMin

[numeric] Lower bound of hyper parameters

hMax

[numeric] Upper bound of hyper parameters

nTotalIterForOneOptimization

[numeric] Number of total iterations that can be assigned for one optimization process

nIterSimulationPerEvaluation

[numeric] Number of simulations per one evaluation of the hyperparameter set of your interest

nIterOptimization

[numeric] Number of iterations required for one optimization

nMaxEvalPerNode

[numeric] Number of maximum evaluation per node when optimizing hyper parameter by StoSOO

maxDepth

[numeric] Maximum depth of tree when optimizing hyper parameter by StoSOO

nChildrenPerExpansion

[numeric] Number of children per one expansion of nodes when optimizing hyper parameter by StoSOO

confidenceParam

[numeric] Confidence parameter of StoSOO, this parameter determines the width of the estimates of rewards

returnOptimalNodes

[numeric] When (how many iterations) to return (or save) the optimal nodes when optimizing hyper parameter by StoSOO

saveTreeNameBase

[character] Base name of the tree to be saved

whenToSaveTrees

[numeric] When (how many iterations) to save the tree in StoSOO

nTopEvalForOpt

[numeric] Number of individuals to be evaluated when evaluating population max or population min for optimization of hyperparameters

rewardWeightVec

[numeric] When returning reward function, 'rewardWeightVec' will be multiplied by estimated GVs for each generation to evaluate the method. If you want to apply discounted method, you can achieve by 'rewardWeightVec = sapply(1:nGenerationProceedSimulation, function(genProceedNo) gamma ^ (genProceedNo - 1))' where 'gamma' is discounted rate. Or if you want to evaluate just the final generation, you can achieve by 'rewardWeightVec = c(rep(0, nGenerationProceedSimulation - 1), 1)'.

digitsEval

[numeric] When you evaluate each hyperparameter, you can round the average of evaluates ('eval') with 'round(eval, digitsEval)'.

nRefreshMemoryEvery

[numeric] Every 'nRefreshMemoryEvery' iterations, we refresh memory used for simulations by 'gc(reset = TRUE)'.

updateBreederInfo

[logical] Update breederInfo or not for each generation

phenotypingInds

[logical] Phenotyping individuals or not for each generation

nRepForPhenoInit

[numeric] Number of replications to be phenotyped for initial population

nRepForPheno

[numeric] Number of replications to be phenotyped for each generation

updateModels

[logical] Whether or not updating the model for each generation (If 'phenotypingInds = FALSE' for generation of your interest, 'updateModels' will be automatically 'FALSE' for that generation.)

updateBreederInfoSimulation

[logical] Update breederInfo or not for each generation in simulations for optimization

phenotypingIndsSimulation

[logical] Phenotyping individuals or not for each generation in simulations for optimization

nRepForPhenoSimulation

[numeric] Number of replications to be phenotyped for each generation in simulations for optimization

updateModelsSimulation

[logical] Whether or not updating the model for each generation in simulations for optimization (If 'phenotypingInds = FALSE' for generation of your interest, 'updateModels' will be automatically 'FALSE' for that generation.)

methodMLR

[character] Methods for estimating marker effects. The following methods are offered:

"Ridge", "LASSO", "ElasticNet", "RR-BLUP", "GBLUP", "BayesA" (uni-trait), "BayesB" (uni-trait), "BayesC" (uni-trait), "BRR", "BL" (uni-trait), "SpikeSlab" (multi-trait)

multiTrait

[logical] Use multiple-trait model for estimation of marker effects or not

nSelectionWaysVec

[numeric] Number of selection ways for each generation

selectionMethodList

[list] (list of) Selection method for each generation

traitNoSelList

[list] (list of list of) Number of trait No of your interest for selection for each generation

blockSplitMethod

[character] How to determine the markers belonging to each block when computing OHV. You can define the number of markers in each block ('nMrkInBlock') or the minimum length of each segment ('minimumSegmentLength').

nMrkInBlock

[numeric] Number of markers in each block. This will be used for the computation of OHV.

minimumSegmentLength

[numeric] Minimum length of each segment [cM]. This will be used for the computation of OHV.

nSelInitOPVList

[list] (list of) Number of selected candiates for first screening before selecting parent candidates by OPV for each generation

nIterOPV

[numeric] Number of iterations for computation of OPV

nProgeniesEMBVVec

[numeric] Number of progenies of double haploids produced when computing EMBV for each generation

nIterEMBV

[numeric] Number of iterations to estimate EMBV

nCoresEMBV

[numeric] Number of cores used for EMBV estimation

clusteringForSelList

[list] (list of) Apply clustering results of marker genotype to selection or not for each generation

nClusterList

[list] (list of) Number of clusters for each generation

nTopClusterList

[list] (list of) Number of top clusters used for selection for each generation

nTopEachList

[list] (list of) Number of selected individuals in each cluster for each generation

nSelList

[list] (list of) Number of selection candidates for each generation

multiTraitsEvalMethodList

[list] (list of) When evaluating multiple traits, you can choose how to evaluate these traits simultaneously. One method is to take a weighted sum of these traits, and the other is to compute a product of these traits (adjusted to be positive values in advance.)

hSelList

[list] (list of) Hyperparameter which determines which trait is weighted when selecting parent candidates for multiple traits for each generation

matingMethodVec

[character] Mating method for each generation

allocateMethodVec

[character] Allocation method for each generation

weightedAllocationMethodList

[list] (list of) Which selection index will be used for weighted resource allocation for each generation

traitNoRAList

[list] (list of) Trait No of your interest for resource allocation for each generation

includeGVPVec

[logical] Whether or not to consider genetic variance of progenies of each pair when determining the number of progenies per each pair for each generation

nNextPopVec

[numeric] Number of progenies for the next generation for each generation

nameMethod

[character] Method for naming individuals

nCores

[numeric] Number of cores used for simulations of breedinhh scheme

nCoresPerOptimization

[numeric] Number of cores used for simulations of breeding scheme when optimizing hyperparameters

overWriteRes

[logical] Overwrite simulation results when the targeted results already exists

showProgress

[logical] Show progress bar or not

returnMethod

[character] Which type of results will be returned (saved) in the object

saveAllResAt

[character] If NULL, we won't save the simulation results. Else, we will save bsInfo and breederInfo for each iteration in the directory defined by 'saveAllResAt' path.

evaluateGVMethod

[character] Which type of GV (true GV or estimated GV) will be used for evaluation of the simulation results.

nTopEval

[numeric] Number of individuals to be evaluated when evaluating population max or population min

traitNoEval

[numeric] Trait No of your interest for evaluation of the method

hEval

[numeric] Hyperparameter which determines which BV is emphasized when evaluating simulation results of each method

summaryAllResAt

[character] If NULL, we will summary the simulation results in 'self$trueGVMatList' and 'self$estimatedGVMatList'. Else, we will summary the simulation results in 'summaryAllResAt' path.

verbose

[logical] Display info (optional)

lociEffectsInit

[matrix] Marker and QTL effects used for crossInfo object for initial population

hLens

[numeric] Length of hyperparameter vector

hStart

[numeric] Initial values of hyper parameters

solnInit

[list] List of solution of StoSOO for initial state

hVecOptsList

[list] List of optimized hyperparameters in each generation

optimalHyperParamMatsList

[list] List of optimized hyper parameters given finite numbers of budget for optimization

simBsRes

[list] Simulation results of each method

trueGVMatInit

[matrix] A true GV matrix for initial population

trueGVMatList

[list] A list of true GV matrix of simulation results

trueGVSummaryArray

[array] An array of summary statistics of true GVs for each population & each iteration

estimatedGVMatInit

[matrix] An estimated GV matrix for initial population

estimatedGVMatList

[list] A list of estimated GV matrix of simulation results

estimatedGVSummaryArray

[array] An array of summary statistics of estimated GVs for each population & each iteration

Methods

Public methods


Method new()

Create a new simBsOpt object.

Usage
simBsOpt$new(
  simBsName = "Undefined",
  bsInfoInit,
  breederInfoInit = NULL,
  lociEffMethod = NULL,
  trainingPopType = NULL,
  trainingPopInit = NULL,
  trainingIndNamesInit = NULL,
  methodMLRInit = NULL,
  multiTraitInit = FALSE,
  nIterSimulation = NULL,
  nGenerationProceed = NULL,
  nGenerationProceedSimulation = NULL,
  setGoalAsFinalGeneration = TRUE,
  performOptimization = NULL,
  useFirstOptimizedValue = NULL,
  sameAcrossGeneration = TRUE,
  hMin = NULL,
  hMax = NULL,
  nTotalIterForOneOptimization = NULL,
  nIterSimulationPerEvaluation = NULL,
  nIterOptimization = NULL,
  nMaxEvalPerNode = NULL,
  maxDepth = NULL,
  nChildrenPerExpansion = NULL,
  confidenceParam = NULL,
  returnOptimalNodes = NULL,
  saveTreeNameBase = NULL,
  whenToSaveTrees = NA,
  nTopEvalForOpt = NULL,
  rewardWeightVec = NULL,
  digitsEval = NULL,
  nRefreshMemoryEvery = NULL,
  updateBreederInfo = TRUE,
  phenotypingInds = FALSE,
  nRepForPhenoInit = NULL,
  nRepForPheno = NULL,
  updateModels = FALSE,
  updateBreederInfoSimulation = TRUE,
  phenotypingIndsSimulation = FALSE,
  nRepForPhenoSimulation = NULL,
  updateModelsSimulation = FALSE,
  methodMLR = NULL,
  multiTrait = FALSE,
  nSelectionWaysVec = NULL,
  selectionMethodList = NULL,
  traitNoSelList = NULL,
  blockSplitMethod = NULL,
  nMrkInBlock = NULL,
  minimumSegmentLength = NULL,
  nSelInitOPVList = NULL,
  nIterOPV = NULL,
  nProgeniesEMBVVec = NULL,
  nIterEMBV = NULL,
  nCoresEMBV = NULL,
  clusteringForSelList = FALSE,
  nClusterList = NULL,
  nTopClusterList = NULL,
  nTopEachList = NULL,
  nSelList = NULL,
  multiTraitsEvalMethodList = NULL,
  hSelList = NULL,
  matingMethodVec = NULL,
  allocateMethodVec = NULL,
  weightedAllocationMethodList = NULL,
  traitNoRAList = NULL,
  includeGVPVec = FALSE,
  nNextPopVec = NULL,
  nameMethod = "pairBase",
  nCores = NULL,
  nCoresPerOptimization = NULL,
  overWriteRes = FALSE,
  showProgress = TRUE,
  returnMethod = "all",
  saveAllResAt = NULL,
  evaluateGVMethod = "true",
  nTopEval = NULL,
  traitNoEval = NULL,
  hEval = NULL,
  summaryAllResAt = NULL,
  verbose = TRUE
)
Arguments
simBsName

[character] Name of this simulation of breeding schemes

bsInfoInit

[bsInfo] breeding scheme info (see:bsInfo)

breederInfoInit

[breederInfo] breeder info (see:breederInfo)

lociEffMethod

[character] How to compute loci effects (use true QTL effects ("true") or estimated marker effects ("estimated"))

trainingPopType

[character] Training population consists of all populations created in the breeding scheme for 'trainingPopType = "all"', or consists of the latest population in breeding scheme for 'trainingPopType = "latest"'.

trainingPopInit

[character / numeric] Training population names or No.s (not generations!!) for initial population

trainingIndNamesInit

[character] Names of training individuals for initia; population

methodMLRInit

[character] Methods for estimating marker effects for initial population. The following methods are offered:

"Ridge", "LASSO", "ElasticNet", "RR-BLUP", "GBLUP", "BayesA" (uni-trait), "BayesB" (uni-trait), "BayesC" (uni-trait), "BRR", "BL" (uni-trait), "SpikeSlab" (multi-trait)

multiTraitInit

[logical] Use multiple-trait model for estimation of marker effects or not for initial population

nIterSimulation

[numeric] Number of iterations for this simulation setting

nGenerationProceed

[numeric] Number of generations to be proceeded

nGenerationProceedSimulation

[numeric] Number of generations to be proceeded in simulation for optimizing policy

setGoalAsFinalGeneration

[logical] Set goal for simulation of breeding scheme as the real final generation

performOptimization

[logical] Perform optimization of policy in each generation or not

useFirstOptimizedValue

[logical] Perform optimization of policy only for the initial population and use the optimized hyperprameters permanently.

sameAcrossGeneration

[logical] Use same hyper prameter across generations or not

hMin

[numeric] Lower bound of hyper parameters

hMax

[numeric] Upper bound of hyper parameters

nTotalIterForOneOptimization

[numeric] Number of total iterations that can be assigned for one optimization process

nIterSimulationPerEvaluation

[numeric] Number of simulations per one evaluation of the hyperparameter set of your interest

nIterOptimization

[numeric] Number of iterations required for one optimization

nMaxEvalPerNode

[numeric] Number of maximum evaluation per node when optimizing hyper parameter by StoSOO

maxDepth

[numeric] Maximum depth of tree when optimizing hyper parameter by StoSOO

nChildrenPerExpansion

[numeric] Number of children per one expansion of nodes when optimizing hyper parameter by StoSOO

confidenceParam

[numeric] Confidence parameter of StoSOO, this parameter determines the width of the estimates of rewards

returnOptimalNodes

[numeric] When (how many iterations) to return (or save) the optimal nodes when optimizing hyper parameter by StoSOO

saveTreeNameBase

[character] Base name of the tree to be saved

whenToSaveTrees

[numeric] When (how many iterations) to save the tree in StoSOO

nTopEvalForOpt

[numeric] Number of individuals to be evaluated when evaluating population max or population min for optimization of hyperparameters

rewardWeightVec

[numeric] When returning reward function, 'rewardWeightVec' will be multiplied by estimated GVs for each generation to evaluate the method. If you want to apply discounted method, you can achieve by 'rewardWeightVec = sapply(1:nGenerationProceedSimulation, function(genProceedNo) gamma ^ (genProceedNo - 1))' where 'gamma' is discounted rate. Or if you want to evaluate just the final generation, you can achieve by 'rewardWeightVec = c(rep(0, nGenerationProceedSimulation - 1), 1)'.

digitsEval

[numeric] When you evaluate each hyperparameter, you can round the average of evaluates ('eval') with 'round(eval, digitsEval)'.

nRefreshMemoryEvery

[numeric] Every 'nRefreshMemoryEvery' iterations, we refresh memory used for simulations by 'gc(reset = TRUE)'.

updateBreederInfo

[logical] Update breederInfo or not for each generation

phenotypingInds

[logical] Phenotyping individuals or not for each generation

nRepForPhenoInit

[numeric] Number of replications to be phenotyped for initial population

nRepForPheno

[numeric] Number of replications to be phenotyped for each generation

updateModels

[logical] Whether or not updating the model for each generation (If 'phenotypingInds = FALSE' for generation of your interest, 'updateModels' will be automatically 'FALSE' for that generation.)

updateBreederInfoSimulation

[logical] Update breederInfo or not for each generation in simulations for optimization

phenotypingIndsSimulation

[logical] Phenotyping individuals or not for each generation in simulations for optimization

nRepForPhenoSimulation

[numeric] Number of replications to be phenotyped for each generation in simulations for optimization

updateModelsSimulation

[logical] Whether or not updating the model for each generation in simulations for optimization (If 'phenotypingInds = FALSE' for generation of your interest, 'updateModels' will be automatically 'FALSE' for that generation.)

methodMLR

[character] Methods for estimating marker effects. The following methods are offered:

"Ridge", "LASSO", "ElasticNet", "RR-BLUP", "GBLUP", "BayesA" (uni-trait), "BayesB" (uni-trait), "BayesC" (uni-trait), "BRR", "BL" (uni-trait), "SpikeSlab" (multi-trait)

multiTrait

[logical] Use multiple-trait model for estimation of marker effects or not

nSelectionWaysVec

[numeric] Number of selection ways for each generation

selectionMethodList

[list] (list of) Selection method for each generation

traitNoSelList

[list] (list of list of) Number of trait No of your interest for selection for each generation

blockSplitMethod

[character] How to determine the markers belonging to each block when computing OHV. You can define the number of markers in each block ('nMrkInBlock') or the minimum length of each segment ('minimumSegmentLength').

nMrkInBlock

[numeric] Number of markers in each block. This will be used for the computation of OHV.

minimumSegmentLength

[numeric] Minimum length of each segment [cM]. This will be used for the computation of OHV.

nSelInitOPVList

[list] (list of) Number of selected candiates for first screening before selecting parent candidates by OPV for each generation

nIterOPV

[numeric] Number of iterations for computation of OPV

nProgeniesEMBVVec

[numeric] Number of progenies of double haploids produced when computing EMBV for each generation

nIterEMBV

[numeric] Number of iterations to estimate EMBV

nCoresEMBV

[numeric] Number of cores used for EMBV estimation

clusteringForSelList

[list] (list of) Apply clustering results of marker genotype to selection or not for each generation

nClusterList

[list] (list of) Number of clusters for each generation

nTopClusterList

[list] (list of) Number of top clusters used for selection for each generation

nTopEachList

[list] (list of) Number of selected individuals in each cluster for each generation

nSelList

[list] (list of) Number of selection candidates for each generation

multiTraitsEvalMethodList

[list] (list of) When evaluating multiple traits, you can choose how to evaluate these traits simultaneously. One method is to take a weighted sum of these traits, and the other is to compute a product of these traits (adjusted to be positive values in advance.)

hSelList

[list] (list of) Hyperparameter which determines which trait is weighted when selecting parent candidates for multiple traits for each generation

matingMethodVec

[character] Mating method for each generation

allocateMethodVec

[character] Allocation method for each generation

weightedAllocationMethodList

[list] (list of) Which selection index will be used for weighted resource allocation for each generation

traitNoRAList

[list] (list of) Trait No of your interest for resource allocation for each generation

includeGVPVec

[logical] Whether or not to consider genetic variance of progenies of each pair when determining the number of progenies per each pair for each generation

nNextPopVec

[numeric] Number of progenies for the next generation for each generation

nameMethod

[character] Method for naming individuals

nCores

[numeric] Number of cores used for simulations of breeding scheme

nCoresPerOptimization

[numeric] Number of cores used for simulations of breeding scheme when optimizing hyperparameters

overWriteRes

[logical] Overwrite simulation results when the targeted results already exists

showProgress

[logical] Show progress bar or not

returnMethod

[character] Which type of results will be returned (saved) in the object

saveAllResAt

[character] If NULL, we won't save the simulation results. Else, we will save bsInfo and breederInfo for each iteration in the directory defined by 'saveAllResAt' path.

evaluateGVMethod

[character] Which type of GV (true GV or estimated GV) will be used for evaluation of the simulation results

nTopEval

[numeric] Number of individuals to be evaluated when evaluating population max or population min#'

traitNoEval

[numeric] Trait No of your interest for evaluation of the method

hEval

[numeric] Hyperparameter which determines which BV is emphasized when evaluating simulation results of each method

summaryAllResAt

[character] If NULL, we will summary the simulation results in 'self$trueGVMatList' and 'self$estimatedGVMatList'. Else, we will summary the simulation results in 'summaryAllResAt' path.

verbose

[logical] Display info (optional)

Returns

A new 'simBs' object.

Examples
### create simulation information
mySimInfo <- simInfo$new(simName = "Simulation Example",
                         simGeno = TRUE,
                         simPheno = TRUE,
                         #' nSimGeno = 1,
                         #' nSimPheno = 3,
                         #' nCoreMax = 4,
                         #' nCorePerGeno = 1,
                         #' nCorePerPheno = 3,
                         saveDataFileName = NULL)
### create specie information
mySpec <- specie$new(nChr = 3,
                     lChr = c(100, 150, 200),
                     specName = "Example 1",
                     ploidy = 2,
                     mutRate = 10^-8,
                     recombRate = 10^-6,
                     chrNames = c("C1", "C2", "C3"),
                     nLoci = 100,
                     recombRateOneVal = FALSE,
                     effPopSize = 100,
                     simInfo = mySimInfo,
                     verbose = TRUE)
### create lociInfo object
myLoci <- lociInfo$new(genoMap = NULL, specie = mySpec)
plot(myLoci, alpha = 0.1)
### create traitInfo object
myTrait <- traitInfo$new(lociInfo = myLoci,
                         nMarkers = 80,
                         nTraits = 3,
                         nQTLs = c(4, 8, 3),
                         actionTypeEpiSimple = TRUE,
                         qtlOverlap = TRUE,
                         nOverlap = c(2, 3, 0),
                         effCor = 0.1,
                         propDomi = 0.2,
                         interactionMean = c(4, 1, 2))
myTrait$plot(alphaMarker = 0.1)
### create bsInfo object
myBsInfo <- bsInfo$new(simInfo = mySimInfo,
                       specie = mySpec,
                       lociInfo = myLoci,
                       traitInfo = myTrait,
                       geno = NULL,
                       haplo = NULL,
                       founderIsInitPop = TRUE,
                       popNameBase = "Population",
                       initIndNames = NULL,
                       verbose = TRUE)
### create cross information object
for (i in 1:10) {
  myCrossInfo <- crossInfo$new(parentPopulation = myBsInfo$populations[[myBsInfo$generation]],
                               method = "randomMate",
                               nNextPop = 100)
  myBsInfo$nextGeneration(crossInfo = myCrossInfo)
}
geno <- myBsInfo$overGeneration()$genoMat
myBsInfo$print()
myBsInfo$plot(plotTarget = "trueAGV",
              targetTrait = 1:3,
              targetPopulation = 1:11,
              plotType = "jitter")


Method computeLociEffInit()

estimate/extract marker/QTL effects information

Usage
simBsOpt$computeLociEffInit()

Method startSimulation()

start simulation of breeding scheme

Usage
simBsOpt$startSimulation()

Method summaryResults()

start simulation of breeding scheme

Usage
simBsOpt$summaryResults()

Method print()

Display information about the object

Usage
simBsOpt$print()

Method plot()

Draw figures for visualization of simulation results for summary statistics

Usage
simBsOpt$plot(
  targetTrait = 1,
  targetPopulation = NULL,
  plotType = "box",
  plotTargetDensity = "max",
  plotGVMethod = "true",
  adjust = 1e-05
)
Arguments
targetTrait

[numeric] Target trait. character is OK, but numeric vector corresponding to target traits is preferred. It should be a vector with length 1.

targetPopulation

[numeric] Target populations. character is OK, but numeric vector corresponding to target traits is preferred.

plotType

[character] We offer "box", "violin", "lines", "density" to draw figures for simulation results.

plotTargetDensity

[character] When you choose "density" for 'plotType', you should select which summary statistics will be plotted. It should be a vector with length 1.

plotGVMethod

[character] Which type of GV (true GV or estimated GV) will be used for plotting the simulation results

adjust

[numeric] the bandwidth used is actually adjust*bw. This makes it easy to specify values like ‘half the default’ bandwidth. (see: 'adjust' in density)


Method clone()

The objects of this class are cloneable with this method.

Usage
simBsOpt$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.

Examples


## ------------------------------------------------
## Method `simBsOpt$new`
## ------------------------------------------------

### create simulation information
mySimInfo <- simInfo$new(simName = "Simulation Example",
                         simGeno = TRUE,
                         simPheno = TRUE,
                         #' nSimGeno = 1,
                         #' nSimPheno = 3,
                         #' nCoreMax = 4,
                         #' nCorePerGeno = 1,
                         #' nCorePerPheno = 3,
                         saveDataFileName = NULL)
### create specie information
mySpec <- specie$new(nChr = 3,
                     lChr = c(100, 150, 200),
                     specName = "Example 1",
                     ploidy = 2,
                     mutRate = 10^-8,
                     recombRate = 10^-6,
                     chrNames = c("C1", "C2", "C3"),
                     nLoci = 100,
                     recombRateOneVal = FALSE,
                     effPopSize = 100,
                     simInfo = mySimInfo,
                     verbose = TRUE)
### create lociInfo object
myLoci <- lociInfo$new(genoMap = NULL, specie = mySpec)
plot(myLoci, alpha = 0.1)
### create traitInfo object
myTrait <- traitInfo$new(lociInfo = myLoci,
                         nMarkers = 80,
                         nTraits = 3,
                         nQTLs = c(4, 8, 3),
                         actionTypeEpiSimple = TRUE,
                         qtlOverlap = TRUE,
                         nOverlap = c(2, 3, 0),
                         effCor = 0.1,
                         propDomi = 0.2,
                         interactionMean = c(4, 1, 2))
myTrait$plot(alphaMarker = 0.1)
### create bsInfo object
myBsInfo <- bsInfo$new(simInfo = mySimInfo,
                       specie = mySpec,
                       lociInfo = myLoci,
                       traitInfo = myTrait,
                       geno = NULL,
                       haplo = NULL,
                       founderIsInitPop = TRUE,
                       popNameBase = "Population",
                       initIndNames = NULL,
                       verbose = TRUE)
### create cross information object
for (i in 1:10) {
  myCrossInfo <- crossInfo$new(parentPopulation = myBsInfo$populations[[myBsInfo$generation]],
                               method = "randomMate",
                               nNextPop = 100)
  myBsInfo$nextGeneration(crossInfo = myCrossInfo)
}
geno <- myBsInfo$overGeneration()$genoMat
myBsInfo$print()
myBsInfo$plot(plotTarget = "trueAGV",
              targetTrait = 1:3,
              targetPopulation = 1:11,
              plotType = "jitter")


KosukeHamazaki/myBreedSimulatR documentation built on Aug. 31, 2024, 3:55 p.m.