Description Usage Arguments Details Value Author(s) Examples
Accessors for slots in gtypes objects.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 | ## 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 = TRUE, seqName = NULL, as.multidna = FALSE, ...)
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
|
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
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | #--- 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.