File: view-summarization-methods.Rd

package info (click to toggle)
r-bioc-iranges 2.16.0-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 1,808 kB
  • sloc: ansic: 4,789; sh: 4; makefile: 2
file content (169 lines) | stat: -rw-r--r-- 4,536 bytes parent folder | download | duplicates (4)
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
\name{view-summarization-methods}

\alias{view-summarization-methods}

\alias{viewApply}
\alias{viewApply,Views-method}
\alias{viewApply,RleViews-method}
\alias{viewApply,RleViewsList-method}
\alias{viewMins}
\alias{viewMins,RleViews-method}
\alias{viewMins,RleViewsList-method}
\alias{viewMaxs}
\alias{viewMaxs,RleViews-method}
\alias{viewMaxs,RleViewsList-method}
\alias{viewSums}
\alias{viewSums,RleViews-method}
\alias{viewSums,RleViewsList-method}
\alias{viewMeans}
\alias{viewMeans,RleViews-method}
\alias{viewMeans,RleViewsList-method}
\alias{viewWhichMins}
\alias{viewWhichMins,RleViews-method}
\alias{viewWhichMins,RleViewsList-method}
\alias{viewWhichMaxs}
\alias{viewWhichMaxs,RleViews-method}
\alias{viewWhichMaxs,RleViewsList-method}
\alias{viewRangeMins}
\alias{viewRangeMins,RleViews-method}
\alias{viewRangeMins,RleViewsList-method}
\alias{viewRangeMaxs}
\alias{viewRangeMaxs,RleViews-method}
\alias{viewRangeMaxs,RleViewsList-method}

\alias{Summary,Views-method}
\alias{mean,Views-method}
\alias{max,Views-method}
\alias{min,Views-method}
\alias{sum,Views-method}
\alias{which.min,Views-method}
\alias{which.max,Views-method}


\title{Summarize views on a vector-like object with numeric values}

\description{
  \code{viewApply} applies a function on each view of a \link{Views} or
  \link{ViewsList} object.

  \code{viewMins}, \code{viewMaxs}, \code{viewSums}, \code{viewMeans}
  calculate respectively the minima, maxima, sums, and means of the views
  in a \link{Views} or \link{ViewsList} object.
}

\usage{
viewApply(X, FUN, ..., simplify = TRUE)

viewMins(x, na.rm=FALSE)
\S4method{min}{Views}(x, ..., na.rm = FALSE)

viewMaxs(x, na.rm=FALSE)
\S4method{max}{Views}(x, ..., na.rm = FALSE)

viewSums(x, na.rm=FALSE)
\S4method{sum}{Views}(x, ..., na.rm = FALSE)

viewMeans(x, na.rm=FALSE)
\S4method{mean}{Views}(x, ...)

viewWhichMins(x, na.rm=FALSE)
\S4method{which.min}{Views}(x)

viewWhichMaxs(x, na.rm=FALSE)
\S4method{which.max}{Views}(x)

viewRangeMins(x, na.rm=FALSE)

viewRangeMaxs(x, na.rm=FALSE)
}

\arguments{
  \item{X}{
    A Views object.
  }
  \item{FUN}{
    The function to be applied to each view in \code{X}.
  }
  \item{...}{
    Additional arguments to be passed on.
  }
  \item{simplify}{
    A logical value specifying whether or not the result should be simplified
    to a vector or matrix if possible.
  }
  \item{x}{
    An \link{RleViews} or \link{RleViewsList} object.
  }
  \item{na.rm}{
    Logical indicating whether or not to include missing values in the results.
  }
}

\details{
  The \code{viewMins}, \code{viewMaxs}, \code{viewSums}, and \code{viewMeans}
  functions provide efficient methods for calculating the specified numeric
  summary by performing the looping in compiled code.

  The \code{viewWhichMins}, \code{viewWhichMaxs}, \code{viewRangeMins}, and
  \code{viewRangeMaxs} functions provide efficient methods for finding the
  locations of the minima and maxima.
}

\value{
  For all the functions in this man page (except \code{viewRangeMins} and
  \code{viewRangeMaxs}): A numeric vector of the length of \code{x}
  if \code{x} is an \link{RleViews} object, or a \link{List} object of
  the length of \code{x} if it's an \link{RleViewsList} object.

  For \code{viewRangeMins} and \code{viewRangeMaxs}: An \link{IRanges}
  object if \code{x} is an \link{RleViews} object, or an \link{IRangesList}
  object if it's an \link{RleViewsList} object.
}

\note{
  For convenience, methods for \code{min}, \code{max}, \code{sum},
  \code{mean}, \code{which.min} and \code{which.max} are provided as
  wrappers around the corresponding \code{view*} functions (which might
  be deprecated at some point).
}

\author{P. Aboyoun}

\seealso{
  \itemize{
    \item The \code{\link{slice}} function for slicing an \link{Rle} or
          \link{RleList} object.

    \item \link[XVector]{view-summarization-methods} in the \pkg{XVector}
          package for more view summarization methods.

    \item The \link{RleViews} and \link{RleViewsList} classes.

    \item The \code{\link{which.min}} and \code{\link{colSums}} functions.
  }
}

\examples{
## Views derived from coverage
x <- IRanges(start=c(1L, 9L, 4L, 1L, 5L, 10L),
             width=c(5L, 6L, 3L, 4L, 3L,  3L))
cvg <- coverage(x)
cvg_views <- slice(cvg, lower=2)

viewApply(cvg_views, diff)

viewMins(cvg_views)
viewMaxs(cvg_views)

viewSums(cvg_views)
viewMeans(cvg_views)

viewWhichMins(cvg_views)
viewWhichMaxs(cvg_views)

viewRangeMins(cvg_views)
viewRangeMaxs(cvg_views)
}

\keyword{methods}
\keyword{arith}