getGv {SIMplyBee}R Documentation

Access genetic values of individuals in a caste

Description

Level 0 function that returns genetic values of individuals in a caste.

Usage

getGv(x, caste = NULL, nInd = NULL, collapse = FALSE)

getQueenGv(x, collapse = FALSE)

getFathersGv(x, nInd = NULL, collapse = FALSE)

getVirginQueensGv(x, nInd = NULL, collapse = FALSE)

getWorkersGv(x, nInd = NULL, collapse = FALSE)

getDronesGv(x, nInd = NULL, collapse = FALSE)

Arguments

x

Pop-class, Colony-class, or MultiColony-class

caste

NULL or character, NULL when x is a Pop-class, and character when x is a Colony-class or MultiColony-class with the possible values of "queen", "fathers", "workers", "drones", "virginQueens", or "all"

nInd

numeric, number of individuals to access, if NULL all individuals are accessed, otherwise a random sample

collapse

logical, if the return value should be a single matrix with genetic values of all the individuals

Value

vector of phenotype values when x is Colony-class and list of vectors of genetic values when x is MultiColony-class, named by colony id when x is MultiColony-class

Functions

See Also

gv and vignette(topic = "QuantitativeGenetics", package = "SIMplyBee")

Examples

founderGenomes <- quickHaplo(nInd = 4, nChr = 1, segSites = 50)
SP <- SimParamBee$new(founderGenomes)
SP$addTraitA(nQtlPerChr = 10, var = 1)
SP$addSnpChip(5)
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]])
colony <- buildUp(x = colony, nWorkers = 6, nDrones = 3)
colony <- addVirginQueens(x = colony, nInd = 5)

apiary <- createMultiColony(basePop[3:4], n = 2)
apiary <- cross(apiary, drones = droneGroups[c(2, 3)])
apiary <- buildUp(x = apiary, nWorkers = 6, nDrones = 3)
apiary <- addVirginQueens(x = apiary, nInd = 5)

# Input is a population
getGv(x = getQueen(colony))
queens <- getQueen(apiary, collapse = TRUE)
getGv(queens)

# Input is a colony
getGv(colony, caste = "queen")
getQueenGv(colony)

getGv(colony, caste = "workers")
getWorkersGv(colony)
# Same aliases exist for all the castes!

# Get genetic values for all individuals
getGv(colony, caste = "all")
# Get all genetic values in a single matrix
getGv(colony, caste = "all", collapse = TRUE)

# Input is a MultiColony - same behaviour as for the Colony!
getGv(apiary, caste = "queen")
getQueenGv(apiary)

# Get the genetic values of all individuals either by colony or in a single matrix
getGv(apiary, caste = "all")
getGv(apiary, caste = "all", collapse = TRUE)

[Package SIMplyBee version 0.3.0 Index]