The Views virtual class is a general container for storing a set of views on an arbitrary Vector object, called the "subject".
Its primary purpose is to introduce concepts and provide some facilities that can be shared by the concrete classes that derive from it.
Some direct subclasses of the Views class are: RleViews, XIntegerViews (defined in the XVector package), XStringViews (defined in the Biostrings package), etc...
Views(subject, start=NULL, end=NULL, width=NULL, names=NULL):
This constructor is a generic function with dispatch on argument
subject. Specific methods must be defined for the subclasses
of the Views class. For example a method for
XString subjects is defined
in the Biostrings package that returns an
object. There is no default method.
The treatment of the
arguments is the same as with the
except that, in addition,
start to be a
Ranges object. With this feature,
Views(subject, IRanges(my_starts, my_ends, my_widths, my_names))
Views(subject, my_starts, my_ends, my_widths, my_names)
are equivalent (except when
my_starts is itself a
In the code snippets below,
from is a Views object:
as(from, "IRanges"): Creates an
containing the view locations in
All the accessor-like methods defined for
work on Views objects. In addition, the following accessors are defined
for Views objects:
Return the subject of the views.
x[i]: Select the views specified by
Extracts the view selected by
i as an object of the same class
i can be a single integer
or a character string.
The result is the subsequence of
subject(x) defined by
window(subject(x), start=start(x)[i], end=end(x)[i])
or an error if the view is "out of limits" (i.e.
start(x)[i] < 1
end(x)[i] > length(subject(x))).
c(x, ..., ignore.mcols=FALSE): Combine
They must have the same subject.
restrict(x, start=1L, end=length(subject(x)), keep.all.ranges=TRUE,
subviews(x, start=NA, end=NA, width=NA, use.names=TRUE):
width arguments must be vectors
of integers, eventually with NAs, that contain coordinates relative
to the current ranges. Equivalent to
trim(narrow(x, start=start, end=end, width=width, use.names=use.names)).
successiveViews(subject, width, gapwidth=0, from=1):
Views(subject, successiveIRanges(width, gapwidth, from)).
?successiveIRanges for a description of the
IRanges-class, Vector-class, IRanges-utils, XVector.
Some direct subclasses of the Views class: RleViews-class, XIntegerViews-class, XDoubleViews-class, XStringViews-class.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
showClass("Views") # shows (some of) the known subclasses ## Create a set of 4 views on an XInteger subject of length 10: subject <- Rle(3:-6) v1 <- Views(subject, start=4:1, end=4:7) ## Extract the 2nd view: v1[] ## Some views can be "out of limits" v2 <- Views(subject, start=4:-1, end=6) trim(v2) subviews(v2, end=-2) ## See ?`XIntegerViews-class` in the XVector package for more examples.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.