Description Usage Arguments Details Constructor Accessors GRanges compatibility (rowRanges access) Subsetting Extension Author(s) See Also Examples
The RangedSummarizedExperiment class is a matrix-like container where rows represent ranges of interest (as a GRanges or GRangesList object) and columns represent samples (with sample data summarized as a DataFrame). A RangedSummarizedExperiment contains one or more assays, each represented by a matrix-like object of numeric or other mode.
RangedSummarizedExperiment is a subclass of SummarizedExperiment and,
as such, all the methods documented in class?SummarizedExperiment
also work on a RangedSummarizedExperiment object. The methods documented
below are additional methods that are specific to RangedSummarizedExperiment
objects.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | ## Constructor
SummarizedExperiment(assays=SimpleList(),
rowData=NULL, rowRanges=GRangesList(),
colData=DataFrame(),
metadata=list())
## Accessors
rowRanges(x, ...)
rowRanges(x, ...) <- value
## Subsetting
## S4 method for signature 'RangedSummarizedExperiment'
subset(x, subset, select, ...)
## rowRanges access
## see 'GRanges compatibility', below
|
assays |
A |
rowData |
A DataFrame object describing
the rows. Row names, if present, become the row names of the
SummarizedExperiment object. The number of rows of the
DataFrame must equal the number of rows of the
matrices in |
rowRanges |
A GRanges or
GRangesList object describing the ranges of
interest. Names, if present, become the row names of the
SummarizedExperiment object. The length of the
GRanges or GRangesList
must equal the number of rows of the matrices in |
colData |
An optional DataFrame describing the samples. Row names, if present, become the column names of the RangedSummarizedExperiment. |
metadata |
An optional |
x |
A RangedSummarizedExperiment object. The |
... |
Further arguments to be passed to or from other methods. |
value |
A GRanges or GRangesList object. |
subset |
An expression which, when evaluated in the
context of |
select |
An expression which, when evaluated in the
context of |
The rows of a RangedSummarizedExperiment object represent ranges
(in genomic coordinates) of interest. The ranges of interest are
described by a GRanges or a GRangesList object, accessible
using the rowRanges
function, described below. The GRanges
and GRangesList classes 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 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.
RangedSummarizedExperiment instances are constructed using the
SummarizedExperiment()
function with arguments outlined above.
In the following code snippets, x
is a RangedSummarizedExperiment
object.
rowRanges(x)
, rowRanges(x) <- value
:Get or set the
row data. value
is a GenomicRanges
object. Row
names of value
must be NULL or consistent with the existing
row names of x
.
Many GRanges and GRangesList operations are supported on
RangedSummarizedExperiment objects, using rowRanges
.
Supported operations include: pcompare
,
duplicated
, end
, end<-
,
granges
, is.unsorted
, match
,
mcols
, mcols<-
, order
,
ranges
, ranges<-
, rank
,
seqinfo
, seqinfo<-
, seqnames
,
sort
, start
, start<-
,
strand
, strand<-
,
width
, width<-
.
See also ?shift
,
?isDisjoint
,
?coverage
,
?findOverlaps
, and
?nearest
for more
GRanges compatibility methods.
Not all GRanges operations are supported, because they do not make sense for RangedSummarizedExperiment objects (e.g., length, name, as.data.frame, c, splitAsList), involve non-trivial combination or splitting of rows (e.g., disjoin, gaps, reduce, unique), or have not yet been implemented (Ops, map, window, window<-).
In the code snippets below, x
is a RangedSummarizedExperiment
object.
subset(x, subset, select)
:Create a subset of x
using an expression subset
referring to columns of
rowRanges(x)
(including ‘seqnames’, ‘start’,
‘end’, ‘width’, ‘strand’, and
names(rowData(x))
) and / or select
referring to
column names of colData(x)
.
RangedSummarizedExperiment is implemented as an S4 class, and can be
extended in the usual way, using contains="RangedSummarizedExperiment"
in the new class definition.
Martin Morgan, mtmorgan@fhcrc.org
SummarizedExperiment-class
shift, isDisjoint, coverage, findOverlaps, and nearest for more GRanges compatibility methods.
GRanges objects in the GenomicRanges package.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 | nrows <- 200; ncols <- 6
counts <- matrix(runif(nrows * ncols, 1, 1e4), nrows)
rowRanges <- GRanges(rep(c("chr1", "chr2"), c(50, 150)),
IRanges(floor(runif(200, 1e5, 1e6)), width=100),
strand=sample(c("+", "-"), 200, TRUE),
feature_id=sprintf("ID%03d", 1:200))
colData <- DataFrame(Treatment=rep(c("ChIP", "Input"), 3),
row.names=LETTERS[1:6])
rse <- SummarizedExperiment(assays=SimpleList(counts=counts),
rowRanges=rowRanges, colData=colData)
rse
dim(rse)
dimnames(rse)
assayNames(rse)
head(assay(rse))
assays(rse) <- endoapply(assays(rse), asinh)
head(assay(rse))
rowRanges(rse)
rowData(rse) # same as 'mcols(rowRanges(rse))'
colData(rse)
rse[ , rse$Treatment == "ChIP"]
## cbind() combines objects with the same ranges but different samples:
rse1 <- rse
rse2 <- rse1[ , 1:3]
colnames(rse2) <- letters[1:ncol(rse2)]
cmb1 <- cbind(rse1, rse2)
dim(cmb1)
dimnames(cmb1)
## rbind() combines objects with the same samples but different ranges:
rse1 <- rse
rse2 <- rse1[1:50, ]
rownames(rse2) <- letters[1:nrow(rse2)]
cmb2 <- rbind(rse1, rse2)
dim(cmb2)
dimnames(cmb2)
## Coercion to/from SummarizedExperiment:
se0 <- as(rse, "SummarizedExperiment")
se0
as(se0, "RangedSummarizedExperiment")
## Setting rowRanges on a SummarizedExperiment object turns it into a
## RangedSummarizedExperiment object:
se <- se0
rowRanges(se) <- rowRanges
se # RangedSummarizedExperiment
## Sanity checks:
stopifnot(identical(assays(se0), assays(rse)))
stopifnot(identical(dim(se0), dim(rse)))
stopifnot(identical(dimnames(se0), dimnames(rse)))
stopifnot(identical(rowData(se0), rowData(rse)))
stopifnot(identical(colData(se0), colData(rse)))
|
Loading required package: GenomicRanges
Loading required package: stats4
Loading required package: BiocGenerics
Loading required package: parallel
Attaching package: 'BiocGenerics'
The following objects are masked from 'package:parallel':
clusterApply, clusterApplyLB, clusterCall, clusterEvalQ,
clusterExport, clusterMap, parApply, parCapply, parLapply,
parLapplyLB, parRapply, parSapply, parSapplyLB
The following objects are masked from 'package:stats':
IQR, mad, sd, var, xtabs
The following objects are masked from 'package:base':
Filter, Find, Map, Position, Reduce, anyDuplicated, append,
as.data.frame, cbind, colMeans, colSums, colnames, do.call,
duplicated, eval, evalq, get, grep, grepl, intersect, is.unsorted,
lapply, lengths, mapply, match, mget, order, paste, pmax, pmax.int,
pmin, pmin.int, rank, rbind, rowMeans, rowSums, rownames, sapply,
setdiff, sort, table, tapply, union, unique, unsplit, which,
which.max, which.min
Loading required package: S4Vectors
Attaching package: 'S4Vectors'
The following object is masked from 'package:base':
expand.grid
Loading required package: IRanges
Loading required package: GenomeInfoDb
Loading required package: Biobase
Welcome to Bioconductor
Vignettes contain introductory material; view with
'browseVignettes()'. To cite Bioconductor, see
'citation("Biobase")', and for packages 'citation("pkgname")'.
Loading required package: DelayedArray
Loading required package: matrixStats
Attaching package: 'matrixStats'
The following objects are masked from 'package:Biobase':
anyMissing, rowMedians
Attaching package: 'DelayedArray'
The following objects are masked from 'package:matrixStats':
colMaxs, colMins, colRanges, rowMaxs, rowMins, rowRanges
The following object is masked from 'package:base':
apply
class: RangedSummarizedExperiment
dim: 200 6
metadata(0):
assays(1): counts
rownames: NULL
rowData names(1): feature_id
colnames(6): A B ... E F
colData names(1): Treatment
[1] 200 6
[[1]]
NULL
[[2]]
[1] "A" "B" "C" "D" "E" "F"
[1] "counts"
A B C D E F
[1,] 6330.330 6360.622 8845.1648 8292.1898 5743.753 6693.240
[2,] 7982.410 3963.526 1872.7335 9053.0384 3011.502 5394.960
[3,] 1688.534 4319.061 8877.4737 4707.2695 6254.098 1976.238
[4,] 4286.985 4694.187 3225.5930 1643.3986 9373.420 9340.242
[5,] 9368.335 4752.894 917.7643 9899.4702 6577.467 4170.116
[6,] 3948.635 8345.333 3117.4793 918.5788 9253.385 6434.552
A B C D E F
[1,] 9.446255 9.451029 9.780773 9.716217 9.349015 9.502000
[2,] 9.678143 8.978036 8.228302 9.804003 8.703341 9.286368
[3,] 8.124763 9.063940 9.784419 9.150010 9.434139 8.282097
[4,] 9.056486 9.147227 8.772019 8.097669 9.838780 9.835235
[5,] 9.838238 9.159656 7.515088 9.893384 9.484552 9.028846
[6,] 8.974272 9.722605 8.737927 7.515975 9.825892 9.462585
GRanges object with 200 ranges and 1 metadata column:
seqnames ranges strand | feature_id
<Rle> <IRanges> <Rle> | <character>
[1] chr1 [279582, 279681] - | ID001
[2] chr1 [497279, 497378] - | ID002
[3] chr1 [289724, 289823] + | ID003
[4] chr1 [743432, 743531] - | ID004
[5] chr1 [712372, 712471] - | ID005
... ... ... ... . ...
[196] chr2 [227832, 227931] - | ID196
[197] chr2 [851492, 851591] + | ID197
[198] chr2 [259616, 259715] - | ID198
[199] chr2 [624392, 624491] - | ID199
[200] chr2 [124487, 124586] - | ID200
-------
seqinfo: 2 sequences from an unspecified genome; no seqlengths
DataFrame with 200 rows and 1 column
feature_id
<character>
1 ID001
2 ID002
3 ID003
4 ID004
5 ID005
... ...
196 ID196
197 ID197
198 ID198
199 ID199
200 ID200
DataFrame with 6 rows and 1 column
Treatment
<character>
A ChIP
B Input
C ChIP
D Input
E ChIP
F Input
class: RangedSummarizedExperiment
dim: 200 3
metadata(0):
assays(1): counts
rownames: NULL
rowData names(1): feature_id
colnames(3): A C E
colData names(1): Treatment
[1] 200 9
[[1]]
NULL
[[2]]
[1] "A" "B" "C" "D" "E" "F" "a" "b" "c"
[1] 250 6
[[1]]
[1] "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""
[19] "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""
[37] "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""
[55] "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""
[73] "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""
[91] "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""
[109] "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""
[127] "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""
[145] "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""
[163] "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""
[181] "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""
[199] "" "" "a" "b" "c" "d" "e" "f" "g" "h" "i" "j" "k" "l" "m" "n" "o" "p"
[217] "q" "r" "s" "t" "u" "v" "w" "x" "y" "z" NA NA NA NA NA NA NA NA
[235] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
[[2]]
[1] "A" "B" "C" "D" "E" "F"
class: SummarizedExperiment
dim: 200 6
metadata(0):
assays(1): counts
rownames: NULL
rowData names(1): feature_id
colnames(6): A B ... E F
colData names(1): Treatment
class: RangedSummarizedExperiment
dim: 200 6
metadata(0):
assays(1): counts
rownames: NULL
rowData names(1): feature_id
colnames(6): A B ... E F
colData names(1): Treatment
class: RangedSummarizedExperiment
dim: 200 6
metadata(0):
assays(1): counts
rownames: NULL
rowData names(1): feature_id
colnames(6): A B ... E F
colData names(1): Treatment
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.