Browse code

changed poplinReducedData to poplinReduced.

Jaehyun Joo authored on 22/12/2021 04:18:36
Showing 14 changed files

... ...
@@ -22,7 +22,7 @@ S3method(summary,poplin.pca)
22 22
 S3method(summary,poplin.plsda)
23 23
 S3method(summary,poplin.tsne)
24 24
 export("poplinData<-")
25
-export("poplinReducedData<-")
25
+export("poplinReduced<-")
26 26
 export("poplin_data<-")
27 27
 export("poplin_data_list<-")
28 28
 export("poplin_data_names<-")
... ...
@@ -33,17 +33,17 @@ export(.get_poplinData_data_character)
33 33
 export(.get_poplinData_data_integer)
34 34
 export(.get_poplinData_data_missing)
35 35
 export(.get_poplinData_names)
36
-export(.get_poplinReducedData_data_character)
37
-export(.get_poplinReducedData_data_integer)
38
-export(.get_poplinReducedData_data_missing)
36
+export(.get_poplinReduced_data_character)
37
+export(.get_poplinReduced_data_integer)
38
+export(.get_poplinReduced_data_missing)
39 39
 export(.set_poplinData_data_character)
40 40
 export(.set_poplinData_data_integer)
41 41
 export(.set_poplinData_data_missing)
42 42
 export(.set_poplinData_datalist)
43
-export(.set_poplinReducedData_data_character)
44
-export(.set_poplinReducedData_data_integer)
45
-export(.set_poplinReducedData_data_missing)
46
-export(.set_poplinReducedData_datalist)
43
+export(.set_poplinReduced_data_character)
44
+export(.set_poplinReduced_data_integer)
45
+export(.set_poplinReduced_data_missing)
46
+export(.set_poplinReduced_datalist)
47 47
 export(.verify_and_extract_input)
48 48
 export(impute_knn)
49 49
 export(impute_pca)
... ...
@@ -59,7 +59,7 @@ export(normalize_sum)
59 59
 export(normalize_vsn)
60 60
 export(poplin)
61 61
 export(poplinData)
62
-export(poplinReducedData)
62
+export(poplinReduced)
63 63
 export(poplin_biplot)
64 64
 export(poplin_boxplot)
65 65
 export(poplin_corplot)
... ...
@@ -85,7 +85,7 @@ exportClasses(poplin.matrix)
85 85
 exportMethods("[")
86 86
 exportMethods("[<-")
87 87
 exportMethods("poplinData<-")
88
-exportMethods("poplinReducedData<-")
88
+exportMethods("poplinReduced<-")
89 89
 exportMethods("poplin_data<-")
90 90
 exportMethods("poplin_data_list<-")
91 91
 exportMethods("poplin_data_names<-")
... ...
@@ -94,7 +94,7 @@ exportMethods("poplin_reduced_list<-")
94 94
 exportMethods("poplin_reduced_names<-")
95 95
 exportMethods(coerce)
96 96
 exportMethods(poplinData)
97
-exportMethods(poplinReducedData)
97
+exportMethods(poplinReduced)
98 98
 exportMethods(poplin_data)
99 99
 exportMethods(poplin_data_list)
100 100
 exportMethods(poplin_data_names)
... ...
@@ -5,7 +5,7 @@ setClass(
5 5
   "poplin",
6 6
   slots = c(
7 7
     poplinData = "DataFrame",
8
-    poplinReducedData = "DataFrame"
8
+    poplinReduced = "DataFrame"
9 9
   ),
10 10
   contains = "SummarizedExperiment"
11 11
 )
... ...
@@ -2,7 +2,7 @@
2 2
 ## is more expensive, and generally best avoided.
3 3
 
4 4
 #################################################################################
5
-## poplinData and poplinReducedData
5
+## poplinData and poplinReduced
6 6
 #################################################################################
7 7
 
8 8
 ##' @export
