Description Usage Arguments Format Details Author(s) Examples
These functions provide basic access to the slots of any object of the formal classes defined in EcoGenetics. In addition, for ecogen objects a replace method is defined for the accessor, which enables basic processing of individual slots.
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 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 | ecoslot.XY(X)
ecoslot.XY(object, ...) <- value
ecoslot.P(X)
ecoslot.P(object, ...) <- value
ecoslot.G(X)
ecoslot.G(object, ...) <- value
ecoslot.A(X)
ecoslot.A(object) <- value
ecoslot.AF(X)
ecoslot.AF(object, ...) <- value
ecoslot.E(X)
ecoslot.E(object, ...) <- value
ecoslot.S(X)
ecoslot.S(object, ...) <- value
ecoslot.C(X)
ecoslot.C(object, ...) <- value
ecoslot.OUT(X, ...)
ecoslot.OUT(object) <- value
int.ecoslot.INT(X)
int.ecoslot.INT(object) <- value
## S4 method for signature 'ecogen'
ecoslot.XY(X)
## S4 replacement method for signature 'ecogen'
ecoslot.XY(object, use.object.names = FALSE, order.rows = FALSE) <- value
## S4 method for signature 'ecogen'
ecoslot.P(X)
## S4 replacement method for signature 'ecogen'
ecoslot.P(object, use.object.names = FALSE, order.rows = FALSE) <- value
## S4 method for signature 'ecogen'
ecoslot.G(X)
## S4 replacement method for signature 'ecogen'
ecoslot.G(
object,
G.processed = TRUE,
order.G = FALSE,
type = c("codominant", "dominant"),
ploidy = 2,
sep,
ncod = NULL,
missing = c("0", "NA", "MEAN"),
NA.char = "NA",
poly.level = 5,
rm.empty.ind = FALSE,
use.object.names = FALSE,
order.rows = FALSE
) <- value
## S4 method for signature 'ecogen'
ecoslot.A(X)
## S4 replacement method for signature 'ecogen'
ecoslot.A(object) <- value
## S4 method for signature 'ecogen'
ecoslot.E(X)
## S4 replacement method for signature 'ecogen'
ecoslot.E(object, use.object.names = FALSE, order.rows = FALSE) <- value
## S4 method for signature 'ecogen'
ecoslot.S(X)
## S4 replacement method for signature 'ecogen'
ecoslot.S(object, use.object.names = FALSE, order.rows = FALSE) <- value
## S4 method for signature 'ecogen'
ecoslot.C(X)
## S4 replacement method for signature 'ecogen'
ecoslot.C(object, use.object.names = FALSE, order.rows = FALSE) <- value
## S4 method for signature 'ecogen'
ecoslot.OUT(X, ...)
## S4 replacement method for signature 'ecogen'
ecoslot.OUT(object) <- value
## S4 method for signature 'ecogen'
int.ecoslot.INT(X)
## S4 method for signature 'ecopop'
ecoslot.XY(X)
## S4 replacement method for signature 'ecopop'
ecoslot.XY(object, order.rows = FALSE) <- value
## S4 method for signature 'ecopop'
ecoslot.P(X)
## S4 replacement method for signature 'ecopop'
ecoslot.P(object, order.rows = FALSE) <- value
## S4 method for signature 'ecopop'
ecoslot.AF(X)
## S4 replacement method for signature 'ecopop'
ecoslot.AF(object, order.rows = FALSE) <- value
## S4 method for signature 'ecopop'
ecoslot.E(X)
## S4 replacement method for signature 'ecopop'
ecoslot.E(object, order.rows = FALSE) <- value
## S4 method for signature 'ecopop'
ecoslot.S(X)
## S4 replacement method for signature 'ecopop'
ecoslot.S(object, order.rows = FALSE) <- value
## S4 method for signature 'ecopop'
ecoslot.C(X)
## S4 replacement method for signature 'ecopop'
ecoslot.C(object, order.rows = FALSE) <- value
ecoslot.ALTER(X)
ecoslot.ANALYSIS(X)
ecoslot.ANOVA.MLM(X)
ecoslot.AVERAGE(X)
ecoslot.BREAKS(X)
ecoslot.CARDINAL(X)
ecoslot.COND(X)
ecoslot.CONNECTED(X)
ecoslot.DF1(X)
ecoslot.DF2(X)
ecoslot.DISTMETHOD(X)
ecoslot.EXP(X)
ecoslot.FREQUENCIES(X)
ecoslot.GF(X)
ecoslot.IN(X)
ecoslot.LOGMEAN(X)
ecoslot.LWR(X)
ecoslot.MEAN(X)
ecoslot.METHOD(X)
ecoslot.MLM(X)
ecoslot.MODEL(X)
ecoslot.MULTI(X)
ecoslot.NAMES(X)
ecoslot.NONZERO(X)
ecoslot.NONZEROIND(X)
ecoslot.NSIM(X)
ecoslot.OBS(X)
ecoslot.OBS.RES(X)
ecoslot.PADJUST(X)
ecoslot.PAR(X)
ecoslot.PAR.VAL(X)
ecoslot.POLY.DEG(X)
ecoslot.POP(X)
ecoslot.PREDICTIONS(X)
ecoslot.PVAL(X)
ecoslot.RES(X)
ecoslot.ROW.SD(X)
ecoslot.SELF(X)
ecoslot.SP(X)
ecoslot.SUMMARY.MLM(X)
ecoslot.TEST(X)
ecoslot.TREES(X)
ecoslot.UPPR(X)
ecoslot.W(X)
|
X |
Any S4 object of the formal classes defined in EcoGenetics. |
object |
Object of class ecogen. |
... |
Arguments for G or OUT slots of ecogen objects (see Details). |
value |
Single object or a list of objects to assign. Multiple objects v1, v2, ...vn must be passed as a list : list(v1, v2, ...vn). |
use.object.names |
Logical. Use the names stored in the object for the assigned data frame? This argument can be combined with order.rows if the order of the individuals do not match to the order of the other elements in the object. If the names stored in the object are empty, in all the cases they will be set to the names of the assigned data frame. |
order.rows |
Order rows of the object after assignnment to align individuals? This argument can be used when use.object.names is TRUE. Otherwise, it will not have effect in the function. |
G.processed |
If TRUE, the slot G will include a processed data frame ( removed non informative loci (the data non available for all the individuals), removed non polymorphic loci (for dominant data) and ordered alleles in ascending order. |
order.G |
Genotypes must be ordered in G slot? Default FALSE. |
type |
Marker type: "codominant" or "dominant". |
ploidy |
Ploidy of the G data frame. Default ploidy = 2. |
sep |
Character separating alleles. Default option is no character separating alleles. |
ncod |
Number of characters coding each allele. |
missing |
Missing data treatment ("0", "NA", or "MEAN") for the A slot. Missing elements are set to 0 in the default option. missing elements are recoded as "NA" or the mean allelic frequency across individuals in "NA" and "MEAN" options, respectively. |
NA.char |
Character simbolizing missing data in the input. Default is "NA". |
poly.level |
Polymorphism threshold in percentage (0 - 100), for remotion of non polymorphic loci (for dominant data). Default is 5 (5%). |
rm.empty.ind |
Remotion of noninformative individuals (rows of "NAs"). Default if FALSE. |
<ecoslot.> + <name of the slot> + <(name of the object)>
The accessor notation in EcoGenetics consists of the prefix "ecoslot." followed by the name of the slot of interest. E.g., to access the slot "IN" of the object "X", type ecoslot.IN(X).
For example, the class eco.correlog of the function eco.correlog
has the slots OUT, IN, BREAKS CARDINAL, etc.
An object X of class eco.correlog, generated with this function,
has access to these slots using:
ecoslot.OUT(X), ecoslot.IN(X), ecoslot.BREAKS(X) and ecoslot.CARDINAL(X),
respectively.
———————————————————————–
FOR ECOGEN CLASS ONLY:
- The accessors in objects of class ecogen
have a double usage. First, the extraction of data included in a slot (get mode).
Second, the assignment of data (set mode). The data assigned
to ecogen objects using this method is properly pre-processed.
- The get mode is defined for ecoslot.XY, ecoslot.P, ecoslot.G, ecoslot.A, ecoslot.E, ecoslot.S and ecoslot.OUT. For any ecogen object X, type ecoslot.SLOT(X), where SLOT is the slot of interest: ecoslot.XY(X), ecoslot.P(X), ecoslot.G(X), ecoslot.A(X), ecoslot.E(X), ecoslot.S(X) and ecoslot.OUT(X, ...). In the latter, the three dots (...) are objects in the slot OUT.
- The set mode is a replacement method, i.e., the assignation ecoslot.SLOT(X) <- VALUE is defined for the ecogen class.
For a generic ecogen object "eco", the defined replacement methods are:
1. ecoslot.P(eco) <- P data frame
2. ecoslot.G(eco, ...) <- G data frame
#' In this case the three dots (...) consist of the following variables that can be passed to the function:
- G.processed
- order.G
- type
- ploidy
- sep
- ncod
- missing
- NA.char
- poly.level
- rm.empty.ind
See the arguments of ecogen
for details about these values, and the
Examples section for details about usage.
IMPORTANT: The assignation of data in the slot G, creates automatically the slot A. An accessor is defined for the slot A only in get mode (to get the data frame in this slot, but not for replacement purposes). The slot A cannot be replaced with accessors and is generated when a genetic data frame is assigned to the slot G.
3. ecoslot.E(eco) <- E data frame
4. ecoslot.S(eco) <- S data frame
5. ecoslot.C(eco) <- C data frame
6. ecoslot.OUT(eco, value) <- results to store in the slot OUT. Here, value means any object(s). Several objects can be passed as a list. See the section Examples.
Leandro Roser learoser@gmail.com
Leandro Roser learoser@gmail.com
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 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 | ## Not run:
#--------------
# GENERAL USE
#--------------
# Example 1
data(eco.test)
## Test with phenotypic traits (example of ?eco.correlog)
moran <- eco.correlog(Z=eco[["P"]][,1], XY = eco[["XY"]], method = "I", smax=10, size=1000)
# the slots are accesed with the generic format:
# ecoslot. + name of the slot + (name of the object)
ecoslot.OUT(moran) # slot OUT
ecoslot.BREAKS(moran) # slot BREAKS
#----------------------------------------------
# SPECIFIC USE OF ACCESSORS WITH ECOGEN OBJECTS
#----------------------------------------------
#1) GET MODE
# Example 2
# Example with G data of class "data.frame", corresponding to
# microsatellites of a diploid organism.
eco <- ecogen(XY = coordinates, P = phenotype, G = genotype,
E = environment, S = structure, order.G = TRUE)
eco
# Access to the slots
ecoslot.XY(eco)
ecoslot.P(eco)
ecoslot.G(eco)
ecoslot.A(eco)
ecoslot.E(eco)
ecoslot.S(eco)
ecoslot.C(eco)
ecoslot.OUT(eco)
# For ecogen objects, the double square brackets ("[[")
# are symbolic abbreviations of the accessors:
ecoslot.XY(eco)
# is identical to:
eco[["XY"]]
#2) SET MODE (REPLACEMENT OF SLOTS)
# Example 3
eco <- ecogen(XY = coordinates, P = phenotype)
eco
ecoslot.G(eco, order.G = TRUE) <- genotype
# this is identical to
eco[["G", order.G=TRUE]] <- genotype
ecoslot.E(eco) <- environment
ecoslot.S(eco) <- structure
# Storing the data of Example 1 in the slot OUT
ecoslot.OUT(eco) <- moran
# Storing several data
singers <- c("carlos_gardel", "billie_holiday")
golden.number <- (sqrt(5) + 1) / 2
ecoslot.OUT(eco) <- list(singers, golden.number) # several objects must be passed as a list
# In get mode, ecoslot.OUT has a double behavior:
# when only the name of the ecogen object is passed to
# the accessor, it has an overview method,
# returning a data frame with the objects
# stored and their classes
ecoslot.OUT(eco)
# ecoslot.OUT in get mode, has two arguments:
# ecoslot.OUT(object, ...)
# here, the three dots (...) means any object(s) stored in the slot OUT.
ecoslot.OUT(eco, "moran", "singers")
# In double square brackets notation, this is equivalent to
eco[["OUT"]][c("moran", "singers")]
# This is, it works as a list and have no overview method
eco[["OUT"]]
eco[["OUT"]]["moran"]
# ecoslot.OUT in set mode, has two arguments:
# ecoslot.OUT(object, value)
# here value means object(s) to store in the slot OUT. Several objects
# must be passed as a list.
# The names of the input data is recoded in case of
# duplicates
ecoslot.OUT(eco) <- singers
ecoslot.OUT(eco)
ecoslot.OUT(eco) <- list(singers, singers, singers)
ecoslot.OUT(eco)
# The set operation is equivalent with double square brackets
eco[["OUT"]] <- list(singers, c(1,2,3))
ecoslot.OUT(eco)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.