founderGenomes <- quickHaplo(nInd = 4, nChr = 1, segSites = 50)
SP <- SimParamBee$new(founderGenomes)
SP$nThreads = 1L
SP$setTrackRec(TRUE)
SP$setTrackPed(isTrackPed = TRUE)
# Create virgin queens on a MapPop
basePop <- createCastePop(founderGenomes, caste = "virginQueens")
# Or alias
createVirginQueens(founderGenomes)
# Same aliases exist for all the castes!!!
# Create drones on a Pop
drones <- createDrones(x = basePop[1], nInd = 200)
# Or create unequal number of drones from multiple virgin queens
drones <- createDrones(basePop[1:2], nInd = c(100, 200))
droneGroups <- pullDroneGroupsFromDCA(drones, n = 3, 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)])
# Using default nInd in SP
colony@virginQueens <- createVirginQueens(colony)
colony@workers <- createWorkers(colony)$workers
colony@drones <- createDrones(colony)
# Usually, you would use functions buildUp() or addCastePop()
# These populations hold individual information
# Example on the virgin queens (same holds for all castes!)
virginQueens <- colony@virginQueens
virginQueens@id
virginQueens@sex
virginQueens@mother
virginQueens@father
# Specify own number
SP$nVirginQueens <- 15
SP$nWorkers <- 100
SP$nDrones <- 10
createVirginQueens(colony)
createVirginQueens(apiary)
# Or creating unequal numbers
createVirginQueens(apiary, nInd = c(5, 10))
# nVirginQueens will NOT vary between function calls when a constant is used
# Specify a function that will give a number
createVirginQueens(colony, nInd = nVirginQueensPoisson)
createVirginQueens(apiary, nInd = nVirginQueensPoisson)
# No. of individuals will vary between function calls when a function is used
# Store a function or a value in the SP object
SP$nVirginQueens <- nVirginQueensPoisson
createVirginQueens(colony)
createVirginQueens(colony)
createVirginQueens(apiary)
createVirginQueens(apiary)
# No. of individuals will vary between function calls when a function is used
# csd homozygosity - relevant when creating virgin queens
SP <- SimParamBee$new(founderGenomes, csdChr = 1, nCsdAlleles = 8)
SP$nThreads = 1L
basePop <- createVirginQueens(founderGenomes, editCsd = FALSE)
all(isCsdHeterozygous(basePop))
basePop <- createVirginQueens(founderGenomes, editCsd = TRUE)
all(isCsdHeterozygous(basePop))
Run the code above in your browser using DataLab