SummarizedExperiment-class {GenomicRanges} | R Documentation |
The SummarizedExperiment class is an eSet-like container where rows
represent ranges of interest (as a GRanges-class
)
and columns represent samples (with sample data summarized as a
DataFrame-class
). A SummarizedExperiment
contains one or more assays, each represented by a matrix of numeric
or other mode.
## Constructors SummarizedExperiment(assays, ...) ## S4 method for signature 'SimpleList' SummarizedExperiment(assays, rowData = GRanges(), colData = DataFrame(), exptData = SimpleList(), ..., verbose = FALSE) ## S4 method for signature 'missing' SummarizedExperiment(assays, ...) ## S4 method for signature 'list' SummarizedExperiment(assays, ...) ## S4 method for signature 'matrix' SummarizedExperiment(assays, ...) ## Accessors assays(x, ..., withDimnames=TRUE) assays(x, ...) <- value assay(x, i, ...) assay(x, i, ...) <- value rowData(x, ...) rowData(x, ...) <- value colData(x, ...) colData(x, ...) <- value exptData(x, ...) exptData(x, ...) <- value ## S4 method for signature 'SummarizedExperiment' dim(x) ## S4 method for signature 'SummarizedExperiment' dimnames(x) ## S4 replacement method for signature 'SummarizedExperiment,NULL' dimnames(x) <- value ## S4 replacement method for signature 'SummarizedExperiment,list' dimnames(x) <- value ## Subsetting ## S4 method for signature 'SummarizedExperiment' x[i, j, ..., drop=TRUE] ## S4 replacement method for signature 'SummarizedExperiment,ANY,ANY,SummarizedExperiment' x[i, j] <- value
assays |
A list or SimpleList of matrix elements,
or a matrix . Each element of the list must have the same
dimensions, and dimension names (if present) must be consistent
across elements and with the row names of rowData ,
colData . |
rowData |
A GRanges instance describing the ranges of
interest. Row names, if present, become the row names of the
SummarizedExperiment . |
colData |
An optional DataFrame describing the
samples. Row names, if present, become the column names of the
SummarizedExperiment . |
exptData |
An optional SimpleList of arbitrary content
describing the overall experiment. |
... |
For SummarizedExperiment , S4 methods list
and matrix , arguments identical to those of the
SimpleList method.
For For other accessors, ignored.
|
verbose |
A logical(1) indicating whether messages
about data coercion during construction should be printed. |
x |
An instance of SummarizedExperiment -class. |
i, j |
For assay , assay<- , i is a integer or
numeric scalar; see ‘Details’ for additional constraints.
For |
withDimnames |
A logical(1) , indicating whether dimnames
should be applied to extracted assay elements. |
drop |
A logical(1) , ignored by these methods. |
value |
An instance of a class specified in the S4 method signature or as outlined in ‘Details’. |
The SummarizedExperiment
class is meant for numeric and other
data types derived from a sequencing experiment. The structure is
rectangular, like an eSet
in Biobase.
The rows of a SummarizedExperiment
instance represent ranges
(in genomic coordinates) of interest. The ranges of interest are
described by a GRanges-class
instance, accessible
using the rowData
function, described below. The GRanges
class contains sequence (e.g., chromosome) name, genomic coordinates,
and strand information. Each range can be annotated with additional
data; this data might be used to describe the range (analogous to
annotations associated with genes in a eSet
) or to summarize
results (e.g., statistics of differential abundance) relevant to the
range. Rows may or may not have row names; they often will not.
Each column of a SummarizedExperiment
instance represents a
sample. Information about the samples are stored in a
DataFrame-class
, accessible using the function
colData
, described below. The DataFrame
must have as
many rows as there are columns in the SummarizedExperiment
,
with each row of the DataFrame
providing information on the
sample in the corresponding column of the
SummarizedExperiment
. Columns of the DataFrame
represent
different sample attributes, e.g., tissue of origin, etc. Columns of
the DataFrame
can themselves be annotated (via the
values
function) in a fashion similar to the
varMetadata
facilities of the eSet
class. Column names
typically provide a short identifier unique to each sample.
A SummarizedExperiment
can also contain information about the
overall experiment, for instance the lab in which it was conducted,
the publications with which it is associated, etc. This information is
stored as a SimpleList-class
, accessible using
the exptData
function. The form of the data associated with the
experiment is left to the discretion of the user.
The SummarizedExperiment
is appropriate for matrix-like
data. The data are accessed using the assays
function,
described below. This returns a SimpleList
-class instance. Each
element of the list must itself be a matrix (of any mode) and must
have dimensions that are the same as the dimensions of the
SummarizedExperiment
in which they are stored. Row and column
names of each matrix must either be NULL
or match those of the
SummarizedExperiment
during construction. It is convenient for
the elements of SimpleList
of assays to be named.
The SummarizedExperiment
class has the following slots; this
detail of class structure is not relevant to the user.
exptData
rowData
colData
assays
Instances are constructed using the SummarizedExperiment
function with arguments outlined above.
In the following code snippets, x
is a
SummarizedExperiment
instance.
assays(x)
, assays(x) <- value
:value
is a list
or SimpleList
, each
element of which is a matrix with the same dimensions as
x
.
assay(x, i)
, assay(x, i) <- value
:assays(x)[[i]]
, assays(x)[[i]] <-
value
) to get or set the i
th (default first) assay
element. value
must be a matrix of the same dimension as
x
, and with dimension names NULL
or consistent with
those of x
.
rowData(x)
, rowData(x) <- value
:value
is a GenomicRanges
instance. Row
names of value
must be NULL or consistent with the existing
row names of x
.
colData(x)
, colData(x) <- value
:value
is a DataFrame
instance. Row
names of value
must be NULL or consistent with the existing
column names of x
.
exptData(x)
, exptData(x) <- value
:value
is a list
or
SimpleList
instance, with arbitrary content.
dim(x)
:SummarizedExperiment
.
dimnames(x)
, dimnames(x) <- value
:value
is usually a list of length 2,
containing elements that are either NULL
or vectors of
appropriate length for the corresponding dimension. value
can be NULL
, which removes dimension names. This method
implies that rownames
, rownames<-
, colnames
,
and colnames<-
are all available.
In the code snippets below, x
is a SummarizedExperiment
instance.
x[i,j]
, x[i,j] <- value
:x
. i
, j
can be numeric
,
logical
, character
, or missing
. value
must be a SummarizedExperiment
instance with dimensions,
dimension names, and assay elements consistent with the subset
x[i,j]
being replaced.
Martin Morgan, mtmorgan@fhcrc.org
GRanges, DataFrame, SimpleList,
nrows <- 200; ncols <- 6 counts <- matrix(runif(nrows * ncols, 1, 1e4), nrows) rowData <- GRanges(rep(c("chr1", "chr2"), c(50, 150)), IRanges(floor(runif(200, 1e5, 1e6)), width=100), strand=sample(c("+", "-"), 200, TRUE)) colData <- DataFrame(Treatment=rep(c("ChIP", "Input"), 3), row.names=LETTERS[1:6]) sset <- SummarizedExperiment(assays=SimpleList(counts=counts), rowData=rowData, colData=colData) sset assays(sset) <- endoapply(assays(sset), asinh) head(assay(sset))