Level 2 function that re-queens a Colony or MultiColony object by adding a mated or a virgin queen, removing the previous queen, and changing the colony id to the new mated queen.

reQueen(x, queen, removeVirginQueens = TRUE, simParamBee = NULL)

Arguments

x

Colony-class or MultiColony-class

queen

Pop-class with one individual that will be the queen of the colony; if she is not mated, she will be added as a virgin queen that will have to be mated later; test will be run if the individual isVirginQueen or isQueen

removeVirginQueens

logical, remove existing virgin queens, default is TRUE since bee-keepers tend to remove any virgin queen cells to ensure the provided queen prevails (see details)

simParamBee

SimParamBee, global simulation parameters

Value

Colony-class or MultiColony-class with new queen(s) (see details)

Details

If the provided queen is mated, then she is saved in the queen slot of the colony. If she is not mated, then she is saved in the virgin queen slot (replacing any existing virgin queens) and once she is mated will be promoted to the queen of the colony.

Examples

founderGenomes <- quickHaplo(nInd = 12, nChr = 1, segSites = 50)
SP <- SimParamBee$new(founderGenomes)
SP$nThreads = 1L
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 = 7, 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
apiary <- createMultiColony(basePop[3:4], n = 2)
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
apiary <- cross(apiary, drones = droneGroups[2:3])
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found

# Check queen and virgin queens IDs
getCasteId(colony, caste = "queen")
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
getCasteId(colony, caste = "virginQueens")
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
getCasteId(apiary, caste = "queen")
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
getCasteId(apiary, caste = "virginQueens")
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found

# Requeen with virgin queens
virginQueens <- basePop[5:8]
#> Error in eval(expr, envir, enclos): object 'basePop' not found
# Requeen a Colony class
colony <- reQueen(colony, queen = virginQueens[1])
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
# Check queen and virgin queens IDs
getCasteId(colony, caste = "queen")
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
getCasteId(colony, caste = "virginQueens")
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found

#' # Requeen with mated queens
matedQueens <- cross(x = basePop[9:12], drones = droneGroups[4:7])
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
colony <- reQueen(colony, queen = matedQueens[1])
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
# Check queen and virgin queens IDs
getCasteId(colony, caste = "queen")
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
getCasteId(colony, caste = "virginQueens")
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found

# Requeen a MultiColony class
apiary <- reQueen(apiary, queen = virginQueens[2:3])
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
# Check queen and virgin queens IDs
getCasteId(apiary, caste = "queen")
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
getCasteId(apiary, caste = "virginQueens")
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found