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
)

getQueen(x, collapse = FALSE)

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

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

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

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

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

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)
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 createMultiColony(basePop[3:4], n = 2): object 'basePop' 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 is(x, class2 = "Colony"): object 'colony' not found
getQueen(colony)
#> Error in is(x, class2 = "Colony"): object 'colony' not found

# Comparison of getCastePop() and getWorkers()
getCastePop(colony, caste = "workers")
#> Error in is(x, class2 = "Colony"): object 'colony' not found
getCastePop(colony, caste = "workers")
#> Error in is(x, class2 = "Colony"): object 'colony' not found
getCastePop(colony, caste = "workers", nInd = 2)
#> Error in is(x, class2 = "Colony"): object 'colony' not found
# Or aliases
getWorkers(colony)
#> Error in is(x, class2 = "Colony"): object 'colony' 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 is(x, class2 = "Colony"): object 'apiary' not found
# Or alias
getQueen(apiary)
#> Error in is(x, class2 = "Colony"): object 'apiary' not found

# Sample individuals from all the castes
getCastePop(colony, nInd = 5, caste = "all")
#> Error in is(x, class2 = "Colony"): object 'colony' not found

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

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