Frequently asked questions

2024-09-19

Introduction

This document collates other important points not mentioned in previous vignettes or similar frequently asked questions. We will demonstrate some of the questions and answers with the R code so we load the package:

library(package = "SIMplyBee")

Why aren’t drones removed from colonies when creating a DCA?

In SIMplyBee, when we modify an object, we return it following R’s functional style of programming. However, we do not by default return drone-donor colonies when we sample the drones for mating and crossing the virgin queens. A virgin queen can mate with several drones, say from \(n\) colonies. These drones die during mating. To reflect this reality, the drone sampling or the crossing function should return \(n\) updated colonies with the drones removed, which could be cumbersome. To provide simple code, we by default only get a copy of drones from colonies and change their caste from drones to fathers, which marks them as mated and dead. This means they can’t be used anymore as drones anymore, but remain in the colony.

# Initiate simulation
founderGenomes <- quickHaplo(nInd = 3, nChr = 1, segSites = 10)
SP <- SimParamBee$new(founderGenomes, csdChr = NULL)

# Base virgin queens
baseVirginQueen <- createVirginQueens(founderGenomes)

# Base drones
baseDrones <- createDrones(baseVirginQueen[1])

# A colony
colony <- createColony(baseVirginQueen[2])
colony <- cross(x = colony, crossPlan = "create", drones = baseDrones, checkCross = "warning")
colony <- addDrones(colony, nInd = 100)
colony
#> An object of class "Colony" 
#> Id: 1 
#> Location: 0 0 
#> Queen: 2 
#> Number of fathers: 15 
#> Number of workers: 0 
#> Number of drones: 100 
#> Number of virgin queens: 0 
#> Has split: FALSE 
#> Has swarmed: FALSE 
#> Has superseded: FALSE 
#> Has collapsed: FALSE 
#> Is productive: FALSE

# Crossing one of the remaining virgin queens with drones from the 
DCA <- createDCA(colony, nInd = 50)
DCA
#> An object of class "Pop" 
#> Ploidy: 2 
#> Individuals: 50 
#> Chromosomes: 1 
#> Loci: 10 
#> Traits: 0
queen <- cross(x = baseVirginQueen[3], crossPlan = "create", drones = DCA, checkCross = "warning")
queen
#> An object of class "Pop" 
#> Ploidy: 2 
#> Individuals: 1 
#> Chromosomes: 1 
#> Loci: 10 
#> Traits: 0
getFathers(queen)
#> An object of class "Pop" 
#> Ploidy: 2 
#> Individuals: 15 
#> Chromosomes: 1 
#> Loci: 10 
#> Traits: 0

# Note that we did not by default remove drones from the colony when we 
# created the DCA, but these drones now have a caste changed to fathers, so
# they are not available anymore for further mating
colony@drones # 100 drones
#> An object of class "Pop" 
#> Ploidy: 2 
#> Individuals: 100 
#> Chromosomes: 1 
#> Loci: 10 
#> Traits: 0
table(getCaste(colony@drones)) # 50 drones 50 fathers
#> 
#>  drones fathers 
#>      85      15
getDrones(colony) # 50 drones
#> An object of class "Pop" 
#> Ploidy: 2 
#> Individuals: 85 
#> Chromosomes: 1 
#> Loci: 10 
#> Traits: 0