~ubuntu-branches/ubuntu/wily/r-bioc-genomicranges/wily-proposed

« back to all changes in this revision

Viewing changes to man/strand-utils.Rd

  • Committer: Package Import Robot
  • Author(s): Andreas Tille
  • Date: 2014-06-13 15:04:19 UTC
  • mfrom: (1.1.2)
  • Revision ID: package-import@ubuntu.com-20140613150419-v49mxnlg42rnuks5
Tags: 1.16.3-1
* New upstream version
* New (Build-)Depends: r-bioc-genomeinfodb
* cme fix dpkg-control
* add autopkgtest

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
\alias{strand-utils}
4
4
 
5
5
\alias{strand,missing-method}
 
6
\alias{strand,NULL-method}
6
7
\alias{strand,character-method}
7
8
\alias{strand,factor-method}
8
9
\alias{strand,integer-method}
36
37
 
37
38
\details{
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{*}.
41
41
 
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}
 
44
  are not accepted.
44
45
 
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
49
 
  in the result.
 
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.
50
50
 
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
55
 
  in the result.
 
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.
56
55
 
57
 
  If \code{x} is a 'logical'-\link[IRanges]{Rle} vector, it is
58
 
  transformed with \code{runValue(x) <- strand(runValue(x))}
59
 
  and returned.
 
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.
60
59
 
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.
65
 
}
66
 
 
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.
 
64
}
 
65
 
 
66
\value{
 
67
  A factor (or factor-\link[IRanges]{Rle}) with the "standard strand levels"
 
68
  (i.e. \code{+}, \code{-}, and \code{*}) and no NAs.
 
69
}
 
70
 
 
71
\author{Michael Lawrence and H. Pages}
68
72
 
69
73
\seealso{
70
74
  \code{\link[BiocGenerics]{strand}}
72
76
 
73
77
\examples{
74
78
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)))
 
79
 
 
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)
 
84
 
 
85
strand(x1)
 
86
strand(x2)
 
87
strand(x3)
 
88
strand(x4)
 
89
 
 
90
strand(Rle(x1))
 
91
strand(Rle(x2))
 
92
strand(Rle(x3))
 
93
strand(Rle(x4))
 
94
 
 
95
strand(DataFrame(score=2:-3))
 
96
strand(DataFrame(score=2:-3, strand=x3))
 
97
strand(DataFrame(score=2:-3, strand=Rle(x3)))
 
98
 
 
99
## Sanity checks:
 
100
target <- strand(x1)
 
101
stopifnot(identical(target, strand(x3)))
 
102
stopifnot(identical(target, strand(x4)))
 
103
 
 
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))))
79
108
}
80
109
 
81
110
\keyword{methods}