Browse code

Include `de_results` argument in the generics

This argument should always be present for specific methods of `spatialPatterns()` and `modelSearch()`

Milan Malfait authored on 01/06/2021 10:59:37
Showing 4 changed files

... ...
@@ -91,12 +91,13 @@ NULL
91 91
   )
92 92
 }
93 93
 
94
-#'
95 94
 #' @import methods
96 95
 #' @export
97 96
 #' @rdname spatialPatterns
98
-setGeneric("spatialPatterns", function(x, ...)
99
-  standardGeneric("spatialPatterns"))
97
+setGeneric("spatialPatterns",
98
+    function(x, de_results, ...) standardGeneric("spatialPatterns"),
99
+    signature = "x"
100
+)
100 101
 
101 102
 #' @export
102 103
 #' @rdname spatialPatterns
... ...
@@ -104,7 +105,7 @@ setGeneric("spatialPatterns", function(x, ...)
104 105
 #' @importFrom SpatialExperiment spatialCoords spatialCoordsNames<-
105 106
 #' @importFrom checkmate assert_data_frame assert_number assert_int assert_flag
106 107
 setMethod("spatialPatterns", "SpatialExperiment",
107
-  function(x, assay_type = "counts", de_results, qval_thresh = 0.05,
108
+  function(x, de_results, assay_type = "counts", qval_thresh = 0.05,
108 109
            n_patterns, length, verbose = FALSE) {
109 110
     assert_data_frame(de_results, all.missing = FALSE)
110 111
     assert_number(qval_thresh, null.ok = TRUE)
... ...
@@ -79,7 +79,10 @@ NULL
79 79
 #' @import methods
80 80
 #' @export
81 81
 #' @rdname modelSearch
82
-setGeneric("modelSearch", function(x, ...) standardGeneric("modelSearch"))
82
+setGeneric("modelSearch",
83
+    function(x, de_results, ...) standardGeneric("modelSearch"),
84
+    signature = "x"
85
+)
83 86
 
84 87
 #' @export
85 88
 #' @rdname modelSearch
... ...
@@ -87,7 +90,7 @@ setGeneric("modelSearch", function(x, ...) standardGeneric("modelSearch"))
87 90
 #' @importFrom SpatialExperiment spatialCoords spatialCoordsNames<-
88 91
 #' @importFrom checkmate assert_data_frame assert_number assert_flag
89 92
 setMethod("modelSearch", "SpatialExperiment",
90
-  function(x, assay_type = "counts", de_results, qval_thresh=0.05,
93
+  function(x, de_results, assay_type = "counts", qval_thresh=0.05,
91 94
            verbose = FALSE) {
92 95
     assert_data_frame(de_results, all.missing = FALSE)
93 96
     assert_number(qval_thresh, null.ok = TRUE)
... ...
@@ -5,12 +5,12 @@
5 5
 \alias{modelSearch,SpatialExperiment-method}
6 6
 \title{Classify Spatially Variable Genes to interpretable fitting classes}
7 7
 \usage{
8
-modelSearch(x, ...)
8
+modelSearch(x, de_results, ...)
9 9
 
10 10
 \S4method{modelSearch}{SpatialExperiment}(
11 11
   x,
12
-  assay_type = "counts",
13 12
   de_results,
13
+  assay_type = "counts",
14 14
   qval_thresh = 0.05,
15 15
   verbose = FALSE
16 16
 )
... ...
@@ -18,13 +18,13 @@ modelSearch(x, ...)
18 18
 \arguments{
19 19
 \item{x}{\linkS4class{SpatialExperiment} object.}
20 20
 
21
+\item{de_results}{\code{data.frame} resulting from \code{\link[=run]{run()}} or \code{\link[=spatialDE]{spatialDE()}}.}
22
+
21 23
 \item{...}{For the generic, arguments to pass to specific methods.}
22 24
 
23 25
 \item{assay_type}{A \code{character} string specifying the assay from \code{x} to use
24 26
 as input. Defaults to \code{"counts"}.}
25 27
 
26
-\item{de_results}{\code{data.frame} resulting from \code{\link[=run]{run()}} or \code{\link[=spatialDE]{spatialDE()}}.}
27
-
28 28
 \item{qval_thresh}{\code{numeric} scalar, specifying the q-value significance
29 29
 threshold to filter \code{de_results}. Only rows in \code{de_results} with
30 30
 \code{qval < qval_thresh} will be kept. To disable, set \code{qval_thresh = NULL}.}
... ...
@@ -5,12 +5,12 @@
5 5
 \alias{spatialPatterns,SpatialExperiment-method}
6 6
 \title{Automatic expression histology in \strong{SpatialDE}}
7 7
 \usage{
8
-spatialPatterns(x, ...)
8
+spatialPatterns(x, de_results, ...)
9 9
 
10 10
 \S4method{spatialPatterns}{SpatialExperiment}(
11 11
   x,
12
-  assay_type = "counts",
13 12
   de_results,
13
+  assay_type = "counts",
14 14
   qval_thresh = 0.05,
15 15
   n_patterns,
16 16
   length,
... ...
@@ -20,13 +20,13 @@ spatialPatterns(x, ...)
20 20
 \arguments{
21 21
 \item{x}{\linkS4class{SpatialExperiment} object.}
22 22
 
23
+\item{de_results}{\code{data.frame} resulting from \code{\link[=run]{run()}} or \code{\link[=spatialDE]{spatialDE()}}.}
24
+
23 25
 \item{...}{For the generic, arguments to pass to specific methods.}
24 26
 
25 27
 \item{assay_type}{A \code{character} string specifying the assay from \code{x} to use
26 28
 as input. Defaults to \code{"counts"}.}
27 29
 
28
-\item{de_results}{\code{data.frame} resulting from \code{\link[=run]{run()}} or \code{\link[=spatialDE]{spatialDE()}}.}
29
-
30 30
 \item{qval_thresh}{\code{numeric} scalar, specifying the q-value significance
31 31
 threshold to filter \code{de_results}. Only rows in \code{de_results} with
32 32
 \code{qval < qval_thresh} will be kept. To disable, set \code{qval_thresh = NULL}.}