XRleIntegerViews-class {IRanges}R Documentation

The XRleIntegerViews class

Description

The XRleIntegerViews class is the basic container for storing a set of views (start/end locations) on the same XRleInteger object.

Details

An XRleIntegerViews object contains a set of views (start/end locations) on the same XRleInteger object called "the subject integer vector" or simply "the subject". Each view is defined by its start and end locations: both are integers such that start <= end. An XRleIntegerViews object is in fact a particular case of a Views object (the XRleIntegerViews class contains the Views class) so it can be manipulated in a similar manner: see ?Views for more information. Note that two views can overlap and that a view can be "out of limits" i.e. it can start before the first element of the subject or/and end after its last element.

Other methods

In the code snippets below, x, object, e1 and e2 are XRleIntegerViews objects, and i can be a numeric or logical vector.

x[[i]]: Extract a view as an XRleInteger object. i must be a single numeric value (a numeric vector of length 1). Can't be used for extracting a view that is "out of limits" (raise an error). The returned object has the same XRleInteger subtype as subject(x).
e1 == e2: A vector of logicals indicating the result of the view by view comparison. The views in the shorter of the two XRleIntegerViews object being compared are recycled as necessary.
e1 != e2: Equivalent to !(e1 == e2).
as.integer(x, use.names, check.limits): Convert x to a list of integer vectors of the same length as x. Can't be used if x has "out of limits" views (raise an error).

Author(s)

P. Aboyoun

See Also

Views-class, XRleInteger-class, Views-utils

Examples

## Not run: 
  ## One standard way to create an XIntegerViews object is to use
  ## the Views() constructor:
  subject <- XRleInteger(rep(c(3L, 2L, 18L, 0L), c(3,2,1,5)))
  myViews <- Views(subject, 3:0, 5:8)
  myViews
  subject(myViews)
  length(myViews)
  start(myViews)
  end(myViews)
  width(myViews)
  myViews[[2]]

  ## Here the first view doesn't even overlap with the subject:
  Views(XRleInteger(as.integer(c(97, 97, 97, 45, 45, 98))), -3:4, -3:4 + c(3:6, 6:3))
## End(Not run)

[Package IRanges version 1.1.55 Index]