R/Functions_L2_Colony.R
replaceCastePop.Rd
Level 2 function that replaces a proportion of caste individuals with new individuals from a Colony or MultiColony object. Useful after events like season change, swarming, supersedure, etc. due to the short life span honeybees.
replaceCastePop(
x,
caste = NULL,
p = 1,
use = "rand",
exact = TRUE,
year = NULL,
simParamBee = NULL
)
replaceWorkers(x, p = 1, use = "rand", exact = TRUE, simParamBee = NULL)
replaceDrones(x, p = 1, use = "rand", simParamBee = NULL)
replaceVirginQueens(x, p = 1, use = "rand", simParamBee = NULL)
character, "workers", "drones", or "virginQueens"
numeric, proportion of caste individuals to be replaced with new ones;
if input is MultiColony-class
,
the input could also be a vector of the same length as the number of colonies. If
a single value is provided, the same value will be applied to all the colonies
character, all the options provided by selectInd
-
guides selection of caste individuals that stay when p < 1
logical, only relevant when adding workers - if the csd locus is turned
on and exact is TRUE
, we replace the exact specified number of viable workers
(heterozygous at the csd locus). You probably want this set to TRUE since you want to
replace with the same number of workers.
numeric, only relevant when replacing virgin queens, year of birth for virgin queens
SimParamBee
, global simulation parameters
Colony-class
or or MultiColony-class
with
replaced virgin queens
replaceWorkers()
: Replaces some workers in a colony
replaceDrones()
: Replaces some drones in a colony
replaceVirginQueens()
: Replaces some virgin queens in a colony
founderGenomes <- quickHaplo(nInd = 5, 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 = 100)
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
droneGroups <- pullDroneGroupsFromDCA(drones, n = 5, 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[4:5], n = 2)
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
apiary <- cross(apiary, drones = droneGroups[3:4])
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
# Add individuals
colony <- buildUp(colony, nWorkers = 5, nDrones = 2)
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
apiary <- buildUp(apiary, nWorkers = 5, nDrones = 2)
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
# Replace workers in a colony
getCasteId(colony, caste = "workers")
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
colony <- replaceCastePop(colony, caste = "workers", p = 0.5)
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
# You can also use an alias
replaceWorkers(colony, p = 0.5)
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
# Same aliases exist for all the castes!!!
getCasteId(colony, caste = "workers")
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
getCasteId(apiary, caste="workers")
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
apiary <- replaceWorkers(apiary, p = 0.5)
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
getCasteId(apiary, caste="workers")
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found