Learn R Programming

SIMplyBee (version 0.4.1)

getSnpHaplo: Access SNP array haplotypes of individuals in a caste

Description

Level 0 function that returns SNP array haplotypes of individuals in a caste.

Usage

getSnpHaplo(
  x,
  caste = NULL,
  nInd = NULL,
  snpChip = 1,
  haplo = "all",
  chr = NULL,
  dronesHaploid = TRUE,
  collapse = FALSE,
  simParamBee = NULL
)

getQueenSnpHaplo( x, snpChip = 1, haplo = "all", chr = NULL, collapse = FALSE, simParamBee = NULL )

getFathersSnpHaplo( x, nInd = NULL, snpChip = 1, haplo = "all", chr = NULL, dronesHaploid = TRUE, collapse = FALSE, simParamBee = NULL )

getVirginQueensSnpHaplo( x, nInd = NULL, snpChip = 1, haplo = "all", chr = NULL, collapse = FALSE, simParamBee = NULL )

getWorkersSnpHaplo( x, nInd = NULL, snpChip = 1, haplo = "all", chr = NULL, collapse = FALSE, simParamBee = NULL )

getDronesSnpHaplo( x, nInd = NULL, snpChip = 1, haplo = "all", chr = NULL, dronesHaploid = TRUE, collapse = FALSE, simParamBee = NULL )

Value

matrix with haplotypes when x is Colony-class

and list of matrices with haplotypes when x is

MultiColony-class, named by colony id when x is

MultiColony-class

Arguments

x

Pop-class, Colony-class, or MultiColony-class

caste

NULL or character, NULL when x is a Pop-class, and character when x is a Colony-class or MultiColony-class with the possible values of "queen", "fathers", "workers", "drones", "virginQueens", or "all"

nInd

numeric, number of individuals to access, if NULL all individuals are accessed, otherwise a random sample

snpChip

numeric, indicates which SNP array haplotypes to retrieve

haplo

character, either "all" for all haplotypes or an integer for a single set of haplotypes, use a value of 1 for female haplotypes and a value of 2 for male haplotypes

chr

numeric, chromosomes to retrieve, if NULL, all chromosome are retrieved

dronesHaploid

logical, return haploid result for drones?

collapse

logical, if the return value should be a single matrix with haplotypes of all the individuals

simParamBee

SimParamBee, global simulation parameters

Functions

  • getQueenSnpHaplo(): Access SNP array haplotype data of the queen

  • getFathersSnpHaplo(): Access SNP array haplotype data of fathers

  • getVirginQueensSnpHaplo(): Access SNP array haplotype data of virgin queens

  • getWorkersSnpHaplo(): Access SNP array haplotype of workers

  • getDronesSnpHaplo(): Access SNP array haplotype data of drones

See Also

getSnpHaplo and pullSnpHaplo

Examples

Run this code
founderGenomes <- quickHaplo(nInd = 4, nChr = 1, segSites = 50)
SP <- SimParamBee$new(founderGenomes)
SP$nThreads = 1L
SP$addSnpChip(nSnpPerChr = 5)
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 = 6, nDrones = 3)
colony <- addVirginQueens(x = colony, nInd = 5)

apiary <- createMultiColony(basePop[3:4], n = 2)
apiary <- cross(apiary, drones = droneGroups[c(2, 3)])
apiary <- buildUp(x = apiary, nWorkers = 6, nDrones = 3)
apiary <- addVirginQueens(x = apiary, nInd = 5)

# Input is a population
getSnpHaplo(x = getQueen(colony))
queens <- getQueen(apiary, collapse = TRUE)
getSnpHaplo(queens)

# Input is a colony
getSnpHaplo(colony, caste = "queen")
getQueenSnpHaplo(colony)

getSnpHaplo(colony, caste = "workers", nInd = 3)
getWorkersSnpHaplo(colony)
# Same aliases exist for all the castes!

# Get haplotypes for all individuals
getSnpHaplo(colony, caste = "all")
# Get all haplotypes in a single matrix
getSnpHaplo(colony, caste = "all", collapse = TRUE)

# Input is a MultiColony - same behaviour as for the Colony!
getSnpHaplo(apiary, caste = "queen")
getQueenSnpHaplo(apiary)

# Get the haplotypes of all individuals either by colony or in a single matrix
getSnpHaplo(apiary, caste = "all")
getSnpHaplo(apiary, caste = "all", collapse = TRUE)

Run the code above in your browser using DataLab