38
39
If \code{x} is missing, returns an empty factor with the
39
standard levels that any strand factor should have: \code{+},
40
\code{-}, and \code{*}.
40
"standard strand levels" i.e. \code{+}, \code{-}, and \code{*}.
42
If \code{x} is a character vector or factor, it is coerced to a factor
43
with the levels listed above.
42
If \code{x} is a character vector or factor, it is coerced to a
43
factor with the levels listed above. \code{NA} values in \code{x}
45
46
If \code{x} is an integer vector, it is coerced to a factor
46
with the levels listed above. \code{1} and \code{-1}
47
values in \code{x} are mapped to the \code{+} and \code{-}
48
levels respectively. \code{NA}s in \code{x} produce \code{NA}s
47
with the levels listed above. \code{1}, \code{-1}, and \code{NA}
48
values in \code{x} are mapped to the \code{+}, \code{-}, and
49
\code{*} levels respectively.
51
51
If \code{x} is a logical vector, it is coerced to a factor
52
with the levels listed above. \code{FALSE} and \code{TRUE}
53
values in \code{x} are mapped to the \code{+} and \code{-}
54
levels respectively. \code{NA}s in \code{x} produce \code{NA}s
52
with the levels listed above. \code{FALSE}, \code{TRUE}, and \code{NA}
53
values in \code{x} are mapped to the \code{+}, \code{-}, and
54
\code{*} levels respectively.
57
If \code{x} is a 'logical'-\link[IRanges]{Rle} vector, it is
58
transformed with \code{runValue(x) <- strand(runValue(x))}
56
If \code{x} is a character-, factor-, integer-, or
57
logical-\link[IRanges]{Rle}, it is transformed with
58
\code{runValue(x) <- strand(runValue(x))} and returned.
61
60
If \code{x} inherits from \code{DataTable}, the \code{"strand"}
62
column is returned as a factor with the levels listed above. If
63
\code{x} has no \code{"strand"} column, this return value is
64
populated with \code{NA}s.
67
\author{ Michael Lawrence }
61
column is passed thru \code{strand()} and returned.
62
If \code{x} has no \code{"strand"} column, this return value is
63
populated with \code{*}s.
67
A factor (or factor-\link[IRanges]{Rle}) with the "standard strand levels"
68
(i.e. \code{+}, \code{-}, and \code{*}) and no NAs.
71
\author{Michael Lawrence and H. Pages}
70
74
\code{\link[BiocGenerics]{strand}}
75
strand(c("+", "-", NA, "*"))
76
strand(c(-1L, 1L, NA, -1L, NA))
77
strand(c(FALSE, FALSE, TRUE, NA, TRUE, FALSE))
78
strand(Rle(c(FALSE, FALSE, TRUE, NA, TRUE, FALSE)))
80
x1 <- c("-", "*", "*", "+", "-", "*")
81
x2 <- factor(c("-", "-", "+", "-"))
82
x3 <- c(-1L, NA, NA, 1L, -1L, NA)
83
x4 <- c(TRUE, NA, NA, FALSE, TRUE, NA)
95
strand(DataFrame(score=2:-3))
96
strand(DataFrame(score=2:-3, strand=x3))
97
strand(DataFrame(score=2:-3, strand=Rle(x3)))
101
stopifnot(identical(target, strand(x3)))
102
stopifnot(identical(target, strand(x4)))
104
stopifnot(identical(Rle(strand(x1)), strand(Rle(x1))))
105
stopifnot(identical(Rle(strand(x2)), strand(Rle(x2))))
106
stopifnot(identical(Rle(strand(x3)), strand(Rle(x3))))
107
stopifnot(identical(Rle(strand(x4)), strand(Rle(x4))))