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 theMissing
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 theGenotypes
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 theGenotypes
slot for a given locus are already written in terms of repeat number, theUsatnts
value for that locus should be1
. In other words, all alleles for a locus can be divided by the number inUsatnts
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. SeePloidies<-
andestimatePloidy
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 inPopInfo
.
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 theGenotypes
slot corresponding to the locus names supplied, then passes the arguments to the method forgendata
.- deleteSamples
signature(object = "genambig")
: Removes rows in the array in theGenotypes
slot corresponding to the sample names supplied, then passes the arguments to the method forgendata
.- editGenotypes
signature(object = "genambig")
: Each vector in theGenotypes
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 theGenotypes
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, thegenambig
object is returned with the new values written to thePloidies
slot.- Genotype
signature(object = "genambig")
: Retrieves a single genotype vector, as specified bysample
andlocus
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")
: Whennew
is called to create a newgenambig
object, theinitialize
method sets up a two dimensional list in theGenotypes
slot indexed by sample and locus, and fills this list with the missing data symbol. Theinitialize
method forgendata
is then called.- isMissing
signature(object = "genambig")
: Given a set of samples and loci, each position in the array in theGenotypes
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 theGenotypes
slot, and then theLoci<-
method forgendata
is called.- Missing<-
signature(object = "genambig")
: For changing the missing data symbol. All elements of theGenotypes
array that match the current missing data symbol are changed to the new missing data symbol. TheMissing<-
method forgendata
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 theGenotypes
slot, and then theSamples<-
method forgendata
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 thesummary
method forgendata
.- 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 subsciptinggenambig
objects. Should be of the formmygenambig[mysamples, myloci]
. Returns agenambig
object. TheGenotypes
slot is replaced by one containing only samplesi
and locij
. Likewise, thePopInfo
andPloidies
slots are truncated to contain only samplesi
, and theUsatnts
slot is truncated to contain only locij
. Other slots are left unaltered.- merge
signature(x = "genambig", y = "genambig")
: Merges two genotypes objects together. Seemerge,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"),])