Level 0 function that calculate value(s) of a colony.
calcColonyValue(x, FUN = NULL, simParamBee = NULL, ...)
calcColonyPheno(x, FUN = mapCasteToColonyPheno, simParamBee = NULL, ...)
calcColonyGv(x, FUN = mapCasteToColonyGv, simParamBee = NULL, ...)
calcColonyBv(x, FUN = mapCasteToColonyBv, simParamBee = NULL, ...)
calcColonyDd(x, FUN = mapCasteToColonyDd, simParamBee = NULL, ...)
calcColonyAa(x, FUN = mapCasteToColonyAa, simParamBee = NULL, ...)
function, that calculates colony value from values of colony members
SimParamBee
, global simulation parameters
other arguments of FUN
a matrix with one value or a row of values when x
is
Colony-class
and a row-named matrix when x
is
MultiColony-class
, where names are colony IDs
calcColonyPheno()
: Calculate colony phenotype value from caste individuals' phenotype values
calcColonyGv()
: Calculate colony genetic value from caste individuals' genetic values
calcColonyBv()
: Calculate colony breeding value from caste individuals' breeding values
calcColonyDd()
: Calculate colony dominance value from caste individuals' dominance values
calcColonyAa()
: Calculate colony epistasis value from caste individuals' epistasis value
mapCasteToColonyValue
as an example of FUN
,
selectColonies
for example for to select colonies based
on these values, and
vignette(topic = "QuantitativeGenetics", package = "SIMplyBee")
founderGenomes <- quickHaplo(nInd = 5, nChr = 1, segSites = 100)
SP <- SimParamBee$new(founderGenomes)
SP$nThreads = 1L
# Define two traits that collectively affect colony honey yield:
# 1) queen's effect on colony honey yield, say via pheromone secretion phenotype
# 2) workers' effect on colony honey yield, say via foraging ability phenotype
# The traits will have a negative genetic correlation of -0.5 and heritability
# of 0.25 (on an individual level)
nWorkers <- 10
mean <- c(10, 10 / nWorkers)
varA <- c(1, 1 / nWorkers)
corA <- matrix(data = c(
1.0, -0.5,
-0.5, 1.0
), nrow = 2, byrow = TRUE)
varE <- c(3, 3 / nWorkers)
varA / (varA + varE)
#> [1] 0.25 0.25
SP$addTraitADE(nQtlPerChr = 100,
mean = mean,
var = varA, corA = corA,
meanDD = 0.1, varDD = 0.2, corD = corA,
relAA = 0.1, corAA = corA)
SP$setVarE(varE = varE)
basePop <- createVirginQueens(founderGenomes)
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
drones <- createDrones(x = basePop[1], nInd = 200)
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
droneGroups <- pullDroneGroupsFromDCA(drones, n = 10, nDrones = nFathersPoisson)
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
# Create and cross Colony and MultiColony class
colony <- createColony(x = basePop[2])
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
colony <- cross(colony, drones = droneGroups[[1]])
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
colony <- buildUp(colony, nWorkers = nWorkers, nDrones = 3)
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
apiary <- createMultiColony(basePop[3:5], n = 2)
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
apiary <- cross(apiary, drones = droneGroups[c(2, 3)])
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
apiary <- buildUp(apiary, nWorkers = nWorkers, nDrones = 3)
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
# Colony value - shorthand version
# (using the default mapCasteToColony*() functions - you can provide yours instead!)
# Phenotype value
calcColonyPheno(colony)
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
calcColonyPheno(apiary)
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
# Genetic value
calcColonyGv(colony)
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
calcColonyGv(apiary)
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
# Colony value - long version
# (using the default mapCasteToColony*() function - you can provide yours instead!)
calcColonyValue(colony, FUN = mapCasteToColonyPheno)
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
calcColonyValue(apiary, FUN = mapCasteToColonyPheno)
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
# Colony value - long version - using a function stored in SimParamBee (SP)
# (using the default mapCasteToColony*() function - you can provide yours instead!)
SP$colonyValueFUN <- mapCasteToColonyPheno
calcColonyValue(colony)
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
calcColonyValue(apiary)
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found