Description Usage Arguments Value Examples
These methods transform RaggedExperiment
objects to similar SummarizedExperiment
objects. They do
so by transforming assay data to more rectangular
representations, following the rules outlined for similarly
names transformations sparseAssay()
,
compactAssay()
, disjoinAssay()
, and
qreduceAssay()
. Because of the complexity of the
transformation, ti usually only makes sense transform
RaggedExperiment
objects with a single assay; this is
currently enforced at time of coercion.
1 2 3 4 5 6 7 8 9 10 11 12 13 | sparseSummarizedExperiment(x, i = 1, withDimnames = TRUE, sparse = FALSE)
compactSummarizedExperiment(x, i = 1L, withDimnames = TRUE, sparse = FALSE)
disjoinSummarizedExperiment(x, simplifyDisjoin, i = 1L, withDimnames = TRUE)
qreduceSummarizedExperiment(
x,
query,
simplifyReduce,
i = 1L,
withDimnames = TRUE
)
|
x |
|
i |
|
withDimnames |
|
sparse |
logical(1) whether to return a
|
simplifyDisjoin |
|
query |
|
simplifyReduce |
|
All functions return RangedSummarizedExperiment
.
sparseSummarizedExperiment
has rowRanges()
identical to the row ranges of x
, and assay()
data as sparseAssay()
. This is very space-inefficient
representation of ragged data. Use 'sparse=TRUE' to obtain
a sparseMatrix
assay representation.
compactSummarizedExperiment
has rowRanges()
identical to the row ranges of x
, and assay()
data as compactAssay()
. This is space-inefficient
representation of ragged data when samples are primarily
composed of different ranges. Use 'sparse=TRUE' to obtain
a sparseMatrix
assay representation.
disjoinSummarizedExperiment
has rowRanges()
identical to the disjoint row ranges of x
,
disjoint(rowRanges(x))
, and assay()
data as
disjoinAssay()
.
qreduceSummarizedExperiment
has rowRanges()
identical to query
, and assay()
data as
qreduceAssay()
.
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 | x <- RaggedExperiment(GRangesList(
GRanges(c("A:1-5", "A:4-6", "A:10-15"), score=1:3),
GRanges(c("A:1-5", "B:1-3"), score=4:5)
))
## sparseSummarizedExperiment
sse <- sparseSummarizedExperiment(x)
assay(sse)
rowRanges(sse)
## compactSummarizedExperiment
cse <- compactSummarizedExperiment(x)
assay(cse)
rowRanges(cse)
## disjoinSummarizedExperiment
disjoinAssay(x, lengths)
dse <- disjoinSummarizedExperiment(x, lengths)
assay(dse)
rowRanges(dse)
## qreduceSummarizedExperiment
x <- RaggedExperiment(GRangesList(
GRanges(c("A:1-3", "A:4-5", "A:10-15"), score=1:3),
GRanges(c("A:4-5", "B:1-3"), score=4:5)
))
query <- GRanges(c("A:1-2", "A:4-5", "B:1-5"))
weightedmean <- function(scores, ranges, qranges)
{
## weighted average score per query range
## the weight corresponds to the size of the overlap of each
## overlapping subject range with the corresponding query range
isects <- pintersect(ranges, qranges)
sum(scores * width(isects)) / sum(width(isects))
}
qreduceAssay(x, query, weightedmean)
qse <- qreduceSummarizedExperiment(x, query, weightedmean)
assay(qse)
rowRanges(qse)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.