getCsdAlleles {SIMplyBee}R Documentation

Get csd alleles

Description

Level 0 function that returns alleles from the csd locus. See SimParamBee for more information about the csd locus.

Usage

getCsdAlleles(
  x,
  caste = NULL,
  nInd = NULL,
  allele = "all",
  dronesHaploid = TRUE,
  collapse = FALSE,
  unique = FALSE,
  simParamBee = NULL
)

getQueenCsdAlleles(
  x,
  allele = "all",
  unique = FALSE,
  collapse = FALSE,
  simParamBee = NULL
)

getFathersCsdAlleles(
  x,
  nInd = NULL,
  allele = "all",
  dronesHaploid = TRUE,
  unique = FALSE,
  collapse = FALSE,
  simParamBee = NULL
)

getVirginQueensCsdAlleles(
  x,
  nInd = NULL,
  allele = "all",
  unique = FALSE,
  collapse = FALSE,
  simParamBee = NULL
)

getWorkersCsdAlleles(
  x,
  nInd = NULL,
  allele = "all",
  unique = FALSE,
  collapse = FALSE,
  simParamBee = NULL
)

getDronesCsdAlleles(
  x,
  nInd = NULL,
  allele = "all",
  dronesHaploid = TRUE,
  unique = FALSE,
  collapse = FALSE,
  simParamBee = NULL
)

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, for how many individuals; if NULL all individuals are taken; this can be useful as a test of sampling individuals

allele

character, either "all" for both alleles or an integer for a single allele, use a value of 1 for female allele and a value of 2 for male allele

dronesHaploid

logical, return haploid result for drones?

collapse

logical, if TRUE, the function will return a set of csd alleles across the entire population, colony, or multicolony (not separately for each caste when x is a colony or each caste of each colony when x is a multicolony. This is a way to get one single object as an output across castes or colonies. Note this has nothing to do with the colony collapse. It's like paste(..., collapse = TRUE). Default is FALSE. See examples about this behaviour.

unique

logical, return only the unique set of csd alleles. This argument interacts with collapse. Default is FALSE. See examples about this behaviour.

simParamBee

SimParamBee, global simulation parameters

Details

If both collapse and unique are TRUE, the function returns a unique set of csd alleles in the entire population, colony, or multicolony

Value

matrix with haplotypes when x is Pop-class, list of matrices with haplotypes when x is Colony-class (list nodes named by caste) and list of a list of matrices with haplotypes when x is MultiColony-class, outer list is named by colony id when x is MultiColony-class; NULL when x is NULL

Functions

Examples

founderGenomes <- quickHaplo(nInd = 8, nChr = 1, segSites = 100)
SP <- SimParamBee$new(founderGenomes, nCsdAlleles = 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)

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

# Use getCsdAlleles on a Population
getCsdAlleles(getQueen(colony))
getCsdAlleles(getWorkers(colony))

# Use getCsdAlleles on a Colony
getCsdAlleles(colony)
getCsdAlleles(colony, caste = "queen")
getQueenCsdAlleles(colony)
getCsdAlleles(colony, caste = "workers")
getWorkersCsdAlleles(colony)
# Same aliases exist for all the castes!

getCsdAlleles(colony, unique = TRUE)
getCsdAlleles(colony, collapse = TRUE)
getCsdAlleles(colony, collapse = TRUE, unique = TRUE)

# Use getCsdAlleles on a MultiColony
getCsdAlleles(apiary)
getCsdAlleles(apiary, unique = TRUE)
getCsdAlleles(apiary, collapse = TRUE, unique = TRUE)
getCsdAlleles(apiary, nInd = 2)

[Package SIMplyBee version 0.3.0 Index]