gtypes.accessors | R Documentation |
gtypes
AccessorsAccessors for slots in gtypes objects.
## S4 method for signature 'gtypes' getNumInd(x, by.strata = FALSE, ...) ## S4 method for signature 'gtypes' getNumLoci(x, ...) getNumStrata(x, ...) ## S4 method for signature 'gtypes' getNumStrata(x, ...) getIndNames(x, ...) ## S4 method for signature 'gtypes' getIndNames(x, by.strata = FALSE, ...) getLociNames(x, ...) ## S4 method for signature 'gtypes' getLociNames(x, ...) getAlleleNames(x, ...) ## S4 method for signature 'gtypes' getAlleleNames(x, ...) getStrataNames(x, ...) ## S4 method for signature 'gtypes' getStrataNames(x, ...) getPloidy(x, ...) ## S4 method for signature 'gtypes' getPloidy(x, ...) getStrata(x, ...) ## S4 method for signature 'gtypes' getStrata(x) setStrata(x) <- value ## S4 replacement method for signature 'gtypes' setStrata(x) <- value getSchemes(x, ...) ## S4 method for signature 'gtypes' getSchemes(x, ...) setSchemes(x) <- value ## S4 replacement method for signature 'gtypes' setSchemes(x) <- value getSequences(x, ...) ## S4 method for signature 'gtypes' getSequences( x, as.haplotypes = FALSE, seqName = NULL, as.multidna = FALSE, simplify = TRUE, ... ) getDescription(x, ...) ## S4 method for signature 'gtypes' getDescription(x, ...) setDescription(x) <- value ## S4 replacement method for signature 'gtypes' setDescription(x) <- value getOther(x, ...) ## S4 method for signature 'gtypes' getOther(x, value = NULL, ...) setOther(x, name) <- value ## S4 replacement method for signature 'gtypes' setOther(x, name) <- value ## S4 method for signature 'gtypes,ANY,ANY,ANY' x[i, j, k, ..., quiet = TRUE, drop = FALSE]
x |
a gtypes object. |
by.strata |
logical - return results by strata? |
... |
other arguments passed from generics (ignored). |
value |
value being assigned by accessor. |
as.haplotypes |
return sequences as haplotypes? If |
seqName |
the name (or number) of a set of sequences from the
|
as.multidna |
return sequences as a multidna object? If
|
simplify |
if 'getSequences()' would return a single locus, return it as a 'DNAbin' object ('TRUE'), or a single element named list ('FALSE'). |
name |
name of the value going into the |
i, j, k |
subsetting slots for individuals ( |
quiet |
suppress warnings about unmatched requested individuals, loci, or strata? |
drop |
if |
Indexing a gtypes
object with integers, characters, or
logicals with the [
operator follows the same rules as normal indexing
in R. The order that individuals, loci, and strata are chosen is the order
returned by getIndNames
, getLocNames
, and getStrataNames
respectively. If unstratified samples are present, they can be selected as a
group either by including NA
in the character or numeric vector of the
k
slot, or by providing a logical vector based on
is.na(strata(g))
to the i
slot.
number of individuals
number of loci
number of strata
vector of individual/sample names
vector of locus names
vector of strata names for current scheme
number of alleles at each locus
contents of
@other
slot
return or modify the current stratification
return or modify the current stratification schemes
return a list of alleles at each locus
return the multidna object in the
@sequences
slot. See getSequences
to extract
individual genes or sequences from this object
return the object's description
Eric Archer eric.archer@noaa.gov
#--- create a diploid (microsatellite) gtypes object data(msats.g) msats.g <- stratify(msats.g, "fine") getNumStrata(msats.g) getStrataNames(msats.g) getNumLoci(msats.g) getLociNames(msats.g) # reassign all samples to two randomly chosen strata new.strata <- sample(c("A", "B"), getNumInd(msats.g), rep = TRUE) names(new.strata) <- getIndNames(msats.g) setStrata(msats.g) <- new.strata msats.g #--- a sequence example library(ape) data(woodmouse) genes <- list(gene1=woodmouse[,1:500], gene2=woodmouse[,501:965]) x <- new("multidna", genes) wood.g <- sequence2gtypes(x) new.strata <- sample(c("A", "B"), getNumInd(wood.g), rep = TRUE) names(new.strata) <- getIndNames(wood.g) setStrata(wood.g) <- new.strata wood.g # get the multidna sequence object multi.seqs <- getSequences(wood.g, as.multidna = TRUE) class(multi.seqs) # "multidna" # get a list of DNAbin objects dnabin.list <- getSequences(wood.g) class(dnabin.list) # "list" # get a DNAbin object of the first locus dnabin.1 <- getSequences(wood.g)[[1]] class(dnabin.1) # "DNAbin" # getting and setting values in the `other` slot: getOther(dloop.g) setOther(dloop.g, "timestamp") <- timestamp() setOther(dloop.g, "Author") <- "Hoban Washburne" getOther(dloop.g) getOther(dloop.g, "timestamp") setOther(dloop.g, "Author") <- NULL getOther(dloop.g)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.