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

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

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

Details

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

Functions

  • getQueenCsdAlleles(): Access csd alleles of the queen

  • getFathersCsdAlleles(): Access csd alleles of the fathers

  • getVirginQueensCsdAlleles(): Access csd alleles of the virgin queens

  • getWorkersCsdAlleles(): Access csd alleles of the workers

  • getDronesCsdAlleles(): Access csd alleles of the drones

Examples

founderGenomes <- quickHaplo(nInd = 8, nChr = 1, segSites = 100)
SP <- SimParamBee$new(founderGenomes, nCsdAlleles = 5)
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
colony <- buildUp(x = colony, nWorkers = 6, nDrones = 3)
#> 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
apiary <- buildUp(x = apiary, nWorkers = 6, nDrones = 3)
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found

# Use getCsdAlleles on a Population
getCsdAlleles(getQueen(colony))
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
getCsdAlleles(getWorkers(colony))
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found

# Use getCsdAlleles on a Colony
getCsdAlleles(colony)
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
getCsdAlleles(colony, caste = "queen")
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
getQueenCsdAlleles(colony)
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
getCsdAlleles(colony, caste = "workers")
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
getWorkersCsdAlleles(colony)
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
# Same aliases exist for all the castes!

getCsdAlleles(colony, unique = TRUE)
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
getCsdAlleles(colony, collapse = TRUE)
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
getCsdAlleles(colony, collapse = TRUE, unique = TRUE)
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found

# Use getCsdAlleles on a MultiColony
getCsdAlleles(apiary)
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
getCsdAlleles(apiary, unique = TRUE)
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
getCsdAlleles(apiary, collapse = TRUE, unique = TRUE)
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
getCsdAlleles(apiary, nInd = 2)
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found