Description Usage Arguments Details Author(s) See Also Examples
A concrete subclass of the SparseAssays virtual class.
As such, all the methods documented in
?
SparseAssays also work on a SimpleListSparseAssays object.
See SparseAssays for details.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | ## S4 method for signature 'SimpleListSparseAssays'
dim(x)
## S4 method for signature 'SimpleListSparseAssays'
dimnames(x)
## S4 method for signature 'SimpleListSparseAssays,ANY'
x[i, j, ..., drop = FALSE]
## S4 replacement method for signature 'SimpleListSparseAssays,ANY,ANY,ANY'
x[i, j, ...] <- value
## S4 method for signature 'SimpleListSparseAssays'
rbind(..., deparse.level = 1)
## S4 method for signature 'SimpleListSparseAssays'
cbind(..., deparse.level = 1)
## S4 method for signature 'SimpleListSparseAssays,SimpleListSparseAssays'
combine(x, y, ...)
|
x |
A SimpleListSparseAssays object. |
i, j |
Numeric or character vectors indicating which rows of the
sparse assays ( |
... |
For |
drop |
Not used by |
value |
An object of a class specified in the S4 method signature or as outlined in ‘Details’. |
deparse.level |
See |
y |
A SimpleListSparseAssays object. |
The SimpleListSparseAssays class has a nested-list structure. This hierarchy is illustrated below for an example with two sparse assays and three samples:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | SimpleListSparseAssays
|-- sparse_assay_1
| |-- sample_1
| | |-- key
| | |-- value
| |-- sample_2
| | |-- key
| | |-- value
| |-- sample_3
| | |-- key
| | |-- value
|-- sparse_assay_2
| |-- sample_1
| | |-- key
| | |-- value
| |-- sample_2
| | |-- key
| | |-- value
| |-- sample_3
| | |-- key
| | |-- value
|
Each ‘key’ is an integer vector and all key elements must have identical length. Each ‘value’ element is a matrix object. Each value element may have a different number of rows but the maximum number of rows must be less than or equal to the length of the key elements. A row of the value element may be pointed to multiple times by the key element within the same sample and asssay.
Peter Hickey, peter.hickey@gmail.com
SparseAssays objects for a description of the available methods.
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 | # TODO: Get old examples from docs?
# TODO: Use SparseAssays(matrix) in examples?
# TODO: Set names on 'key' elements so that can demonstrate combine().
## ---------------------------------------------------------------------
## DIRECT MANIPULATION OF SparseAssays OBJECTS
## ---------------------------------------------------------------------
sl1 <- SimpleList(
s1 = SimpleList(key = as.integer(c(NA, 1, NA, NA, 2, NA, 3, NA, 4, 5)),
value = matrix(1:10, ncol = 2)),
s2 = SimpleList(key = as.integer(c(NA, NA, 1, 2, NA, NA, 3, 4, NA, NA)),
value = matrix(8:1, ncol = 2)))
sl2 <- SimpleList(
s1 = SimpleList(key = as.integer(c(NA, 1, NA, 2, 2, NA, 1, NA, NA, 1)),
value = matrix(1:2, ncol = 1)),
s2 = SimpleList(key = as.integer(c(1, 1, 1, 2, NA, NA, NA, NA, NA, NA)),
value = matrix(4:3, ncol = 1)))
sa <- SparseAssays(SimpleList(sa1 = sl1, sa2 = sl2))
sa
as(sa, "SimpleList")
length(sa)
sa[[2]]
dim(sa)
sa2 <- sa[-4, 2]
sa2
length(sa2)
sa2[[2]]
dim(sa2)
dimnames(sa2)
names(sa)
names(sa) <- c("sa1", "sa2")
names(sa)
sa[["sa2"]]
rbind(sa, sa)
## Not run:
# ERROR: cbind-ing requires unique sample names
cbind(sa, sa)
## End(Not run)
# Works because unique sample names
cbind(sa[, 1], sa[, 2])
## Not run:
# ERROR: combine() requires named 'key' elements
combine(sa[1:7, 1], sa[3:8, 1])
# ERROR: combine() requires named 'key' elements
combine(sa[1:7, 1], sa[3:8, 2])
## End(Not run)
# TODO: An example of combine() that works because keys are named.
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.