getCastePop {SIMplyBee}R Documentation

Access individuals of a caste

Description

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

Usage

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

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)

drones <- createDrones(x = basePop[1], nInd = 1000)
droneGroups <- pullDroneGroupsFromDCA(drones, n = 10, nDrones = nFathersPoisson)

# Create a Colony and a MultiColony class
colony <- createColony(x = basePop[2])
colony <- cross(colony, drones = droneGroups[[1]])
apiary <- createMultiColony(basePop[3:4], n = 2)
apiary <- cross(apiary, drones = droneGroups[c(2, 3)])

# Build-up and add virgin queens
colony <- buildUp(x = colony)
apiary <- buildUp(x = apiary)
colony <- addVirginQueens(x = colony)
apiary <- addVirginQueens(x = apiary)

# Get the queen of the colony
getCastePop(colony, caste = "queen")
getQueen(colony)

# Comparison of getCastePop() and getWorkers()
getCastePop(colony, caste = "workers")
getCastePop(colony, caste = "workers")
getCastePop(colony, caste = "workers", nInd = 2)
# Or aliases
getWorkers(colony)
# Same aliases exist for all the castes!

# Input is a MultiColony class - same behaviour as for the Colony!
getCastePop(apiary, caste = "queen")
# Or alias
getQueen(apiary)

# Sample individuals from all the castes
getCastePop(colony, nInd = 5, caste = "all")

# Get different number of workers per colony
getCastePop(apiary, caste = "workers", nInd = c(10, 20))
# Or alias
getWorkers(apiary, nInd = c(10, 20))

# Obtain individuals from MultiColony as a single population
getCastePop(apiary, caste = "queen", collapse = TRUE)
getQueen(apiary, collapse = TRUE)
getWorkers(apiary, nInd = 10, collapse = TRUE)
getDrones(apiary, nInd = 3, collapse = TRUE)

[Package SIMplyBee version 0.3.0 Index]