addScheme: #' Build a GbsrScheme object

addSchemeR Documentation

#' Build a GbsrScheme object

Description

GBScleanR uses breeding scheme information to set the expected number of cross overs in a chromosome which is a required parameter for the genotype error correction with the Hidden Markov model implemented in the estGeno() function. This function build the object storing type crosses performed at each generation of breeding and population sizes.

Usage

addScheme(object, crosstype, mating, ...)

## S4 method for signature 'GbsrGenotypeData'
addScheme(object, crosstype, mating)

## S4 method for signature 'GbsrScheme'
addScheme(object, crosstype, mating)

Arguments

object

A GbsrGenotypeData object.

crosstype

A string to indicate the type of cross conducted with a given generation.

mating

An integer matrix to indicate mating combinations. The each element should match with member IDs of the last generation.

...

Unused.

Details

A scheme object is just a data.frame indicating a population size and a type of cross applied to each generation of the breeding process to generate the population which you are going to subject to the estGeno() function. The crosstype can take either of "selfing", "sibling", "pairing", and "random". When you set crosstype = "random", you need to specify pop_size to indicate how many individuals were crossed in the random mating. You also need to specify a matrix indicating combinations of mating, in which each column shows a pair of member IDs indicating parental samples of the cross. Member IDs are serial numbers starts from 1 and automatically assigned by initScheme() and addScheme(). To check the member IDs, run showScheme(). Please see the examples section for more details of specifying a mating matrix. The created GbsrScheme object is set in the scheme slot of the GbsrGenotypeData object.

Value

A GbsrGenotypeData object storing a GbsrScheme object in the "scheme" slot.

See Also

addScheme() and showScheme()

Examples

# Load data in the GDS file and instantiate a [GbsrGenotypeData] object.
gds_fn <- system.file("extdata", "sample.gds", package = "GBScleanR")
gds <- loadGDS(gds_fn)

# Biparental F2 population.
gds <- setParents(gds, parents = c("Founder1", "Founder2"))

# setParents gave member ID 1 and 2 to Founder1 and Founder2, respectively.
gds <- initScheme(gds, mating = cbind(c(1:2)))

# Now the progenies of the cross above have member ID 3.
# If `crosstype = "selfing"` or `"sibling"`, you can omit a `mating` matrix.
gds <- addScheme(gds, crosstype = "self")

############################################################################
# Now you can execute `estGeno()` which requires a [GbsrScheme] object.

# Close the connection to the GDS file
closeGDS(gds)

tomoyukif/GBScleanR documentation built on Oct. 31, 2024, 2:43 a.m.