|
4 | 4 | #!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!# |
5 | 5 | #!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!# |
6 | 6 | # |
7 | | -# This software was authored by Zhian N. Kamvar and Javier F. Tabima, graduate |
| 7 | +# This software was authored by Zhian N. Kamvar and Javier F. Tabima, graduate |
8 | 8 | # students at Oregon State University; Jonah C. Brooks, undergraduate student at |
9 | 9 | # Oregon State University; and Dr. Nik Grünwald, an employee of USDA-ARS. |
10 | 10 | # |
11 | 11 | # Permission to use, copy, modify, and distribute this software and its |
12 | | -# documentation for educational, research and non-profit purposes, without fee, |
| 12 | +# documentation for educational, research and non-profit purposes, without fee, |
13 | 13 | # and without a written agreement is hereby granted, provided that the statement |
14 | 14 | # above is incorporated into the material, giving appropriate attribution to the |
15 | 15 | # authors. |
16 | 16 | # |
17 | 17 | # Permission to incorporate this software into commercial products may be |
18 | | -# obtained by contacting USDA ARS and OREGON STATE UNIVERSITY Office for |
| 18 | +# obtained by contacting USDA ARS and OREGON STATE UNIVERSITY Office for |
19 | 19 | # Commercialization and Corporate Development. |
20 | 20 | # |
21 | 21 | # The software program and documentation are supplied "as is", without any |
22 | | -# accompanying services from the USDA or the University. USDA ARS or the |
23 | | -# University do not warrant that the operation of the program will be |
24 | | -# uninterrupted or error-free. The end-user understands that the program was |
25 | | -# developed for research purposes and is advised not to rely exclusively on the |
| 22 | +# accompanying services from the USDA or the University. USDA ARS or the |
| 23 | +# University do not warrant that the operation of the program will be |
| 24 | +# uninterrupted or error-free. The end-user understands that the program was |
| 25 | +# developed for research purposes and is advised not to rely exclusively on the |
26 | 26 | # program for any reason. |
27 | 27 | # |
28 | | -# IN NO EVENT SHALL USDA ARS OR OREGON STATE UNIVERSITY BE LIABLE TO ANY PARTY |
| 28 | +# IN NO EVENT SHALL USDA ARS OR OREGON STATE UNIVERSITY BE LIABLE TO ANY PARTY |
29 | 29 | # FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING |
30 | | -# LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, |
31 | | -# EVEN IF THE OREGON STATE UNIVERSITY HAS BEEN ADVISED OF THE POSSIBILITY OF |
32 | | -# SUCH DAMAGE. USDA ARS OR OREGON STATE UNIVERSITY SPECIFICALLY DISCLAIMS ANY |
33 | | -# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
34 | | -# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE AND ANY STATUTORY |
| 30 | +# LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, |
| 31 | +# EVEN IF THE OREGON STATE UNIVERSITY HAS BEEN ADVISED OF THE POSSIBILITY OF |
| 32 | +# SUCH DAMAGE. USDA ARS OR OREGON STATE UNIVERSITY SPECIFICALLY DISCLAIMS ANY |
| 33 | +# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
| 34 | +# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE AND ANY STATUTORY |
35 | 35 | # WARRANTY OF NON-INFRINGEMENT. THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS" |
36 | 36 | # BASIS, AND USDA ARS AND OREGON STATE UNIVERSITY HAVE NO OBLIGATIONS TO PROVIDE |
37 | | -# MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. |
| 37 | +# MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. |
38 | 38 | # |
39 | 39 | #!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!# |
40 | 40 | #!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!# |
|
44 | 44 | setClassUnion("charORLang", c("character", "language")) |
45 | 45 | #==============================================================================# |
46 | 46 | #' MLG class |
47 | | -#' |
| 47 | +#' |
48 | 48 | #' A class to store multilocus genotypes in genclone objects. This is intended |
49 | 49 | #' for internal use only. |
50 | | -#' |
| 50 | +#' |
51 | 51 | #' @name MLG-class |
52 | 52 | #' @rdname MLG-class |
53 | 53 | #' @aliases MLG |
54 | 54 | #' @export |
55 | | -#' @slot mlg a list containing four vectors, one for each type of MLG |
| 55 | +#' @slot mlg a list containing four vectors, one for each type of MLG |
56 | 56 | #' manipulation. |
57 | | -#' @slot visible a character specifying which MLG type is to be displayed and |
| 57 | +#' @slot visible a character specifying which MLG type is to be displayed and |
58 | 58 | #' accessed. |
59 | | -#' @slot distname the name of the distance function or matrix used to collapse |
| 59 | +#' @slot distname the name of the distance function or matrix used to collapse |
60 | 60 | #' mlgs. |
61 | 61 | #' @slot distenv the environment that contains the distance function or matrix |
62 | 62 | #' @slot distargs the arguments provided to compute the distance function. |
63 | 63 | #' @slot distalgo the algorithm used to contract multilocus genotypes. |
64 | | -#' @slot cutoff Two numbers specifying the cutoff value for expanding and |
| 64 | +#' @slot cutoff Two numbers specifying the cutoff value for expanding and |
65 | 65 | #' collapsing MLGs. |
66 | 66 | #' @author Zhian N. Kamvar |
67 | 67 | #' @seealso \code{\linkS4class{genclone}} \code{\linkS4class{snpclone}} |
68 | 68 | #' \code{\link{mll}} For developers: \code{\link{visible}} |
69 | 69 | #' @keywords internal |
70 | 70 | #' @examples |
71 | | -#' |
| 71 | +#' |
72 | 72 | #' # These examples will simply show you what you can do with these |
73 | 73 | #' set.seed(5000) |
74 | 74 | #' (x <- sample(10, 20, replace = TRUE)) |
75 | 75 | #' (m <- new("MLG", x)) |
76 | | -#' |
| 76 | +#' |
77 | 77 | #' visible(m) # original is always default |
78 | | -#' |
79 | | -#' m[] # adding braces after the object will always return a vector of |
| 78 | +#' |
| 79 | +#' m[] # adding braces after the object will always return a vector of |
80 | 80 | #' # the same type as defined in "visible" |
81 | | -#' |
| 81 | +#' |
82 | 82 | #' m + 1 # You can do math on the numeric ones |
83 | | -#' |
| 83 | +#' |
84 | 84 | #' visible(m) <- "custom" |
85 | 85 | #' m + 2 # This should throw a warning |
86 | 86 | #' # The types are stored in a data frame. You can retrieve them easily: |
87 | 87 | #' visible(m) <- "original" |
88 | 88 | #' m |
89 | 89 | #' m[, "custom"] |
90 | | -#' |
91 | | -#' # Important for subsetting, if you subset the object, normally, it will |
| 90 | +#' |
| 91 | +#' # Important for subsetting, if you subset the object, normally, it will |
92 | 92 | #' # return a vector unless you specify all = TRUE |
93 | 93 | #' m[1:10] # original vector |
94 | 94 | #' m[1:10, all = TRUE] # still class MLG |
95 | | -#' |
| 95 | +#' |
96 | 96 | #==============================================================================# |
97 | | -setClass("MLG", |
98 | | - representation(visible = "character", |
99 | | - cutoff = "numeric", |
100 | | - distname = "charORLang", |
101 | | - distenv = "environment", |
102 | | - distargs = "list", |
103 | | - distalgo = "character", |
104 | | - mlg = "data.frame"), |
105 | | - prototype(visible = character(0), |
106 | | - cutoff = numeric(0), |
107 | | - distname = character(0), |
108 | | - distenv = as.environment(.GlobalEnv), |
109 | | - distargs = list(), |
110 | | - distalgo = "farthest_neighbor", |
111 | | - mlg = data.frame(expanded = numeric(0), |
112 | | - original = numeric(0), |
113 | | - contracted = numeric(0), |
114 | | - custom = factor(character(0)) |
115 | | - ) |
116 | | - ) |
117 | | - ) |
| 97 | +setClass( |
| 98 | + "MLG", |
| 99 | + representation( |
| 100 | + visible = "character", |
| 101 | + cutoff = "numeric", |
| 102 | + distname = "charORLang", |
| 103 | + distenv = "environment", |
| 104 | + distargs = "list", |
| 105 | + distalgo = "character", |
| 106 | + mlg = "data.frame" |
| 107 | + ), |
| 108 | + prototype( |
| 109 | + visible = character(0), |
| 110 | + cutoff = numeric(0), |
| 111 | + distname = character(0), |
| 112 | + distenv = as.environment(.GlobalEnv), |
| 113 | + distargs = list(), |
| 114 | + distalgo = "farthest_neighbor", |
| 115 | + mlg = data.frame( |
| 116 | + expanded = numeric(0), |
| 117 | + original = numeric(0), |
| 118 | + contracted = numeric(0), |
| 119 | + custom = factor(character(0)) |
| 120 | + ) |
| 121 | + ) |
| 122 | +) |
0 commit comments