... ...
@@ -19,14 +19,14 @@ setGeneric(
19 19
 
20 20
 ##' @export
21 21
 setGeneric(
22
-  "poplinReducedData",
23
-  function(x) standardGeneric("poplinReducedData")
22
+  "poplinReduced",
23
+  function(x) standardGeneric("poplinReduced")
24 24
 )
25 25
 
26 26
 ##' @export
27 27
 setGeneric(
28
-  "poplinReducedData<-",
29
-  function(x, value) standardGeneric("poplinReducedData<-")
28
+  "poplinReduced<-",
29
+  function(x, value) standardGeneric("poplinReduced<-")
30 30
 )
31 31
 
32 32
 
... ...
@@ -1,6 +1,6 @@
1 1
 ##' @importFrom SummarizedExperiment SummarizedExperiment
2 2
 .poplin_to_se_coldata <- function(x) {
3
-  SummarizedExperiment(colData = poplinReducedData(x))
3
+  SummarizedExperiment(colData = poplinReduced(x))
4 4
 }
5 5
 
6 6
 ##' @importFrom SummarizedExperiment Assays
... ...
@@ -56,7 +56,7 @@
56 56
 NULL
57 57
 
58 58
 ## Need to think about how to handle metadata of poplinData(x) and
59
-## poplinReducedData(x) when data are combined
59
+## poplinReduced(x) when data are combined
60 60
 ## poplin class cbind and rbind
61 61
 setMethod("rbind", "poplin", function(..., deparse.level = 1) {
62 62
   old_validity <- S4Vectors:::disableValidity()
... ...
@@ -87,20 +87,20 @@ setMethod("rbind", "poplin", function(..., deparse.level = 1) {
87 87
     metadata(poplinData_all) <- list() # clean metadata; consistency with assay-via method
88 88
   })
89 89
   ## Utilize SE class for combining objects: see the SingleCellExperiment source
90
-  poplinReducedData_se <- lapply(args, function(x) .poplin_to_se_coldata(x))
90
+  poplinReduced_se <- lapply(args, function(x) .poplin_to_se_coldata(x))
91 91
   tryCatch({
92
-    poplinReducedData_all <- colData(do.call(rbind, poplinReducedData_se))
92
+    poplinReduced_all <- colData(do.call(rbind, poplinReduced_se))
93 93
   },
94 94
   error = function(err) {
95 95
     stop(
96
-      "failed to combine 'poplinReducedData' in 'rbind(<",
96
+      "failed to combine 'poplinReduced' in 'rbind(<",
97 97
       class(args[[1]]), ">)':\n  ", conditionMessage(err)
98 98
     )
99 99
   })
100 100
   ## Skip validity checks with check = FALSE for efficiency as modification
101 101
   ## cannot alter the validity of object
102 102
   BiocGenerics:::replaceSlots(out, poplinData = poplinData_all,
103
-                              poplinReducedData = poplinReducedData_all,
103
+                              poplinReduced = poplinReduced_all,
104 104
                               check = FALSE)
105 105
 })
106 106
 
... ...
@@ -129,18 +129,18 @@ setMethod("cbind", "poplin", function(..., deparse.level = 1) {
129 129
     )
130 130
   })
131 131
   tryCatch({
132
-    poplinReducedData_all <- do.call(rbind, lapply(args, poplinReducedData))
132
+    poplinReduced_all <- do.call(rbind, lapply(args, poplinReduced))
133 133
   },
134 134
   error = function(err) {
135 135
     stop(
136
-      "failed to combine 'poplinReducedData' in 'cbind(<",
136
+      "failed to combine 'poplinReduced' in 'cbind(<",
137 137
       class(args[[1]]), ">)':\n  ", conditionMessage(err)
138 138
     )
139 139
   })
140 140
   ## Skip validity checks with check = FALSE for efficiency as modification
141 141
   ## cannot alter the validity of object
142 142
   BiocGenerics:::replaceSlots(out, poplinData = poplinData_all,
143
-                              poplinReducedData = poplinReducedData_all,
143
+                              poplinReduced = poplinReduced_all,
144 144
                               check = FALSE)
145 145
 })
