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)
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)
Run the code above in your browser using DataLab