mapCasteToColonyValue {SIMplyBee}R Documentation

Map caste member (individual) values to a colony value

Description

Maps caste member (individual) values to a colony value - for phenotype, genetic, breeding, dominance, and epistasis values. This function can be used as FUN argument in calcColonyValue function(s). It can also be saved in SimParamBee$colonyValueFUN as a default function called by calcColonyValue function(s).

This is just an example - quite a flexible one! You can provide your own "caste functions" that satisfy your needs within this mapping function (see queenFUN, workersFUN, and dronesFUN below) or provide a complete replacement of this mapping function! For example, this mapping function does not cater for indirect (social) genetic effects where colony individuals value impacts value of other colony individuals. Note though that you can achieve this impact also via multiple correlated traits, such as a queen and a workers trait.

Usage

mapCasteToColonyValue(
  colony,
  value = "pheno",
  queenTrait = 1,
  queenFUN = function(x) x,
  workersTrait = 2,
  workersFUN = colSums,
  dronesTrait = NULL,
  dronesFUN = NULL,
  traitName = NULL,
  combineFUN = function(q, w, d) q + w,
  checkProduction = TRUE,
  notProductiveValue = 0,
  simParamBee = NULL
)

mapCasteToColonyPheno(colony, simParamBee = NULL, ...)

mapCasteToColonyGv(colony, checkProduction = FALSE, simParamBee = NULL, ...)

mapCasteToColonyBv(colony, checkProduction = FALSE, simParamBee = NULL, ...)

mapCasteToColonyDd(colony, checkProduction = FALSE, simParamBee = NULL, ...)

mapCasteToColonyAa(colony, checkProduction = FALSE, simParamBee = NULL, ...)

Arguments

colony

Colony-class

value

character, one of pheno or gv

queenTrait

numeric (column position) or character (column name), trait(s) that represents queen's contribution to colony value(s); if NULL then this contribution is 0; you can pass more than one trait here, but make sure that combineFUN works with these trait dimensions

queenFUN

function, function that will be applied to queen's value

workersTrait

numeric (column position) or character (column name), trait(s) that represents workers' contribution to colony value(s); if NULL then this contribution is 0; you can pass more than one trait here, but make sure that combineFUN works with these trait dimensions

workersFUN

function, function that will be applied to workers values

dronesTrait

numeric (column position) or character (column name), trait(s) that represents drones' contribution to colony value(s); if NULL then this contribution is 0; you can pass more than one trait here, but make sure that combineFUN works with these trait dimensions

dronesFUN

function, function that will be applied to drone values

traitName

the name of the colony trait(s), say, honeyYield; you can pass more than one trait name here, but make sure to match them with combineFUN trait dimensions

combineFUN

function that will combine the queen, worker, and drone contributions - this function should be defined as function(q, w, d) where q represents queen's, q represents workers', and d represents drones' contribution.

checkProduction

logical, does the value depend on the production status of colony; if yes and production is FALSE, the return is notProductiveValue - this will often make sense for colony phenotype value only; you can pass more than one logical value here (one per trait coming out of combineFUN)

notProductiveValue

numeric, returned value when colony is not productive; you can pass more than one logical value here (one per trait coming out of combineFUN)

simParamBee

SimParamBee, global simulation parameters

...

other arguments of mapCasteToColonyValue (for its aliases)

Details

This is a utility/mapping function meant to be called by calcColonyValue. It only works on a single colony - use calcColonyValue to get Colony or MultiColony values.

Value

numeric matrix with one value or a row of values

Functions

See Also

SimParamBee field colonyValueFUN and functions calcColonyValue, calcColonyPheno, calcColonyGv, getEvents, pheno, and gv, as well as vignette(topic = "QuantitativeGenetics", package = "SIMplyBee")

Examples

founderGenomes <- quickHaplo(nInd = 5, nChr = 1, segSites = 100)
SP <- SimParamBee$new(founderGenomes)

# 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)
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)
drones <- createDrones(x = basePop[1], nInd = 10)
colony <- createColony(x = basePop[2])
colony <- cross(colony, drones = drones)
colony <- buildUp(colony, nWorkers = nWorkers, nDrones = 3)

# Colony value
mapCasteToColonyPheno(colony)
mapCasteToColonyGv(colony)

# To understand where the above values come from, study the contents of
# mapCasteToColonyValue() and the values below:

# Phenotype values
getQueenPheno(colony)
getWorkersPheno(colony)

# Genetic values
getQueenGv(colony)
getWorkersGv(colony)


[Package SIMplyBee version 0.3.0 Index]