146 146
 
... ...
@@ -41,7 +41,7 @@ NULL
41 41
 ##' equal to \code{dim(x)}. End users are supposed to interact with this field
42 42
 ##' via [poplin_data]. }
43 43
 ##'
44
-##' \item{\code{poplinReducedData(x)}, \code{poplinReducedData(x) <- value}:}{
44
+##' \item{\code{poplinReduced(x)}, \code{poplinReduced(x) <- value}:}{
45 45
 ##' Returns a \linkS4class{DataFrame} of matrices containing one or more
46 46
 ##' dimension-reduced data. \code{value} must be a \linkS4class{DataFrame} with
47 47
 ##' the dimension equal to \code{ncol(x)}. End users are supposed to interact
... ...
@@ -52,8 +52,8 @@ NULL
52 52
 ##' @aliases
53 53
 ##' poplinData
54 54
 ##' poplinData<-
55
-##' poplinReducedData
56
-##' poplinReducedData<-
55
+##' poplinReduced
56
+##' poplinReduced<-
57 57
 ##' @seealso [poplin_data], [poplin_reduced]
58 58
 ##' @name poplin-internals
59 59
 NULL
... ...
@@ -87,7 +87,7 @@ poplin <- function(intensity,  ...) {
87 87
     "poplin",
88 88
     se,
89 89
     poplinData = new("DFrame", nrows = nrow(se)),
90
-    poplinReducedData = new("DFrame", nrows = ncol(se))
90
+    poplinReduced = new("DFrame", nrows = ncol(se))
91 91
   )
92 92
 }
93 93
 
