/
decode-methods.R
50 lines (44 loc) · 1.04 KB
/
decode-methods.R
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
#' Decode column data that uses run-length encoding
#'
#' @name decode
#' @note Updated 2021-06-04.
#'
#' @inheritParams AcidRoxygen::params
#' @param ... Additional arguments.
#'
#' @return Modified object.
#' Columns will be decoded and no longer `Rle` class.
#'
#' @seealso `S4Vectors::decode()`.
#'
#' @return Modified object.
#'
#' @examples
#' data(RangedSummarizedExperiment, package = "AcidTest")
#'
#' ## SummarizedExperiment ====
#' ## This works on rowData and colData.
#' object <- RangedSummarizedExperiment
#' object <- decode(object)
#' lapply(SummarizedExperiment::rowData(object), class)
NULL
## Updated 2019-07-20.
`decode,SE` <- # nolint
function(x) {
validObject(x)
if (!is.null(rowData(x))) {
rowData(x) <- decode(rowData(x))
}
if (!is.null(colData(x))) {
colData(x) <- decode(colData(x))
}
validObject(x)
x
}
#' @rdname decode
#' @export
setMethod(
f = "decode",
signature = signature(x = "SummarizedExperiment"),
definition = `decode,SE`
)