Level 1 function that returns individuals of a caste. These individuals stay in the colony (compared to pullCastePop).

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

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

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

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

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

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

Arguments

x

Colony-class or MultiColony-class, exceptionally Pop-class for calling getFathers on a queen population

caste

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

nInd

numeric, number of individuals to access, if NULL all individuals are accessed; if there are less individuals than requested, we return the ones available - this can return NULL. 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 and "order" that selects 1:nInd individuals (meaning it always returns at least one individual, even if nInd = 0)

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

simParamBee

SimParamBee, global simulation parameters

Value

when x is Colony-class return is

Pop-class for caste != "all" or list for caste == "all" with nodes named by caste; when x is

MultiColony-class return is a named list of

Pop-class for caste != "all" or named list of lists of

Pop-class for caste == "all". You can merge all the populations in the list with mergePops function.

Functions

  • getQueen(): Access the queen

  • getFathers(): Access fathers (drones the queen mated with)

  • getWorkers(): Access workers

  • getDrones(): Access drones

  • getVirginQueens(): Access virgin queens

See also

getQueen, getFathers, getVirginQueens, getWorkers, and getDrones

getCasteId and getCaste

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
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

# Build-up and add virgin queens
colony <- buildUp(x = colony)
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
apiary <- buildUp(x = apiary)
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
colony <- addVirginQueens(x = colony)
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
apiary <- addVirginQueens(x = apiary)
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found

# Get the queen of the colony
getCastePop(colony, caste = "queen")
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
getQueen(colony)
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found

# Comparison of getCastePop() and getWorkers()
getCastePop(colony, caste = "workers")
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
getCastePop(colony, caste = "workers")
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
getCastePop(colony, caste = "workers", nInd = 2)
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
# Or aliases
getWorkers(colony)
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
# Same aliases exist for all the castes!

# Input is a MultiColony class - same behaviour as for the Colony!
getCastePop(apiary, caste = "queen")
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
# Or alias
getQueen(apiary)
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found

# Sample individuals from all the castes
getCastePop(colony, nInd = 5, caste = "all")
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found

# Get different number of workers per colony
getCastePop(apiary, caste = "workers", nInd = c(10, 20))
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
# Or alias
getWorkers(apiary, nInd = c(10, 20))
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found

# Obtain individuals from MultiColony as a single population
getCastePop(apiary, caste = "queen", collapse = TRUE)
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
getQueen(apiary, collapse = TRUE)
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
getWorkers(apiary, nInd = 10, collapse = TRUE)
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
getDrones(apiary, nInd = 3, collapse = TRUE)
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found