34 | 36 |
deleted file mode 100644 |
... | ... |
@@ -1,48 +0,0 @@ |
1 |
-##' @export |
|
2 |
-pqn_args <- function(dat_in, dat_out, ref_ids = NULL, min_frac = 0.5, |
|
3 |
- type = "mean") { |
|
4 |
- new("pqn_args", dat_in = dat_in, dat_out = dat_out, |
|
5 |
- ref_ids = ref_ids, min_frac = min_frac) |
|
6 |
-} |
|
7 |
- |
|
8 |
-sample_normalizer_args <- function(...) { |
|
9 |
- new("sample_normalizer_args", ...) |
|
10 |
-} |
|
11 |
- |
|
12 |
-sum_args <- function(dat_in, dat_out, restrict = TRUE, rescale = FALSE) { |
|
13 |
- new("sample_normalizer_args", normalizer = "sum", |
|
14 |
- dat_in = dat_in, dat_out = dat_out, |
|
15 |
- restrict = restrict, rescale = rescale) |
|
16 |
-} |
|
17 |
- |
|
18 |
-mean_args <- function(dat_in, dat_out, restrict = TRUE, rescale = FALSE) { |
|
19 |
- new("sample_normalizer_args", normalizer = "mean", |
|
20 |
- dat_in = dat_in, dat_out = dat_out, |
|
21 |
- restrict = restrict, rescale = rescale) |
|
22 |
-} |
|
23 |
- |
|
24 |
-median_args <- function(dat_in, dat_out, restrict = TRUE, rescale = FALSE) { |
|
25 |
- new("sample_normalizer_args", normalizer = "median", |
|
26 |
- dat_in = dat_in, dat_out = dat_out, |
|
27 |
- restrict = restrict, rescale = rescale) |
|
28 |
-} |
|
29 |
- |
|
30 |
-mad_args <- function(dat_in, dat_out, restrict = TRUE, rescale = FALSE) { |
|
31 |
- new("sample_normalizer_args", normalizer = "mad", |
|
32 |
- dat_in = dat_in, dat_out = dat_out, |
|
33 |
- restrict = restrict, rescale = rescale) |
|
34 |
-} |
|
35 |
- |
|
36 |
-euclidean_args <- function(dat_in, dat_out, restrict = TRUE, rescale = FALSE) { |
|
37 |
- new("sample_normalizer_args", normalizer = "euclidean", |
|
38 |
- dat_in = dat_in, dat_out = dat_out, |
|
39 |
- restrict = restrict, rescale = rescale) |
|
40 |
-} |
|
41 |
- |
|
42 |
-cyclicloess_args <- function(dat_in, dat_out, weights = NULL, span = 0.7, |
|
43 |
- iterations = 3, method = "fast") { |
|
44 |
- new("cyclicloess_args", |
|
45 |
- dat_in = dat_in, dat_out = dat_out, |
|
46 |
- weights = weights, span = span, iterations = as.integer(iterations), |
|
47 |
- method = method) |
|
48 |
-} |
49 | 0 |
deleted file mode 100644 |
... | ... |
@@ -1,129 +0,0 @@ |
1 |
-## List coercion method |
|
2 |
-##' @export |
|
3 |
-as.list.poplinArgs <- function(x) { |
|
4 |
- snames <- slotNames(x) |
|
5 |
- internals <- grep(snames, pattern = "^\\.") |
|
6 |
- if (length(internals)) { |
|
7 |
- ## Exclude hidden slots |
|
8 |
- snames <- snames[-internals] |
|
9 |
- } |
|
10 |
- ## args_list <- vector("list", length(snames)) # empty list |
|
11 |
- ## names(args_list) <- snames |
|
12 |
- ## for (i in names(args_list)) { |
|
13 |
- ## args_list[[i]] <- slot(x, name = i) |
|
14 |
- ## } |
|
15 |
- args_list <- lapply(snames, function(name) slot(x, name)) |
|
16 |
- names(args_list) <- snames |
|
17 |
- args_list |
|
18 |
-} |
|
19 |
- |
|
20 |
-setMethod("as.list", "poplinArgs", as.list.poplinArgs) |
|
21 |
- |
|
22 |
-##' @exportMethod coerce |
|
23 |
-setAs("poplinArgs", "list", function(from) { |
|
24 |
- as.list(from) |
|
25 |
-}) |
|
26 |
- |
|
27 |
-## Show method |
|
28 |
-.poplinArgs_show <- function(object) { |
|
29 |
- cat("Class: ", class(object), "\n", sep = "") |
|
30 |
- cat(" Arguments:\n") |
|
31 |
- poplin_args <- as.list(object) |
|
32 |
- for (i in seq_along(poplin_args)) { |
|
33 |
- cat(" - ", names(poplin_args)[i], ": ", deparse(poplin_args[[i]]), "\n", |
|
34 |
- sep = "") |
|
35 |
- } |
|
36 |
-} |
|
37 |
- |
|
38 |
-setMethod("show", "poplinArgs", .poplinArgs_show) |
|
39 |
- |
|
40 |
-.slot_check <- function(object) { |
|
41 |
- snames <- slotNames(object) |
|
42 |
- slot_check <- sapply(slotNames(object), function(x) !.hasSlot(object, x)) |
|
43 |
- if (sum(slot_check) == 0) { |
|
44 |
- character(0) |
|
45 |
- } else { |
|
46 |
- paste0("Slots not found: ", snames[slot_check]) |
|
47 |
- } |
|
48 |
-} |
|
49 |
- |
|
50 |
-.pqn_args_validity <- function(object) { |
|
51 |
- msg <- .slot_check(object) |
|
52 |
- if (length(object@dat_in) != 1) { |
|
53 |
- msg <- c(msg, "'dat_in' must be a character of length 1.") |
|
54 |
- } |
|
55 |
- if (length(object@dat_out) != 1) { |
|
56 |
- msg <- c(msg, "'dat_out' must be a character of length 1.") |
|
57 |
- } |
|
58 |
- if (length(object@min_frac) != 1 || object@min_frac < 0 || |
|
59 |
- object@min_frac > 1) { |
|
60 |
- msg <- c(msg, "'min_frac' must be a numeric value between 0 and 1.") |
|
61 |
- } |
|
62 |
- if (length(object@type) != 1 || !(object@type %in% c("mean", "median"))) { |
|
63 |
- msg <- c(msg, "'type' must be either \"mean\" or \"median\".") |
|
64 |
- } |
|
65 |
- if (length(msg)) { |
|
66 |
- msg |
|
67 |
- } else TRUE |
|
68 |
-} |
|
69 |
- |
|
70 |
-setValidity("pqn_args", .pqn_args_validity) |
|
71 |
- |
|
72 |
-.sample_normalizer_args_validity <- function(object) { |
|
73 |
- msg <- .slot_check(object) |
|
74 |
- normalizer_allowed <- c("sum", "mean", "median", "mad", "euclidean") |
|
75 |
- if (length(object@normalizer) != 1 || |
|
76 |
- !(object@normalizer %in% normalizer_allowed)) { |
|
77 |
- msg <- c( |
|
78 |
- msg, |
|
79 |
- paste0("'normalizer' must be one of ", |
|
80 |
- paste0("'", normalizer_allowed, "'", collapse = ", "), ".") |
|
81 |
- ) |
|
82 |
- } |
|
83 |
- if (length(object@dat_in) != 1) { |
|
84 |
- msg <- c(msg, "'dat_in' must be a character of length 1.") |
|
85 |
- } |
|
86 |
- if (length(object@dat_out) != 1) { |
|
87 |
- msg <- c(msg, "'dat_out' must be a character of length 1.") |
|
88 |
- } |
|
89 |
- if (length(object@restrict) != 1) { |
|
90 |
- msg <- c(msg, "'restrict' must be a logical of length 1.") |
|
91 |
- } |
|
92 |
- if (length(object@rescale) != 1) { |
|
93 |
- msg <- c(msg, "'rescale' must be a logical of length 1.") |
|
94 |
- } |
|
95 |
- if (length(msg)) { |
|
96 |
- msg |
|
97 |
- } else TRUE |
|
98 |
-} |
|
99 |
- |
|
100 |
-setValidity("sample_normalizer_args", .sample_normalizer_args_validity) |
|
101 |
- |
|
102 |
-.cyclicloess_args_validity <- function(object) { |
|
103 |
- msg <- .slot_check(object) |
|
104 |
- ## if (length(object@normalizer) != 1 || object@normalizer != "cyclicloess") { |
|
105 |
- ## msg <- c(msg, "'normalizer' must be cyclicloess.") |
|
106 |
- ## } |
|
107 |
- if (length(object@dat_in) != 1) { |
|
108 |
- msg <- c(msg, "'dat_in' must be a character of length 1.") |
|
109 |
- } |
|
110 |
- if (length(object@dat_out) != 1) { |
|
111 |
- msg <- c(msg, "'dat_out' must be a character of length 1.") |
|
112 |
- } |
|
113 |
- if (length(object@span) != 1 || object@span < 0 || object@span > 1) { |
|
114 |
- msg <- c(msg, "'span' must be a numeric value between 0 and 1.") |
|
115 |
- } |
|
116 |
- if (length(object@iterations) != 1 || object@iterations <= 0) { |
|
117 |
- msg <- c(msg, "'iterations' must be a positive integer.") |
|
118 |
- } |
|
119 |
- method_allowed <- c("pairs", "fast", "affy") |
|
120 |
- if (length(object@method) != 1 || !(object@method %in% method_allowed)) { |
|
121 |
- msg <- c( |
|
122 |
- msg, |
|
123 |
- paste0("'method' must be one of ", |
|
124 |
- paste0("'", method_allowed, "'", collapse = ", "), ".") |
|
125 |
- ) |
|
126 |
- } |
|
127 |
-} |
|
128 |
- |
|
129 |
-setValidity("cyclicloess_args", .cyclicloess_args_validity) |