Level 1 function that crosses (mates) a virgin queen to a group of drones. The virgin queen(s) could be within a population (Pop-class), in a colony (Colony-class), or multi-colony (MultiColony-class). This function does not create any progeny, it only stores the mated drones (fathers) so we can later create progeny as needed. When input is a (Colony-class) or (MultiColony-class), one virgin queens is selected at random, mated, and promoted to the queen of the colony. Other virgin queens are destroyed. Mated drones (fathers) are stored for producing progeny at a later stage.

cross(x, drones, crossPlan = NULL, checkMating = "error", simParamBee = NULL)

Arguments

x

Pop-class or codeColony-class or MultiColony-class, one or more virgin queens / colonies to be mated;

drones

Pop-class or a list of Pop-class, group(s) of drones that will be mated with virgin queen(s); if there is more than one virgin queen, the user has to provide a list of drone Pop-class. For this, the user can use pullDroneGroupsFromDCA

crossPlan,

named list with names being virgin queen or colony IDs with each list element holding the IDs of selected drones. Also see createRandomCrossPlan. If cross plan is NULL, we cross each virgin queen with the element-wise element of drones, which should be the same length as the number of virgin queens If the cross plan is provided, the drones argument must be a single Pop-class.

checkMating

character, throw a warning (when checkMating = "warning"), or stop error (when checkMating = "error") when some matings fail (see Details)

simParamBee

SimParamBee, global simulation parameters

Value

Pop-class with mated queen(s). The misc slot of the queens contains additional information about the number of workers, drones, and homozygous brood produced, and the expected percentage of csd homozygous brood.

Details

This function changes caste for the mated drones to fathers, and mated virgin queens to queens. See examples. This means that you can not use these individuals in matings any more!

If the supplied drone population is empty (has 0 individuals), which can happen in edge cases or when nFathersPoisson is used instead of nFathersTruncPoisson, then mating of a virgin queen will fail and she will stay virgin. This can happen for just a few of many virgin queens, which can be annoying to track down, but you can use isQueen or isVirginQueen to find such virgin queens. You can use checkMating to alert you about this situation.

See also

Colony-class on how we store the fathers along the queen.

For crossing virgin queens according to a cross plan, see createRandomCrossPlan. For crossing virgin queens on a mating stations, see createMatingStationDCA

Examples

founderGenomes <- quickHaplo(nInd = 20, nChr = 1, segSites = 100)
SP <- SimParamBee$new(founderGenomes)
basePop <- createVirginQueens(founderGenomes)
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found

drones <- createDrones(x = basePop[1], nInd = 200)
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
droneGroups <- pullDroneGroupsFromDCA(drones, n = 8, nDrones = nFathersPoisson)
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found

# If input is a Pop class of virgin queen(s)
virginQueen1 <- basePop[2]
#> Error in eval(expr, envir, enclos): object 'basePop' not found
isQueen(virginQueen1)
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
(matedQueen1 <- cross(
  x = virginQueen1,
  drones = droneGroups[[1]]
))
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found

isQueen(virginQueen1)
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
isQueen(matedQueen1)
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
nFathers(matedQueen1)
#> Error in is(x, class2 = "Pop"): object 'matedQueen1' not found
isDrone(getFathers(matedQueen1))
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
isFather(getFathers(matedQueen1))
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found

virginQueen2 <- basePop[3]
#> Error in eval(expr, envir, enclos): object 'basePop' not found
(matedQueen2 <- cross(
  x = virginQueen2,
  drones = droneGroups[[2]]
))
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found

isQueen(virginQueen2)
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
isQueen(matedQueen2)
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
nFathers(matedQueen2)
#> Error in is(x, class2 = "Pop"): object 'matedQueen2' not found

matedQueens <- cross(
  x = c(basePop[4], basePop[5]),
  drones = droneGroups[c(3, 4)]
)
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found

isQueen(matedQueens)
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
nFathers(matedQueens)
#> Error in is(x, class2 = "Pop"): object 'matedQueens' not found
getFathers(matedQueens)
#> Error in is(x, class2 = "Pop"): object 'matedQueens' not found

# Inbred mated queen (mated with her own sons)
matedQueen3 <- cross(
  x = basePop[1],
  drones = droneGroups[[5]]
)
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
# Check the expected csd homozygosity
pHomBrood(matedQueen3)
#> Error in is(x, class2 = "Pop"): object 'matedQueen3' not found

# If input is a Colony or MultiColony class
# Create Colony and MultiColony class
colony <- createColony(basePop[6])
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
isVirginQueen(getVirginQueens(colony))
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
apiary <- createMultiColony(basePop[7:8], n = 2)
#> Error in createMultiColony(basePop[7:8], n = 2): object 'basePop' not found
all(isVirginQueen(mergePops(getVirginQueens(apiary))))
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found

# Cross
colony <- cross(colony, drones = droneGroups[[6]])
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
isQueenPresent(colony)
#> Error in is(x, class2 = "Colony"): object 'colony' not found
apiary <- cross(apiary, drones = droneGroups[c(7, 8)])
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
all(isQueenPresent(apiary))
#> Error in is(x, class2 = "Colony"): object 'apiary' not found
nFathers(apiary)
#> Error in is(x, class2 = "Pop"): object 'apiary' not found

# Try mating with drones that were already used for mating
colony <- createColony(basePop[9])
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
try((matedColony <- cross(x = colony, drones = droneGroups[[1]])))
#> Error in get(x = "SP", envir = .GlobalEnv) : object 'SP' not found
# Create new drones and mate the colony with them
drones <- createDrones(x = basePop[1], nInd = 15)
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
all(isDrone(drones))
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
any(isFather(drones))
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
(matedColony <- cross(x = colony, drones = drones))
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
isQueenPresent(matedColony)
#> Error in is(x, class2 = "Colony"): object 'matedColony' not found