SRUtil-class | R Documentation |
These classes provide important utility functions in the ShortRead package, but may occasionally be seen by the user and are documented here for that reason.
Utility classes include:
.SRUtil-class
a virtual base class from which all
utility classes are derived.
SRError-class
created when errors occur in
ShortRead package code.
SRWarn-class
created when warnings occur in
ShortRead package code
SRList-class
representing a list (heterogeneous
collection) of objects. The S4Vectors::SimpleList class is a
better choice for a list-like container.
SRVector-class
representing a vector (homogeneous
collection, i.e., all elements of the same class) of objects.
Objects from these classes are not normally constructed by the user. However, constructors are available, as follows.
SRError(type, fmt, ...)
, SRWarn(type, fmt, ...)
:
character(1)
vector describing the type of the
error. type
must come from a pre-defined list of types.
a sprintf
-style format string for the
message to be reported with the error.
additional arguments to be interpolated into fmt
.
SRList(...)
elements of any type or length to be placed into the
SRList
. If the length of ...
is 1 and the
argument is a list, then the list itself is placed into
SRList
.
SRVector(..., vclass)
elements all satisfying an is
relationship
with vclass
, to be placed in SRVector
.
the class to which all elements in ...
belong. If vclass
is missing and length(list(...))
is greater than zero, then vclass
is taken to be the class
of the first argument of ...
.
SRVector
errors:
this error occurs when not all
arguments ...
satisfy an ‘is’ relationship with
vclass
.
SRError
and SRWarn
have the following slots defined:
.type
:Object of class "character"
containing
the type of error or warning. .type
must come from a
pre-defined list of types, see, e.g.,
ShortRead:::.SRError_types
.
.message
:Object of class "character"
containing a detailed message describing the error or warning.
SRList
has the following slot defined:
.srlist
:Object of class "list"
containing the
elements in the list.
SRVector
extends SRList
, with the following additional
slot:
vclass
:Object of class "character"
naming the
type of object all elements of SRVector
must be.
Accessors are available for all slots, and have the same name as the
slot, e.g., vclass
to access the vclass
slot of
SRVector
. Internal slots (those starting with ‘.’ also
have accessors, but these are not exported e.g.,
ShortRead:::.type
.
SRList
has the following methods:
signature(x = "SRList")
: return the
(integer(1)
) length of the SRList
.
signature(x = "SRList")
: return a character
vector of list element names. The length of the returned vector is
the same as the length of x
.
signature(x = "SRList", value = "character")
:
assign value
as names for members of x
.
signature(x = "SRList", i = "ANY", j = "missing")
:
subset the list using standard R list subset paradigms.
signature(x = "SRList", i = "ANY", j = "missing")
:
select element ‘i’ from the list, using standard R list
selection paradigms.
signature(X = "SRList", FUN="ANY")
: apply a function to
all elements of X
, with additional arguments interpreted
as with lapply
.
signature(X = "SRList")
: apply a function to
all elements of X
, simplifying the result if
possible. Additional arguments interpreted as with
sapply
.
signature(object="SRList")
: coerce the SRList
object to a list.
signature(object = "SRList")
: display an
informative summary of the object content, including the length of
the list represented by object
.
signature(x = "SRList")
: display a more
extensive version of the object, as one might expect from printing
a standard list in R.
SRVector
inherits all methods from SRList
, and has the
following additional methods:
signature(object = "SRVector")
: display an
informative summary of the object content, e.g., the vector class
(vclass
) and length.
signature(x = "SRVector")
: display a more
extensive version of the object, as one might expect from a
printing a standard R list.
Martin Morgan
getClass(".SRUtil", where=getNamespace("ShortRead"))
ShortRead:::.SRError_types
ShortRead:::.SRWarn_types
detail(SRList(1:5, letters[1:5]))
tryCatch(SRVector(1:5, letters[1:5]),
SRVectorClassDisagreement=function(err) {
cat("caught:", conditionMessage(err), "\n")
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.