\HeaderA{XVector-class}{XVector objects}{XVector.Rdash.class}
\aliasA{==,XDouble,XDouble-method}{XVector-class}{==,XDouble,XDouble.Rdash.method}
\aliasA{==,XInteger,XInteger-method}{XVector-class}{==,XInteger,XInteger.Rdash.method}
\aliasA{as.integer,XInteger-method}{XVector-class}{as.integer,XInteger.Rdash.method}
\aliasA{as.integer,XRaw-method}{XVector-class}{as.integer,XRaw.Rdash.method}
\aliasA{as.numeric,XDouble-method}{XVector-class}{as.numeric,XDouble.Rdash.method}
\aliasA{as.numeric,XVector-method}{XVector-class}{as.numeric,XVector.Rdash.method}
\aliasA{as.raw,XRaw-method}{XVector-class}{as.raw,XRaw.Rdash.method}
\aliasA{as.vector,XDouble,missing-method}{XVector-class}{as.vector,XDouble,missing.Rdash.method}
\aliasA{as.vector,XInteger,missing-method}{XVector-class}{as.vector,XInteger,missing.Rdash.method}
\aliasA{as.vector,XRaw,missing-method}{XVector-class}{as.vector,XRaw,missing.Rdash.method}
\aliasA{c,XRaw-method}{XVector-class}{c,XRaw.Rdash.method}
\aliasA{class:XDouble}{XVector-class}{class:XDouble}
\aliasA{class:XInteger}{XVector-class}{class:XInteger}
\aliasA{class:XRaw}{XVector-class}{class:XRaw}
\aliasA{class:XVector}{XVector-class}{class:XVector}
\aliasA{coerce,integer,XVector-method}{XVector-class}{coerce,integer,XVector.Rdash.method}
\aliasA{coerce,numeric,XDouble-method}{XVector-class}{coerce,numeric,XDouble.Rdash.method}
\aliasA{coerce,numeric,XInteger-method}{XVector-class}{coerce,numeric,XInteger.Rdash.method}
\aliasA{coerce,numeric,XRaw-method}{XVector-class}{coerce,numeric,XRaw.Rdash.method}
\aliasA{coerce,numeric,XVector-method}{XVector-class}{coerce,numeric,XVector.Rdash.method}
\aliasA{coerce,raw,XRaw-method}{XVector-class}{coerce,raw,XRaw.Rdash.method}
\aliasA{coerce,raw,XVector-method}{XVector-class}{coerce,raw,XVector.Rdash.method}
\aliasA{length,XVector-method}{XVector-class}{length,XVector.Rdash.method}
\aliasA{seqselect,XVector-method}{XVector-class}{seqselect,XVector.Rdash.method}
\aliasA{show,XDouble-method}{XVector-class}{show,XDouble.Rdash.method}
\aliasA{show,XVector-method}{XVector-class}{show,XVector.Rdash.method}
\aliasA{subseq}{XVector-class}{subseq}
\aliasA{subseq,XVector-method}{XVector-class}{subseq,XVector.Rdash.method}
\aliasA{subseq<\Rdash}{XVector-class}{subseq<.Rdash.}
\aliasA{subseq<-,XVector-method}{XVector-class}{subseq<.Rdash.,XVector.Rdash.method}
\aliasA{window,XVector-method}{XVector-class}{window,XVector.Rdash.method}
\aliasA{XDouble}{XVector-class}{XDouble}
\aliasA{XDouble-class}{XVector-class}{XDouble.Rdash.class}
\aliasA{XInteger}{XVector-class}{XInteger}
\aliasA{XInteger-class}{XVector-class}{XInteger.Rdash.class}
\aliasA{XNumeric}{XVector-class}{XNumeric}
\aliasA{XRaw}{XVector-class}{XRaw}
\aliasA{XRaw-class}{XVector-class}{XRaw.Rdash.class}
\aliasA{XVector}{XVector-class}{XVector}
\aliasA{[,XDouble-method}{XVector-class}{[,XDouble.Rdash.method}
\aliasA{[,XInteger-method}{XVector-class}{[,XInteger.Rdash.method}
\aliasA{[,XRaw-method}{XVector-class}{[,XRaw.Rdash.method}
\keyword{methods}{XVector-class}
\keyword{classes}{XVector-class}
\begin{Description}\relax
The XVector virtual class is a general container for storing
an "external vector". It inherits from the \LinkA{Sequence}{Sequence},
which has a very rich interface.

The following classes derive directly from the XVector class:

The XRaw class is a container for storing an "external raw vector"
i.e. an external sequence of bytes (stored as char values at the
C level).

The XInteger class is a container for storing an "external integer
vector" i.e. an external sequence of integer values (stored as
int values at the C level).

The XDouble class is a container for storing an "external double
vector" i.e. an external sequence of numeric values (stored as
double values at the C level).

Also the \LinkA{XString}{XString} class from
the Biostrings package.

The purpose of the X* containers is to provide a "pass by address"
semantic and also to avoid the overhead of copying the sequence
data when a linear subsequence needs to be extracted.
\end{Description}
\begin{Section}{Additional Subsetting operations on XVector objects}
In the code snippets below, \code{x} is an XVector object.

\describe{
\item[] \code{subseq(x, start=NA, end=NA, width=NA)}:
Extract the subsequence from \code{x} specified by \code{start},
\code{end} and \code{width}.
The supplied start/end/width values are solved by a call to
\code{solveUserSEW(length(x), start=start, end=end, width=width)}
and therefore must be compliant with the rules of the SEW
(Start/End/Width) interface (see \code{?solveUserSEW} for the
details).

A note about performance: \code{subseq} does NOT copy the sequence data
of an XVector object. Hence it's very efficient and is therefore the
recommended way to extract a linear subsequence (i.e. a set of consecutive
elements) from an XVector object. For example, extracting a 100Mb
subsequence from Human chromosome 1 (a 250Mb
\LinkA{DNAString}{DNAString} object) with \code{subseq}
is (almost) instantaneous and has (almost) no memory footprint (the cost
in time and memory does not depend on the length of the original sequence
or on the length of the subsequence to extract).

\item[] \code{subseq(x, start=NA, end=NA, width=NA) <- value}:
Replace the subsequence specified on the left (i.e. the subsequence
in \code{x} specified by \code{start}, \code{end} and \code{width})
by \code{value}.
\code{value} must belong to the same class as \code{x}, or to one of
its subclasses, or must be \code{NULL}.
This replacement method can modify the length of \code{x}, depending
on how the length of the left subsequence compares to the length of
\code{value}.
It can be used for inserting elements in \code{x} (specify an empty
left subsequence for this) or deleting elements from \code{x} (use
a \code{NULL} right value for this).
Unlike the extraction method above, this replacement method always
copies the sequence data of \code{x} (even for XVector objects).
NOTE: Only works for XRaw (and derived) objects for now.

}
\end{Section}
\begin{Author}\relax
H. Pages
\end{Author}
\begin{SeeAlso}\relax
\LinkA{Sequence-class}{Sequence.Rdash.class},
\LinkA{Views-class}{Views.Rdash.class},
\code{\LinkA{solveUserSEW}{solveUserSEW}},
\LinkA{DNAString-class}{DNAString.Rdash.class}
\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
  ## ---------------------------------------------------------------------
  ## A. XRaw OBJECTS
  ## ---------------------------------------------------------------------

  x1 <- XRaw(4)  # values are not initialized
  x1
  x2 <- as(c(255, 255, 199), "XRaw")
  x2
  y <- c(x1, x2, NULL, x1)  # NULLs are ignored
  y
  subseq(y, start=-4)
  subseq(y, start=-4) <- x2
  y

  ## ---------------------------------------------------------------------
  ## B. XInteger OBJECTS
  ## ---------------------------------------------------------------------

  x3 <- XInteger(12, val=c(-1:10))
  x3
  length(x3)

  ## Subsetting
  x4 <- XInteger(99999, val=sample(99, 99999, replace=TRUE) - 50)
  x4
  subseq(x4, start=10)
  subseq(x4, start=-10)
  subseq(x4, start=-20, end=-10)
  subseq(x4, start=10, width=5)
  subseq(x4, end=10, width=5)
  subseq(x4, end=10, width=0)

  x3[length(x3):1]
  x3[length(x3):1, drop=FALSE]
\end{ExampleCode}
\end{Examples}

