Level 0 function that returns a pooled genotype from true genotypes to mimic genotyping of a pool of colony members.

getPooledGeno(x, type = NULL, sex = NULL)

Arguments

x

matrix, true genotypes with individuals in rows and sites in columns

type

character, "mean" for average genotype or "count" for the counts of reference and alternative alleles

sex

character, vector of "F" and "M" to denote the sex of individuals in x

Value

a numeric vector with average allele dosage when type = "mean"

and a two-row matrix with the counts of reference (1st row) and alternative (2nd row) alleles

Examples

founderGenomes <- quickHaplo(nInd = 3, nChr = 1, segSites = 50)
SP <- SimParamBee$new(founderGenomes)

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
apiary <- createMultiColony(basePop[2:3], n = 2)
#> Error in createMultiColony(basePop[2:3], n = 2): object 'basePop' not found
apiary <- cross(x = 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

genoQ <- getQueenSegSiteGeno(apiary[[1]])
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
genoF <- getFathersSegSiteGeno(apiary[[1]])
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
genoW <- getWorkersSegSiteGeno(apiary[[1]])
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
genoD <- getDronesSegSiteGeno(apiary[[1]])
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
genoV <- getVirginQueensSegSiteGeno(apiary[[1]])
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found

# Pool of drones
sexD <- getCasteSex(apiary[[1]], caste = "drones")
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
getPooledGeno(x = genoD, type = "count", sex = sexD)[, 1:10]
#> Error in getPooledGeno(x = genoD, type = "count", sex = sexD): object 'genoD' not found
(poolD <- getPooledGeno(x = genoD, type = "mean", sex = sexD))[, 1:10]
#> Error in getPooledGeno(x = genoD, type = "mean", sex = sexD): object 'genoD' not found
# ... compare to queen's genotype
genoQ[, 1:10]
#> Error in eval(expr, envir, enclos): object 'genoQ' not found
plot(
  y = poolD, x = genoQ, ylim = c(0, 2), xlim = c(0, 2),
  ylab = "Average allele dosage in drones",
  xlab = "Allele dosage in the queen"
)
#> Error in plot(y = poolD, x = genoQ, ylim = c(0, 2), xlim = c(0, 2), ylab = "Average allele dosage in drones",     xlab = "Allele dosage in the queen"): object 'genoQ' not found

# As an exercise you could repeat the above with different numbers of drones!

# Pool of workers
getPooledGeno(x = genoW, type = "count")[, 1:10]
#> Error in getPooledGeno(x = genoW, type = "count"): object 'genoW' not found
(poolW <- getPooledGeno(x = genoW, type = "mean"))[, 1:10]
#> Error in getPooledGeno(x = genoW, type = "mean"): object 'genoW' not found
# ... compare to fathers' and queen's avearage genotype
sexF <- getCasteSex(apiary[[1]], caste = "fathers")
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
sexQ <- rep(x = "F", times = nrow(genoF))
#> Error in nrow(genoF): object 'genoF' not found
sexFQ <- c(sexF, sexQ)
#> Error in eval(expr, envir, enclos): object 'sexF' not found
genoFQ <- rbind(genoF, genoQ[rep(x = 1, times = nrow(genoF)), ])
#> Error in rbind(genoF, genoQ[rep(x = 1, times = nrow(genoF)), ]): object 'genoF' not found
(poolFQ <- getPooledGeno(x = genoFQ, type = "mean", sex = sexFQ))[, 1:10]
#> Error in getPooledGeno(x = genoFQ, type = "mean", sex = sexFQ): object 'genoFQ' not found
plot(
  y = poolW, x = poolFQ, ylim = c(0, 2), xlim = c(0, 2),
  ylab = "Average allele dosage in workers",
  xlab = "Average allele dosage in the queen and fathers"
)
#> Error in plot(y = poolW, x = poolFQ, ylim = c(0, 2), xlim = c(0, 2), ylab = "Average allele dosage in workers",     xlab = "Average allele dosage in the queen and fathers"): object 'poolFQ' not found

# As an exercise you could repeat the above with different numbers of workers!