Level 0 function that returns the number of distinct csd alleles
in input. See SimParamBee
for more information about the csd
locus.
nCsdAlleles(x, collapse = FALSE, simParamBee = NULL)
Pop-class
, Colony-class
, or
MultiColony-class
logical, if TRUE
, the function will return the number
of distinct csd alleles in either the entire population, colony, or
multicolony. Note this has nothing to do with the colony collapse. It's
like paste(..., collapse = TRUE)
. Default is FALSE
. See
examples about this behaviour.Default is FALSE
.
SimParamBee
, global simulation parameters
integer representing the number of distinct csd alleles when x
is Pop-class
(or ), list of integer
when x
is Colony-class
(list nodes named by caste) and
list of a list of integer when x
is MultiColony-class
,
outer list is named by colony id when x
is
MultiColony-class
; the integer rep
Queen has 2 distinct csd alleles, since she has to be heterozygous
to be viable. The same holds for individual virgin queens and workers, but
note that looking at csd genotypes of virgin queens or workers we are
looking at a sample of 1 csd allele from the queen and 1 csd allele from
their fathers, noting that homozygous genotypes are excluded. Therefore,
nCsdAlleles()
from virgin queens and workers is a noisy realisation
of nCsdAlleles()
from queens and fathers. For this reason, we also
report nCsdAlleles()
from queens and fathers combined (see the
queenAndFathers
list node) when x
is
Colony-class
. This last measure is then the expected number
of csd alleles in a colony as opposed to realised number of csd alleles in
a sample of virgin queens and workers. Similarly as for virgin queens and
workers, nCsdAlleles()
from drones gives a noisy realisation of
nCsdAlleles()
from queens. The amount of noise will depend on the
number of individuals, so in most cases with reasonable number of
individuals there should be minimal amount of noise.
founderGenomes <- quickHaplo(nInd = 8, nChr = 1, segSites = 100)
SP <- SimParamBee$new(founderGenomes)
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
colony <- addVirginQueens(x = colony, nInd = 4)
#> 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
apiary <- addVirginQueens(x = apiary, nInd = 5)
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
nCsdAlleles(getQueen(colony))
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
nCsdAlleles(getWorkers(colony))
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
nCsdAlleles(colony)
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
nCsdAlleles(colony, collapse = TRUE)
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
nCsdAlleles(apiary)
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
nCsdAlleles(apiary, collapse = TRUE)
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found