R: Class "genambig"

genambig-class {polysat} | R Documentation

## Class "genambig"

### Description

Objects of this class store microsatellite datasets in which allele copy number is ambiguous. Genotypes are stored as a two-dimensional list of vectors, each vector containing all unique alleles for a given sample at a given locus. `genambig` is a subclass of `gendata`.

### Objects from the Class

Objects can be created by calls of the form `new("genambig", samples, loci, ...)`. This automatically sets up a two-dimensional list in the `Genotypes` slot, with `dimnames=list(samples, loci)`. This array-list is initially populated with the missing data symbol. All other slots are given initial values according to the `initialize` method for `gendata`. Data can then be inserted into the slots using the replacement functions (see `Accessors`).

### Slots

`Genotypes`:

  Object of class `"array"`. The first dimension of the array represents and is named by samples, while the second dimension represents and is named by loci. Each element of the array can contain a vector. Each vector should contain each unique allele for the genotype once. If an array element contains a vector of length 1 containing only the symbol that is in the `Missing` slot, this indicates missing data for that sample and locus.

`Description`:

  Object of class `"character"`. This stores a description of the dataset for the user's convenience.

`Missing`:

  Object of class `"ANY"`. A symbol to be used to indicate missing data in the `Genotypes` slot. This is the integer `-9` by default.

`Usatnts`:

  Object of class `"integer"`. A vector, named by loci. Each element indicates the repeat type of the locus. `2` indicates dinucleotide repeats, `3` indicates trinucleotide repeats, and so on. If the alleles stored in the `Genotypes` slot for a given locus are already written in terms of repeat number, the `Usatnts` value for that locus should be `1`. In other words, all alleles for a locus can be divided by the number in `Usatnts` to give alleles expressed in terms of relative repeat number.

`Ploidies`:

  Object of class `"integer"`. A vector, named by samples. This stores the ploidy of each sample. `NA` indicates unknown ploidy. See `Ploidies<-` and `estimatePloidy` for ways to fill this slot.

`PopInfo`:

  Object of class `"integer"`. A vector, named by samples, containing the population identity of each sample.

`PopNames`:

  Object of class `"character"`. A vector containing names for all populations. The position of a population name in the vector indicates the integer used to represent that population in `PopInfo`.

### Extends

Class `"gendata"`, directly.

### Methods

For more information on any of these methods, see the help files of their respective generic functions.

deleteLoci

  `signature(object = "genambig")`: Removes columns in the array in the `Genotypes` slot corresponding to the locus names supplied, then passes the arguments to the method for `gendata`.

deleteSamples

  `signature(object = "genambig")`: Removes rows in the array in the `Genotypes` slot corresponding to the sample names supplied, then passes the arguments to the method for `gendata`.

editGenotypes

  `signature(object = "genambig")`: Each vector in the `Genotypes` slot is placed into the row of a data frame, along with the sample and locus name for this vector. The data frame is then opened in the Data Editor so that the user can make changes. When the Data Editor window is closed, vectors are extracted back out of the data frame and written to the `Genotypes` slot.

estimatePloidy

  `signature(object = "genambig")`: Calculates the length of each genotype vector (excluding those with the missing data symbol), and creates a data frame showing the maximum and mean number of alleles per locus for each sample. This data frame is then opened in the Data Editor, where the user may edit ploidy levels. Once the Data Editor is closed, the `genambig` object is returned with the new values written to the `Ploidies` slot.

Genotype

  `signature(object = "genambig")`: Retrieves a single genotype vector, as specified by `sample` and `locus` arguments.

Genotype<-

  `signature(object = "genambig")`: Replaces a single genotype vector.

Genotypes

  `signature(object = "genambig")`: Retrieves a two-dimensional list of genotype vectors.

Genotypes<-

  `signature(object = "genambig")`: Replaces a one- or two-dimensional list of genotype vectors.

initialize

  `signature(.Object = "genambig")`: When `new` is called to create a new `genambig` object, the `initialize` method sets up a two dimensional list in the `Genotypes` slot indexed by sample and locus, and fills this list with the missing data symbol. The `initialize` method for `gendata` is then called.

isMissing

  `signature(object = "genambig")`: Given a set of samples and loci, each position in the array in the `Genotypes` slot is checked to see if it matches the missing data value. A single Boolean value or an array of Boolean values is returned.

Loci<-

  `signature(object = "genambig")`: For changing the names of loci. The names are changed in the second dimension of the array in the `Genotypes` slot, and then the `Loci<-` method for `gendata` is called.

Missing<-

  `signature(object = "genambig")`: For changing the missing data symbol. All elements of the `Genotypes` array that match the current missing data symbol are changed to the new missing data symbol. The `Missing<-` method for `gendata` is then called.

Samples<-

  `signature(object = "genambig")`: For changing the names of samples. The names are changed in the first dimension of the array in the `Genotypes` slot, and then the `Samples<-` method for `gendata` is called.

summary

  `signature(object = "genambig")`: Prints the dataset description (`Description` slot) to the console as well as the number of missing genotypes, then calls the `summary` method for `gendata`.

show

  `signature(object = "genambig")`: Prints the data to the console, formatted to make it more legible. The genotype for each locus is shown as the size of each allele, separated by a '/'. The SSR motif length ('Usatnts'), ploidies, population names, and population membership ('PopInfo') are displayed if they exist.

viewGenotypes

  `signature(object = "genambig")`: Prints a tab-delimited table of samples, loci, and genotype vectors to the console.

"["

  `signature(x = "genambig", i = "ANY", j = "ANY")`: For subscipting `genambig` objects. Should be of the form `mygenambig[mysamples, myloci]`. Returns a `genambig` object. The `Genotypes` slot is replaced by one containing only samples `i` and loci `j`. Likewise, the `PopInfo` and `Ploidies` slots are truncated to contain only samples `i`, and the `Usatnts` slot is truncated to contain only loci `j`. Other slots are left unaltered.

merge

  `signature(x = "genambig", y = "genambig")`: Merges two genotypes objects together. See `merge,genambig,genambig-method`.

### Author(s)

Lindsay V. Clark, Tyler W. Smith

### See Also

`gendata`, `Accessors`, `merge,genambig,genambig-method`

### Examples

    # display class definition
    showClass("genambig")

    # create a genambig object
    mygen <- new("genambig", samples=c("a", "b", "c", "d"),
                 loci=c("L1", "L2", "L3"))
    # add some genotypes
    Genotypes(mygen)[,"L1"] <- list(c(133, 139, 145), c(142, 154),
                                    c(130, 142, 148), Missing(mygen))
    Genotypes(mygen, loci="L2") <- list(c(105, 109, 113), c(111, 117),
                                        c(103, 115), c(105, 109, 113))
    Genotypes(mygen, loci="L3") <- list(c(254, 258), Missing(mygen),
                                        c(246, 250, 262), c(250, 258))

    # see a summary of the object
    summary(mygen)
    # display some of the genotypes
    viewGenotypes(mygen[c("a", "b", "c"),])

[Package polysat version 1.7-6 Index]