94 94
similarity index 87%
95 95
rename from R/poplinReducedData-internals.R
96 96
rename to R/poplinReduced-internals.R
... ...
@@ -1,29 +1,29 @@
1
-.get_poplinReducedData_names <- function(...) {
1
+.get_poplinReduced_names <- function(...) {
2 2
   .get_poplinData_names(...)
3 3
 }
4 4
 
5
-.set_poplinReducedData_names <- function(...) {
5
+.set_poplinReduced_names <- function(...) {
6 6
   .set_poplinData_names(...)
7 7
 }
8 8
 
9 9
 ##' @export
10
-.get_poplinReducedData_data_integer <- function(...) {
10
+.get_poplinReduced_data_integer <- function(...) {
11 11
   .get_poplinData_data_integer(...)
12 12
 }
13 13
 
14 14
 ##' @export
15
-.get_poplinReducedData_data_character <- function(...) {
15
+.get_poplinReduced_data_character <- function(...) {
16 16
   .get_poplinData_data_character(...)
17 17
 }
18 18
 
19 19
 ##' @export
20
-.get_poplinReducedData_data_missing <- function(...) {
20
+.get_poplinReduced_data_missing <- function(...) {
21 21
   .get_poplinData_data_missing(...)
22 22
 }
23 23
 
24 24
 
25 25
 ##' @export
26
-.set_poplinReducedData_data_integer <- function(x, type, value, get_slot,
26
+.set_poplinReduced_data_integer <- function(x, type, value, get_slot,
27 27
                                                 set_element_fun, funstr) {
28 28
   ## x <- updateObject(x)
29 29
 
... ...
@@ -53,7 +53,7 @@
53 53
 
54 54
 
55 55
 ##' @export
56
-.set_poplinReducedData_data_character <- function(x, type, value, get_slot,
56
+.set_poplinReduced_data_character <- function(x, type, value, get_slot,
57 57
                                                   set_element_fun, funstr) {
58 58
   ## x <- updateObject(x)
59 59
 
... ...
@@ -77,7 +77,7 @@
77 77
 }
78 78
 
79 79
 ##' @export
80
-.set_poplinReducedData_data_missing <- function(...) {
80
+.set_poplinReduced_data_missing <- function(...) {
81 81
   .set_poplinData_data_missing(...)
82 82
 }
83 83
 
... ...
@@ -85,7 +85,7 @@
85 85
 ##' @export
86 86
 ##' @importFrom methods as
87 87
 ##' @importFrom S4Vectors DataFrame I mcols mcols<- metadata metadata<-
88
-.set_poplinReducedData_datalist <- function(x, value, get_slot, set_element_fun,
88
+.set_poplinReduced_datalist <- function(x, value, get_slot, set_element_fun,
89 89
                                             funstr, name_pattern) {
90 90
   ## x <- updateObject(x)
91 91
 
92 92
similarity index 82%
93 93
rename from R/poplinReducedData-methods.R
94 94
rename to R/poplinReduced-methods.R
... ...
@@ -11,7 +11,7 @@
11 11
 ##' \describe{
12 12
 ##' \item{\code{poplin_reduced_names(x)}:}{
13 13
 ##' Return the names of all dimension-reduced data sets stored in
14
-##' \code{x@poplinReducedData}.
14
+##' \code{x@poplinReduced}.
15 15
 ##' }
16 16
 ##' \item{\code{poplin_reduced_list(x)}:}{
17 17
 ##' Retrieves a named \linkS4class{List} of matrices containing one or more
... ...
@@ -57,12 +57,12 @@
57 57
 NULL
58 58
 
59 59
 ##' @export
60
-setMethod("poplinReducedData", "poplin", function(x) x@poplinReducedData)
60
+setMethod("poplinReduced", "poplin", function(x) x@poplinReduced)
61 61
 
62 62
 
63 63
 ##' @export
64
-setReplaceMethod("poplinReducedData", "poplin", function(x, value) {
65
-  x@poplinReducedData <- value
64
+setReplaceMethod("poplinReduced", "poplin", function(x, value) {
65
+  x@poplinReduced <- value
66 66
   x
67 67
 })
68 68
 
... ...
@@ -72,7 +72,7 @@ setMethod(
72 72
   "poplin_reduced_list",
73 73
   "poplin",
74 74
   function(x) {
75
-    value <- as(poplinReducedData(x), "SimpleList")
75
+    value <- as(poplinReduced(x), "SimpleList")
76 76
     for (i in seq_along(value)) {
77 77
       rownames(value[[i]]) <- colnames(x)
78 78
     }
... ...
@@ -95,10 +95,10 @@ setReplaceMethod(
95 95
       stop("'names(value)' contains duplicates. ",
96 96
            "Use different names for incoming data.")
97 97
     }
98
-    .set_poplinReducedData_datalist(
98
+    .set_poplinReduced_datalist(
99 99
       x, value,
100
-      get_slot = poplinReducedData,
101
-      set_element_fun = `poplinReducedData<-`,
100
+      get_slot = poplinReduced,
101
+      set_element_fun = `poplinReduced<-`,
102 102
       funstr = "poplin_reduced_list",
103 103
       name_pattern = "reduced")
104 104
   }
... ...
@@ -109,7 +109,7 @@ setMethod(
109 109
   "poplin_reduced_names",
110 110
   "poplin",
111 111
   function(x) {
112
-    .get_poplinReducedData_names(x, get_slot = poplinReducedData)
112
+    .get_poplinReduced_names(x, get_slot = poplinReduced)
113 113
   }
114 114
 )
115 115
 
... ...
@@ -122,10 +122,10 @@ setReplaceMethod(
122 122
       stop("'value' contains duplicates. ",
123 123
            "Use unique names.")
124 124
     }
125
-    .set_poplinReducedData_names(
125
+    .set_poplinReduced_names(
126 126
       x, value,
127
-      get_slot = poplinReducedData,
128
-      set_element_fun = `poplinReducedData<-`,
127
+      get_slot = poplinReduced,
128
+      set_element_fun = `poplinReduced<-`,
129 129
       name_pattern = "reduced"
130 130
     )
131 131
   }
... ...
@@ -136,9 +136,9 @@ setMethod(
136 136
   "poplin_reduced",
137 137
   c("poplin", "numeric"),
138 138
   function(x, type) {
139
-    .get_poplinReducedData_data_integer(
139
+    .get_poplinReduced_data_integer(
140 140
       x, type,
141
-      get_slot = poplinReducedData,
141
+      get_slot = poplinReduced,
142 142
       funstr = "poplin_reduced"
143 143
     )
144 144
   }
... ...
@@ -149,9 +149,9 @@ setMethod(
149 149
   "poplin_reduced",
150 150
   c("poplin", "character"),
151 151
   function(x, type) {
152
-    .get_poplinReducedData_data_character(
152
+    .get_poplinReduced_data_character(
153 153
       x, type,
154
-      get_slot = poplinReducedData,
154
+      get_slot = poplinReduced,
155 155
       funstr ="poplin_reduced",
156 156
       namestr = "poplin_reduced_names"
157 157
     )
... ...
@@ -163,7 +163,7 @@ setMethod(
163 163
   "poplin_reduced",
164 164
   c("poplin", "missing"),
165 165
   function(x, type) {
166
-    .get_poplinReducedData_data_missing(
166
+    .get_poplinReduced_data_missing(
167 167
       x,
168 168
       base_fun = poplin_reduced,
169 169
       name_fun = poplin_reduced_names,
... ...
@@ -180,10 +180,10 @@ setReplaceMethod(
180 180
     if (check_samplenames) {
181 181
       value <- .check_samplenames(x, value, fun = "poplin_reduced<-")
182 182
     }
183
-    .set_poplinReducedData_data_integer(
183
+    .set_poplinReduced_data_integer(
184 184
       x, type, value,
185
-      get_slot = poplinReducedData,
186
-      set_element_fun = `poplinReducedData<-`,
185
+      get_slot = poplinReduced,
186
+      set_element_fun = `poplinReduced<-`,
187 187
       funstr = "poplin_reduced"
188 188
     )
189 189
   }
... ...
@@ -201,10 +201,10 @@ setReplaceMethod(
201 201
     if (check_samplenames) {
202 202
       value <- .check_samplenames(x, value, fun = "poplin_reduced<-")
203 203
     }
204
-    .set_poplinReducedData_data_character(
204
+    .set_poplinReduced_data_character(
205 205
       x, type, value,
206
-      get_slot = poplinReducedData,
207
-      set_element_fun = `poplinReducedData<-`,
206
+      get_slot = poplinReduced,
207
+      set_element_fun = `poplinReduced<-`,
208 208
       funstr = "poplin_reduced"
209 209
     )
210 210
   }
... ...
@@ -215,7 +215,7 @@ setReplaceMethod(
215 215
   "poplin_reduced",
216 216
   c("poplin", "missing"),
217 217
   function(x, type, check_samplenames = TRUE, ..., value) {
218
-    .set_poplinReducedData_data_missing(
218
+    .set_poplinReduced_data_missing(
219 219
       x, value,
220 220
       base_fun = `poplin_reduced<-`,
221 221
       name_fun = poplin_reduced_names,
... ...
@@ -4,14 +4,14 @@ setMethod("[", c("poplin", "ANY", "ANY"), function(x, i, j, ..., drop = TRUE) {
4 4
     ii <- .get_subset_index(i, rownames(x))
5 5
     poplinData(x) <- poplinData(x)[ii, , drop = FALSE]
6 6
     ## if (length(reducedDataList(x)) != 0L) {
7
-    ##   message("Row-subsetting operation: 'poplinReducedData' slot was reset.")
7
+    ##   message("Row-subsetting operation: 'poplinReduced' slot was reset.")
8 8
     ## }
9
-    ## poplinReducedData(x) <- new("DFrame", nrows = ncol(x))
9
+    ## poplinReduced(x) <- new("DFrame", nrows = ncol(x))
10 10
   }
11 11
   if (!missing(j)) {
12 12
     jj <- .get_subset_index(j, colnames(x))
13 13
     poplinData(x) <- .subset_columns(x, jj, get_slot = poplinData)
14
-    poplinReducedData(x) <- poplinReducedData(x)[jj, , drop = FALSE]
14
+    poplinReduced(x) <- poplinReduced(x)[jj, , drop = FALSE]
15 15
   }
16 16
   callNextMethod()
17 17
 })
... ...
@@ -38,8 +38,8 @@ setReplaceMethod(
38 38
         })
39 39
         poplinData(x) <- poplinData_left
40 40
       }
41
-      ## message("Row-subsetting operation: 'poplinReducedData' slot was reset.")
42
-      ## poplinReducedData(x) <- new("DFrame", nrows = ncol(x))
41
+      ## message("Row-subsetting operation: 'poplinReduced' slot was reset.")
42
+      ## poplinReduced(x) <- new("DFrame", nrows = ncol(x))
43 43
     }
44 44
 
45 45
     if (!missing(j)) {
... ...
@@ -62,18 +62,18 @@ setReplaceMethod(
62 62
             conditionMessage(err))
63 63
         })
64 64
       }
65
-      poplinReducedData_left <- poplinReducedData(x)
66
-      poplinReducedData_right <- poplinReducedData(value)
65
+      poplinReduced_left <- poplinReduced(x)
66
+      poplinReduced_right <- poplinReduced(value)
67 67
       tryCatch({
68
-        poplinReducedData_left[jj, ] <- poplinReducedData_right
68
+        poplinReduced_left[jj, ] <- poplinReduced_right
69 69
       }, error=function(err) {
70 70
         stop(
71
-          "failed to replace 'poplinReducedData' in '<", class(x), ">[,j] <- value'\n",
71
+          "failed to replace 'poplinReduced' in '<", class(x), ">[,j] <- value'\n",
72 72
           conditionMessage(err))
73 73
       })
74 74
 
75 75
       poplinData(x) <- poplinData_left
76
-      poplinReducedData(x) <- poplinReducedData_left
76
+      poplinReduced(x) <- poplinReduced_left
77 77
     }
78 78
     callNextMethod()
79 79
 })
80 80
Binary files a/data/faahko_poplin.rda and b/data/faahko_poplin.rda differ
... ...
@@ -4,6 +4,8 @@
4 4
 \alias{poplin-internals}
5 5
 \alias{poplinData}
6 6
 \alias{poplinData<-}
7
+\alias{poplinReduced}
8
+\alias{poplinReduced<-}
7 9
 \title{Internal poplin fields}
8 10
 \description{
9 11
 Methods to get or set internal fields in a \linkS4class{poplin} object.
... ...
@@ -21,7 +23,7 @@ results. \code{value} must be a \linkS4class{DataFrame} with the dimension
21 23
 equal to \code{dim(x)}. End users are supposed to interact with this field
22 24
 via \link{poplin_data}. }
23 25
 
24
-\item{\code{poplinReducedData(x)}, \code{poplinReducedData(x) <- value}:}{
26
+\item{\code{poplinReduced(x)}, \code{poplinReduced(x) <- value}:}{
25 27
 Returns a \linkS4class{DataFrame} of matrices containing one or more
26 28
 dimension-reduced data. \code{value} must be a \linkS4class{DataFrame} with
27 29
 the dimension equal to \code{ncol(x)}. End users are supposed to interact
... ...
@@ -17,7 +17,7 @@ In the code snippets below, \code{x} is a \linkS4class{poplin} object.
17 17
 \describe{
18 18
 \item{\code{poplin_reduced_names(x)}:}{
19 19
 Return the names of all dimension-reduced data sets stored in
20
-\code{x@poplinReducedData}.
20
+\code{x@poplinReduced}.
21 21
 }
22 22
 \item{\code{poplin_reduced_list(x)}:}{
23 23
 Retrieves a named \linkS4class{List} of matrices containing one or more
24 24
similarity index 100%
25 25
rename from tests/testthat/test-poplinRawData.R
26 26
rename to tests/testthat/test-poplinRaw.R
27 27
similarity index 100%
28 28
rename from tests/testthat/test-poplinReducedData.R
29 29
rename to tests/testthat/test-poplinReduced.R