Level 1 function that pulls individuals from a caste in a colony. These individuals are removed from the colony (compared to getCaste).

pullCastePop(
  x,
  caste,
  nInd = NULL,
  use = "rand",
  removeFathers = TRUE,
  collapse = FALSE,
  simParamBee = NULL
)

pullQueen(x, collapse = FALSE, simParamBee = NULL)

pullWorkers(x, nInd = NULL, use = "rand", collapse = FALSE, simParamBee = NULL)

pullDrones(
  x,
  nInd = NULL,
  use = "rand",
  removeFathers = TRUE,
  collapse = FALSE,
  simParamBee = NULL
)

pullVirginQueens(
  x,
  nInd = NULL,
  use = "rand",
  collapse = FALSE,
  simParamBee = NULL
)

Arguments

x

Colony-class or MultiColony-class

caste

character, "queen", "workers", "drones", or "virginQueens"

nInd

numeric, number of individuals to pull, if NULL all individuals are pulled. 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.

use

character, all options provided by selectInd

removeFathers

logical, removes drones that have already mated; set to FALSE if you would like to get drones for mating with multiple virgin queens, say via insemination

collapse

logical, whether to return a single merged population for the pulled individuals (does not affect the remnant colonies)

simParamBee

SimParamBee, global simulation parameters

Value

list of Pop-class and Colony-class

when x is Colony-class and list of (a list of

Pop-class named by colony id) and

MultiColony-class when x is

MultiColony-class

Functions

  • pullQueen(): Pull queen from a colony

  • pullWorkers(): Pull workers from a colony

  • pullDrones(): Pull drones from a colony

  • pullVirginQueens(): Pull virgin queens from a colony

See also

pullQueen, pullVirginQueens, pullWorkers, and pullDrones

Examples

founderGenomes <- quickHaplo(nInd = 8, nChr = 1, segSites = 100)
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 = 1000)
#> 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 a Colony and a 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(x = colony, nWorkers = 100, nDrones = 10, exact = TRUE)
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
colony <- addVirginQueens(x = colony, nInd = 3)
#> 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[c(2, 3)])
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
apiary <- buildUp(x = apiary, nWorkers = 100, nDrones = 10, exact = TRUE)
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
apiary <- addVirginQueens(x = apiary, nInd = 3)
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found

# pullCastePop on Colony class
# We can't pull the queen and leave the colony queenless
pullCastePop(colony, caste = "virginQueens")
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
pullCastePop(colony, caste = "virginQueens", nInd = 2)
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
# Or use aliases
pullVirginQueens(colony)
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
pullVirginQueens(colony, nInd = 2)
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
# Same aliases exist for all the castes!!!

# pullCastePop on MultiColony class - same behaviour as for the Colony!
pullCastePop(apiary, caste = "workers")
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
# Or pull out unequal number of workers from colonies
pullCastePop(apiary, caste = "workers", nInd = c(10, 20))
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
pullWorkers(apiary)
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
nWorkers(apiary)
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
nWorkers(pullWorkers(apiary)$remnant)
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found


# Merge all the pulled populations into a single population
pullCastePop(apiary, caste = "queen", collapse = TRUE)
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
pullCastePop(apiary, caste = "virginQueens", collapse = TRUE)
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found