founderGenomes <- quickHaplo(nInd = 8, nChr = 1, segSites = 100)
SP <- SimParamBee$new(founderGenomes)
SP$nThreads = 1L
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 = 20, nDrones = 5)
colony <- addVirginQueens(colony, nInd = 5)
apiary <- createMultiColony(basePop[3:4], n = 2)
apiary <- cross(apiary, drones = droneGroups[c(2, 3)])
apiary <- buildUp(x = apiary, nWorkers = 10, nDrones = 2)
apiary <- addVirginQueens(apiary, nInd = 4)
getCasteSex(x = drones)
getCasteSex(x = colony)
getCasteSex(x = apiary, caste = "workers")
getCasteSex(x = apiary)
getCasteSex(x = apiary, caste = "virginQueens")
# Collapse information into a single vector
getCasteSex(colony, caste = "all", collapse = TRUE)
# Create a data.frame with sex, colony, and caste information
(tmpC <- getCaste(apiary[[1]]))
(tmpS <- getCasteSex(apiary[[1]]))
(tmpI <- getCasteId(apiary[[1]]))
tmp <- data.frame(caste = unlist(tmpC), sex = unlist(tmpS), id = unlist(tmpI))
head(tmp)
tail(tmp)
(tmpC <- getCaste(apiary))
(tmpS <- getCasteSex(apiary))
(tmpI <- getCasteId(apiary))
tmp <- data.frame(caste = unlist(tmpC), sex = unlist(tmpS), id = unlist(tmpI))
tmp$colony <- sapply(
X = strsplit(
x = rownames(tmp), split = ".",
fixed = TRUE
),
FUN = function(z) z[[1]]
)
head(tmp)
tail(tmp)
Run the code above in your browser using DataLab