| Title: | Manages Subsets of Data with Bioconductor Experiment Objects |
|---|---|
| Description: | Experiment objects such as the SummarizedExperiment, RangedSummarizedExperiment, SingleCellExperiment, TreeSummarizedExperiment or SpatialExperiment are data containers for one or more matrix-like assays along with the associated row and column data. Often only a subset of the original data is needed for down-stream analysis. For example, filtering out poor quality samples will require excluding some columns before analysis. The ExperimentSubset object is a container to efficiently manage different subsets of the same data without having to make separate objects for each new subset. |
| Authors: | Irzam Sarfraz [aut] (ORCID: <https://orcid.org/0000-0001-8121-792X>), Muhammad Asif [aut, ths] (ORCID: <https://orcid.org/0000-0003-1839-2527>), Joshua D. Campbell [aut, cre] (ORCID: <https://orcid.org/0000-0003-0780-8662>) |
| Maintainer: | Joshua D. Campbell <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 1.23.50 |
| Built: | 2026-11-11 08:27:18 UTC |
| Source: | https://github.com/bioc/ExperimentSubset |
Create a subset from an already available assay in the
input ExperimentSubset object by specifying the rows and columns to
include in the subset.
createSubset(x, subsetName, rows = NULL, cols = NULL, parentAssay = NULL) ## S4 method for signature 'SubsetRangedSummarizedExperiment' createSubset(x, subsetName, rows = NULL, cols = NULL, parentAssay = NULL) ## S4 method for signature 'SubsetSingleCellExperiment' createSubset(x, subsetName, rows = NULL, cols = NULL, parentAssay = NULL) ## S4 method for signature 'SubsetSummarizedExperiment' createSubset(x, subsetName, rows = NULL, cols = NULL, parentAssay = NULL) ## S4 method for signature 'SubsetSpatialExperiment' createSubset(x, subsetName, rows = NULL, cols = NULL, parentAssay = NULL) ## S4 method for signature 'SubsetTreeSummarizedExperiment' createSubset(x, subsetName, rows = NULL, cols = NULL, parentAssay = NULL)createSubset(x, subsetName, rows = NULL, cols = NULL, parentAssay = NULL) ## S4 method for signature 'SubsetRangedSummarizedExperiment' createSubset(x, subsetName, rows = NULL, cols = NULL, parentAssay = NULL) ## S4 method for signature 'SubsetSingleCellExperiment' createSubset(x, subsetName, rows = NULL, cols = NULL, parentAssay = NULL) ## S4 method for signature 'SubsetSummarizedExperiment' createSubset(x, subsetName, rows = NULL, cols = NULL, parentAssay = NULL) ## S4 method for signature 'SubsetSpatialExperiment' createSubset(x, subsetName, rows = NULL, cols = NULL, parentAssay = NULL) ## S4 method for signature 'SubsetTreeSummarizedExperiment' createSubset(x, subsetName, rows = NULL, cols = NULL, parentAssay = NULL)
x |
|
subsetName |
|
rows |
|
cols |
|
parentAssay |
|
An ExperimentSubset object that now contains the newly created
subset.
data(sce_chcl, package = "scds") es <- ExperimentSubset(sce_chcl) es <- createSubset(es, "subset1", rows = c(10,11,50,56,98,99,102,105,109, 200), cols = c(20,21,40,45,90,99,100,123,166,299), parentAssay = "counts") esdata(sce_chcl, package = "scds") es <- ExperimentSubset(sce_chcl) es <- createSubset(es, "subset1", rows = c(10,11,50,56,98,99,102,105,109, 200), cols = c(20,21,40,45,90,99,100,123,166,299), parentAssay = "counts") es
This constructor function sets up an ExperimentSubset
object from a SummarizedExperiment,
RangedSummarizedExperiment, SingleCellExperiment,
TreeSummarizedExperiment or SpatialExperiment object, or
from a named list of assay matrices. A subset can also be created
directly by passing a named list to the subset parameter,
with elements named subsetName, rows, cols and
parentAssay.
ExperimentSubset( x, subset = list(subsetName = NA, rows = NA, cols = NA, parentAssay = NA) )ExperimentSubset( x, subset = list(subsetName = NA, rows = NA, cols = NA, parentAssay = NA) )
x |
An experiment object of one of the five supported classes, or a
named |
subset |
A named |
An object of the matching Subset* class, for example a
SubsetSingleCellExperiment for a SingleCellExperiment or
a list of assays. For an ExperimentSubset object, the same
object, with the new subset if subset is given.
ExperimentSubset, the class every
Subset* class extends, for testing whether an object is an
ExperimentSubset.
data(sce_chcl, package = "scds") es <- ExperimentSubset(sce_chcl) esdata(sce_chcl, package = "scds") es <- ExperimentSubset(sce_chcl) es
Get or set the alternative experiments (altExps) of
a subset by naming it with subsetName. Without
subsetName, these methods act on the main object, as for
SingleCellExperiment. They exist for the classes that extend
SingleCellExperiment: SubsetSingleCellExperiment,
SubsetSpatialExperiment and SubsetTreeSummarizedExperiment.
## S4 method for signature 'SubsetSingleCellExperiment,character' altExp(x, e, ...) ## S4 method for signature 'SubsetSingleCellExperiment,missing' altExp(x, e, ...) ## S4 method for signature 'SubsetSingleCellExperiment,numeric' altExp(x, e, ...) ## S4 method for signature 'SubsetSingleCellExperiment' altExps(x, ...) ## S4 method for signature 'SubsetSingleCellExperiment' altExpNames(x, ...) ## S4 replacement method for signature 'SubsetSingleCellExperiment,character' altExpNames(x, ...) <- value ## S4 replacement method for signature 'SubsetSingleCellExperiment,ANY' altExpNames(x, ...) <- value ## S4 replacement method for signature 'SubsetSingleCellExperiment,character' altExp(x, e, withDimnames = TRUE, withColData = FALSE, ...) <- value ## S4 replacement method for signature 'SubsetSingleCellExperiment,missing' altExp(x, e, withDimnames = TRUE, withColData = FALSE, ...) <- value ## S4 replacement method for signature 'SubsetSingleCellExperiment,numeric' altExp(x, e, withDimnames = TRUE, withColData = FALSE, ...) <- value ## S4 replacement method for signature 'SubsetSingleCellExperiment' altExps(x, withDimnames = TRUE, withColData = FALSE, ...) <- value ## S4 method for signature 'SubsetSpatialExperiment,character' altExp(x, e, ...) ## S4 method for signature 'SubsetSpatialExperiment,missing' altExp(x, e, ...) ## S4 method for signature 'SubsetSpatialExperiment,numeric' altExp(x, e, ...) ## S4 method for signature 'SubsetSpatialExperiment' altExps(x, ...) ## S4 method for signature 'SubsetSpatialExperiment' altExpNames(x, ...) ## S4 replacement method for signature 'SubsetSpatialExperiment,character' altExpNames(x, ...) <- value ## S4 replacement method for signature 'SubsetSpatialExperiment,ANY' altExpNames(x, ...) <- value ## S4 replacement method for signature 'SubsetSpatialExperiment,character' altExp(x, e, withDimnames = TRUE, withColData = FALSE, ...) <- value ## S4 replacement method for signature 'SubsetSpatialExperiment,missing' altExp(x, e, withDimnames = TRUE, withColData = FALSE, ...) <- value ## S4 replacement method for signature 'SubsetSpatialExperiment,numeric' altExp(x, e, withDimnames = TRUE, withColData = FALSE, ...) <- value ## S4 replacement method for signature 'SubsetSpatialExperiment' altExps(x, withDimnames = TRUE, withColData = FALSE, ...) <- value ## S4 method for signature 'SubsetTreeSummarizedExperiment,character' altExp(x, e, ...) ## S4 method for signature 'SubsetTreeSummarizedExperiment,missing' altExp(x, e, ...) ## S4 method for signature 'SubsetTreeSummarizedExperiment,numeric' altExp(x, e, ...) ## S4 method for signature 'SubsetTreeSummarizedExperiment' altExps(x, ...) ## S4 method for signature 'SubsetTreeSummarizedExperiment' altExpNames(x, ...) ## S4 replacement method for signature 'SubsetTreeSummarizedExperiment,character' altExpNames(x, ...) <- value ## S4 replacement method for signature 'SubsetTreeSummarizedExperiment,ANY' altExpNames(x, ...) <- value ## S4 replacement method for signature 'SubsetTreeSummarizedExperiment,character' altExp(x, e, withDimnames = TRUE, withColData = FALSE, ...) <- value ## S4 replacement method for signature 'SubsetTreeSummarizedExperiment,missing' altExp(x, e, withDimnames = TRUE, withColData = FALSE, ...) <- value ## S4 replacement method for signature 'SubsetTreeSummarizedExperiment,numeric' altExp(x, e, withDimnames = TRUE, withColData = FALSE, ...) <- value ## S4 replacement method for signature 'SubsetTreeSummarizedExperiment' altExps(x, withDimnames = TRUE, withColData = FALSE, ...) <- value## S4 method for signature 'SubsetSingleCellExperiment,character' altExp(x, e, ...) ## S4 method for signature 'SubsetSingleCellExperiment,missing' altExp(x, e, ...) ## S4 method for signature 'SubsetSingleCellExperiment,numeric' altExp(x, e, ...) ## S4 method for signature 'SubsetSingleCellExperiment' altExps(x, ...) ## S4 method for signature 'SubsetSingleCellExperiment' altExpNames(x, ...) ## S4 replacement method for signature 'SubsetSingleCellExperiment,character' altExpNames(x, ...) <- value ## S4 replacement method for signature 'SubsetSingleCellExperiment,ANY' altExpNames(x, ...) <- value ## S4 replacement method for signature 'SubsetSingleCellExperiment,character' altExp(x, e, withDimnames = TRUE, withColData = FALSE, ...) <- value ## S4 replacement method for signature 'SubsetSingleCellExperiment,missing' altExp(x, e, withDimnames = TRUE, withColData = FALSE, ...) <- value ## S4 replacement method for signature 'SubsetSingleCellExperiment,numeric' altExp(x, e, withDimnames = TRUE, withColData = FALSE, ...) <- value ## S4 replacement method for signature 'SubsetSingleCellExperiment' altExps(x, withDimnames = TRUE, withColData = FALSE, ...) <- value ## S4 method for signature 'SubsetSpatialExperiment,character' altExp(x, e, ...) ## S4 method for signature 'SubsetSpatialExperiment,missing' altExp(x, e, ...) ## S4 method for signature 'SubsetSpatialExperiment,numeric' altExp(x, e, ...) ## S4 method for signature 'SubsetSpatialExperiment' altExps(x, ...) ## S4 method for signature 'SubsetSpatialExperiment' altExpNames(x, ...) ## S4 replacement method for signature 'SubsetSpatialExperiment,character' altExpNames(x, ...) <- value ## S4 replacement method for signature 'SubsetSpatialExperiment,ANY' altExpNames(x, ...) <- value ## S4 replacement method for signature 'SubsetSpatialExperiment,character' altExp(x, e, withDimnames = TRUE, withColData = FALSE, ...) <- value ## S4 replacement method for signature 'SubsetSpatialExperiment,missing' altExp(x, e, withDimnames = TRUE, withColData = FALSE, ...) <- value ## S4 replacement method for signature 'SubsetSpatialExperiment,numeric' altExp(x, e, withDimnames = TRUE, withColData = FALSE, ...) <- value ## S4 replacement method for signature 'SubsetSpatialExperiment' altExps(x, withDimnames = TRUE, withColData = FALSE, ...) <- value ## S4 method for signature 'SubsetTreeSummarizedExperiment,character' altExp(x, e, ...) ## S4 method for signature 'SubsetTreeSummarizedExperiment,missing' altExp(x, e, ...) ## S4 method for signature 'SubsetTreeSummarizedExperiment,numeric' altExp(x, e, ...) ## S4 method for signature 'SubsetTreeSummarizedExperiment' altExps(x, ...) ## S4 method for signature 'SubsetTreeSummarizedExperiment' altExpNames(x, ...) ## S4 replacement method for signature 'SubsetTreeSummarizedExperiment,character' altExpNames(x, ...) <- value ## S4 replacement method for signature 'SubsetTreeSummarizedExperiment,ANY' altExpNames(x, ...) <- value ## S4 replacement method for signature 'SubsetTreeSummarizedExperiment,character' altExp(x, e, withDimnames = TRUE, withColData = FALSE, ...) <- value ## S4 replacement method for signature 'SubsetTreeSummarizedExperiment,missing' altExp(x, e, withDimnames = TRUE, withColData = FALSE, ...) <- value ## S4 replacement method for signature 'SubsetTreeSummarizedExperiment,numeric' altExp(x, e, withDimnames = TRUE, withColData = FALSE, ...) <- value ## S4 replacement method for signature 'SubsetTreeSummarizedExperiment' altExps(x, withDimnames = TRUE, withColData = FALSE, ...) <- value
x |
An |
e |
|
... |
Other arguments are passed on to the |
value |
For |
withDimnames |
|
withColData |
|
A subset sees the main object's altExps, and those stored on
the subsets it was made from, cut to its own columns (cells). Their
rows (features, such as the proteins of an ADT altExp) are not cut: a
subset's rows pick features of the main object only. These
altExps are linked, as assays are: the subset sees their current
values, and stores only what it changes.
Storing an altExp in a subset with altExp<- or altExps<-
compares it with the linked one of the same name, assay by assay:
A new assay is stored as the subset's own, and the linked assays stay linked.
An assay with the values of the linked one is not stored.
An assay with other values than the linked one needs
unlink, named as "altExpName/assayName", such as
"ADT/counts".
rowData, colData, metadata and reducedDims are stored when
they differ from the linked altExp's, and then replace them whole.
An empty one shows the linked one, so a subset can't clear them.
Other parts, such as the altExp's own altExps, colPairs and
rowPairs, always come from the linked altExp.
An assay the subset already stores itself, after an unlink, is
not linked, so storing it again needs no unlink.
An altExp with other rows, rownames or class than the linked
one replaces it entirely, so every linked assay counts as changed.
It keeps replacing it for as long as the subset stores it, even if
the linked altExp later has the same rows, and so does an altExp a
subset stores while nothing of that name is linked. To add to the
linked altExp instead, remove the subset's with
altExp(x, e, subsetName = s) <- NULL and store it again.
A subset can't remove or rename a linked altExp, or give one of its own
the name of another altExp it sees: an altExp missing
from value in altExps<- stays visible, and
altExp(x, e, subsetName = s) <- NULL removes only what the
subset stores, so the linked altExp shows again.
Changes to a linked altExp carry along to the subsets below it, made from the main object or from the subset that stores it. Its new values show in them. Renaming it renames what they store of it. Removing it, or storing it with other rows or another class, drops what they added to it, with a warning; an altExp a subset stores whole is kept.
altExp() returns a SummarizedExperiment,
altExps() a list of them and altExpNames() a
character vector. With subsetName, these are every
altExp the subset sees: the main object's first, then those stored
only on subsets. The setters return x with the change made.
# an object with 10 genes and 20 cells set.seed(1) counts <- matrix(rpois(200, lambda = 5), nrow = 10) rownames(counts) <- paste0("gene", 1:10) colnames(counts) <- paste0("cell", 1:20) es <- ExperimentSubset(list(counts = counts)) # counts of 2 proteins in the same 20 cells, as an altExp adtCounts <- matrix(rpois(40, lambda = 20), nrow = 2) rownames(adtCounts) <- c("CD3", "CD4") altExp(es, "ADT") <- SummarizedExperiment(list(counts = adtCounts)) # a subset of the first 5 genes and the first 8 cells es <- createSubset(es, subsetName = "first", rows = 1:5, cols = 1:8) # the subset sees ADT for its 8 cells, with both proteins altExpNames(es, subsetName = "first") adt <- altExp(es, "ADT", subsetName = "first") dim(adt) # add an assay to ADT in the subset only; ADT's counts stay linked assay(adt, "logcounts") <- log1p(assay(adt, "counts")) altExp(es, "ADT", subsetName = "first") <- adt assayNames(altExp(es, "ADT", subsetName = "first")) assayNames(altExp(es, "ADT")) # a changed linked assay needs unlink assay(adt, "counts") <- assay(adt, "counts") + 1L altExp(es, "ADT", subsetName = "first", unlink = "ADT/counts") <- adt# an object with 10 genes and 20 cells set.seed(1) counts <- matrix(rpois(200, lambda = 5), nrow = 10) rownames(counts) <- paste0("gene", 1:10) colnames(counts) <- paste0("cell", 1:20) es <- ExperimentSubset(list(counts = counts)) # counts of 2 proteins in the same 20 cells, as an altExp adtCounts <- matrix(rpois(40, lambda = 20), nrow = 2) rownames(adtCounts) <- c("CD3", "CD4") altExp(es, "ADT") <- SummarizedExperiment(list(counts = adtCounts)) # a subset of the first 5 genes and the first 8 cells es <- createSubset(es, subsetName = "first", rows = 1:5, cols = 1:8) # the subset sees ADT for its 8 cells, with both proteins altExpNames(es, subsetName = "first") adt <- altExp(es, "ADT", subsetName = "first") dim(adt) # add an assay to ADT in the subset only; ADT's counts stay linked assay(adt, "logcounts") <- log1p(assay(adt, "counts")) altExp(es, "ADT", subsetName = "first") <- adt assayNames(altExp(es, "ADT", subsetName = "first")) assayNames(altExp(es, "ADT")) # a changed linked assay needs unlink assay(adt, "counts") <- assay(adt, "counts") + 1L altExp(es, "ADT", subsetName = "first", unlink = "ADT/counts") <- adt
Get or set an assay of the main object or of a subset.
Unlike the other methods, assay() and assay<- name the
subset with i, not with subsetName.
assay(x, i) returns:
a main assay, when i is its name, as for the class
x extends;
the subset's rows and columns of the assay it was made from,
when i is a subset name. If the subset, or a subset it was
made from, stored its own assay of that name with
unlink, that assay is returned instead;
an assay as a subset sees it, when i is
"subset/assay", or a subset name with
subsetAssayName = "assay": either one stored in the subset,
or one linked from its parent, cut to the subset's rows and
columns.
assay(x, i) <- value stores value in a subset when
i is "subset/assay", or a subset name with
subsetAssayName, as setSubsetAssay does. A name
with a "/" is read as "subset/assay" unless it is the
name of a main assay, and a subset name without
subsetAssayName is an error. Any other name stores a main
assay.
## S4 method for signature 'SubsetRangedSummarizedExperiment,character' assay(x, i, withDimnames = TRUE, ...) ## S4 replacement method for signature 'SubsetRangedSummarizedExperiment,character' assay(x, i, withDimnames = TRUE, ...) <- value ## S4 method for signature 'SubsetSingleCellExperiment,character' assay(x, i, withDimnames = TRUE, ...) ## S4 replacement method for signature 'SubsetSingleCellExperiment,character' assay(x, i, withDimnames = TRUE, ...) <- value ## S4 method for signature 'SubsetSummarizedExperiment,character' assay(x, i, withDimnames = TRUE, ...) ## S4 replacement method for signature 'SubsetSummarizedExperiment,character' assay(x, i, withDimnames = TRUE, ...) <- value ## S4 method for signature 'SubsetSpatialExperiment,character' assay(x, i, withDimnames = TRUE, ...) ## S4 replacement method for signature 'SubsetSpatialExperiment,character' assay(x, i, withDimnames = TRUE, ...) <- value ## S4 method for signature 'SubsetTreeSummarizedExperiment,character' assay(x, i, withDimnames = TRUE, ...) ## S4 replacement method for signature 'SubsetTreeSummarizedExperiment,character' assay(x, i, withDimnames = TRUE, ...) <- value## S4 method for signature 'SubsetRangedSummarizedExperiment,character' assay(x, i, withDimnames = TRUE, ...) ## S4 replacement method for signature 'SubsetRangedSummarizedExperiment,character' assay(x, i, withDimnames = TRUE, ...) <- value ## S4 method for signature 'SubsetSingleCellExperiment,character' assay(x, i, withDimnames = TRUE, ...) ## S4 replacement method for signature 'SubsetSingleCellExperiment,character' assay(x, i, withDimnames = TRUE, ...) <- value ## S4 method for signature 'SubsetSummarizedExperiment,character' assay(x, i, withDimnames = TRUE, ...) ## S4 replacement method for signature 'SubsetSummarizedExperiment,character' assay(x, i, withDimnames = TRUE, ...) <- value ## S4 method for signature 'SubsetSpatialExperiment,character' assay(x, i, withDimnames = TRUE, ...) ## S4 replacement method for signature 'SubsetSpatialExperiment,character' assay(x, i, withDimnames = TRUE, ...) <- value ## S4 method for signature 'SubsetTreeSummarizedExperiment,character' assay(x, i, withDimnames = TRUE, ...) ## S4 replacement method for signature 'SubsetTreeSummarizedExperiment,character' assay(x, i, withDimnames = TRUE, ...) <- value
x |
An |
i |
|
withDimnames |
|
... |
For a main assay, other arguments are passed on to the method of the
class |
value |
A matrix-like assay with the main object's dimensions, or, to store it in a subset, the subset's. |
assay() returns a matrix-like assay. assay<-
returns x with the assay stored.
getSubsetAssay, setSubsetAssay,
assay
# an object with 10 genes and 20 cells set.seed(1) counts <- matrix(rpois(200, lambda = 5), nrow = 10) rownames(counts) <- paste0("gene", 1:10) colnames(counts) <- paste0("cell", 1:20) es <- ExperimentSubset(list(counts = counts)) # a subset of the first 5 genes and the first 8 cells es <- createSubset(es, subsetName = "first", rows = 1:5, cols = 1:8) # the subset's 5 x 8 part of the counts firstCounts <- assay(es, "first") # store a new assay in the subset assay(es, "first", subsetAssayName = "logcounts") <- log1p(firstCounts) # read it back assay(es, "first/logcounts")# an object with 10 genes and 20 cells set.seed(1) counts <- matrix(rpois(200, lambda = 5), nrow = 10) rownames(counts) <- paste0("gene", 1:10) colnames(counts) <- paste0("cell", 1:20) es <- ExperimentSubset(list(counts = counts)) # a subset of the first 5 genes and the first 8 cells es <- createSubset(es, subsetName = "first", rows = 1:5, cols = 1:8) # the subset's 5 x 8 part of the counts firstCounts <- assay(es, "first") # store a new assay in the subset assay(es, "first", subsetAssayName = "logcounts") <- log1p(firstCounts) # read it back assay(es, "first/logcounts")
A virtual class that the five Subset* classes extend:
SubsetSummarizedExperiment,
SubsetRangedSummarizedExperiment,
SubsetSingleCellExperiment,
SubsetTreeSummarizedExperiment and
SubsetSpatialExperiment. Use
is(x, "ExperimentSubset") to test whether x is an
ExperimentSubset object, whichever class it extends. A
SubsetSpatialExperiment, for example, is not a
SubsetSingleCellExperiment, though it extends
SingleCellExperiment.
The class is virtual, so there are no objects of the class itself. Create
an ExperimentSubset object with ExperimentSubset().
# simulate counts for 10 genes in 20 spots set.seed(1) values <- rpois(200, lambda = 5) counts <- matrix(values, nrow = 10) rownames(counts) <- paste0("gene", 1:10) colnames(counts) <- paste0("spot", 1:20) # make a SpatialExperiment from the counts spe <- SpatialExperiment(assays = list(counts = counts)) # convert it to an ExperimentSubset object es <- ExperimentSubset(spe) # es is an ExperimentSubset: TRUE is(es, "ExperimentSubset") # but not a SubsetSingleCellExperiment, though it extends # SingleCellExperiment: FALSE is(es, "SubsetSingleCellExperiment") # the SpatialExperiment it was made from is not an ExperimentSubset: FALSE is(spe, "ExperimentSubset")# simulate counts for 10 genes in 20 spots set.seed(1) values <- rpois(200, lambda = 5) counts <- matrix(values, nrow = 10) rownames(counts) <- paste0("gene", 1:10) colnames(counts) <- paste0("spot", 1:20) # make a SpatialExperiment from the counts spe <- SpatialExperiment(assays = list(counts = counts)) # convert it to an ExperimentSubset object es <- ExperimentSubset(spe) # es is an ExperimentSubset: TRUE is(es, "ExperimentSubset") # but not a SubsetSingleCellExperiment, though it extends # SingleCellExperiment: FALSE is(es, "SubsetSingleCellExperiment") # the SpatialExperiment it was made from is not an ExperimentSubset: FALSE is(spe, "ExperimentSubset")
cbind(...) and rbind(...) combine objects as
for the class they extend, and keep the subsets of every object, with
their own assays, rowData, colData, reducedDims and altExps. Subsets
of the second and later objects are moved to where that object's
columns (for cbind) or rows (for rbind) are in the
result. Subset names must be unique across the objects, and
differ from the assay names of all of them.
combineCols(x, ...) and combineRows(x, ...) combine
objects whose rows (for combineCols) or columns (for
combineRows) differ, as for the class they extend: the result
has all of the rows (or columns), matched by name, and fills the
gaps. They keep the subsets of every object too, matching each
subset's rows (or columns) by name to the result's, or by position
with use.names = FALSE.
## S4 method for signature 'SubsetRangedSummarizedExperiment' cbind(..., deparse.level = 1) ## S4 method for signature 'SubsetRangedSummarizedExperiment' rbind(..., deparse.level = 1) ## S4 method for signature 'SubsetRangedSummarizedExperiment' combineCols(x, ..., delayed = TRUE, fill = NA, use.names = TRUE) ## S4 method for signature 'SubsetRangedSummarizedExperiment' combineRows(x, ..., delayed = TRUE, fill = NA, use.names = TRUE) ## S4 method for signature 'SubsetSingleCellExperiment' cbind(..., deparse.level = 1) ## S4 method for signature 'SubsetSingleCellExperiment' rbind(..., deparse.level = 1) ## S4 method for signature 'SubsetSingleCellExperiment' combineCols(x, ..., delayed = TRUE, fill = NA, use.names = TRUE) ## S4 method for signature 'SubsetSingleCellExperiment' combineRows(x, ..., delayed = TRUE, fill = NA, use.names = TRUE) ## S4 method for signature 'SubsetSummarizedExperiment' cbind(..., deparse.level = 1) ## S4 method for signature 'SubsetSummarizedExperiment' rbind(..., deparse.level = 1) ## S4 method for signature 'SubsetSummarizedExperiment' combineCols(x, ..., delayed = TRUE, fill = NA, use.names = TRUE) ## S4 method for signature 'SubsetSummarizedExperiment' combineRows(x, ..., delayed = TRUE, fill = NA, use.names = TRUE) ## S4 method for signature 'SubsetSpatialExperiment' cbind(..., deparse.level = 1) ## S4 method for signature 'SubsetSpatialExperiment' rbind(..., deparse.level = 1) ## S4 method for signature 'SubsetSpatialExperiment' combineCols(x, ..., delayed = TRUE, fill = NA, use.names = TRUE) ## S4 method for signature 'SubsetSpatialExperiment' combineRows(x, ..., delayed = TRUE, fill = NA, use.names = TRUE) ## S4 method for signature 'SubsetTreeSummarizedExperiment' cbind(..., deparse.level = 1) ## S4 method for signature 'SubsetTreeSummarizedExperiment' rbind(..., deparse.level = 1) ## S4 method for signature 'SubsetTreeSummarizedExperiment' combineCols(x, ..., delayed = TRUE, fill = NA, use.names = TRUE) ## S4 method for signature 'SubsetTreeSummarizedExperiment' combineRows(x, ..., delayed = TRUE, fill = NA, use.names = TRUE)## S4 method for signature 'SubsetRangedSummarizedExperiment' cbind(..., deparse.level = 1) ## S4 method for signature 'SubsetRangedSummarizedExperiment' rbind(..., deparse.level = 1) ## S4 method for signature 'SubsetRangedSummarizedExperiment' combineCols(x, ..., delayed = TRUE, fill = NA, use.names = TRUE) ## S4 method for signature 'SubsetRangedSummarizedExperiment' combineRows(x, ..., delayed = TRUE, fill = NA, use.names = TRUE) ## S4 method for signature 'SubsetSingleCellExperiment' cbind(..., deparse.level = 1) ## S4 method for signature 'SubsetSingleCellExperiment' rbind(..., deparse.level = 1) ## S4 method for signature 'SubsetSingleCellExperiment' combineCols(x, ..., delayed = TRUE, fill = NA, use.names = TRUE) ## S4 method for signature 'SubsetSingleCellExperiment' combineRows(x, ..., delayed = TRUE, fill = NA, use.names = TRUE) ## S4 method for signature 'SubsetSummarizedExperiment' cbind(..., deparse.level = 1) ## S4 method for signature 'SubsetSummarizedExperiment' rbind(..., deparse.level = 1) ## S4 method for signature 'SubsetSummarizedExperiment' combineCols(x, ..., delayed = TRUE, fill = NA, use.names = TRUE) ## S4 method for signature 'SubsetSummarizedExperiment' combineRows(x, ..., delayed = TRUE, fill = NA, use.names = TRUE) ## S4 method for signature 'SubsetSpatialExperiment' cbind(..., deparse.level = 1) ## S4 method for signature 'SubsetSpatialExperiment' rbind(..., deparse.level = 1) ## S4 method for signature 'SubsetSpatialExperiment' combineCols(x, ..., delayed = TRUE, fill = NA, use.names = TRUE) ## S4 method for signature 'SubsetSpatialExperiment' combineRows(x, ..., delayed = TRUE, fill = NA, use.names = TRUE) ## S4 method for signature 'SubsetTreeSummarizedExperiment' cbind(..., deparse.level = 1) ## S4 method for signature 'SubsetTreeSummarizedExperiment' rbind(..., deparse.level = 1) ## S4 method for signature 'SubsetTreeSummarizedExperiment' combineCols(x, ..., delayed = TRUE, fill = NA, use.names = TRUE) ## S4 method for signature 'SubsetTreeSummarizedExperiment' combineRows(x, ..., delayed = TRUE, fill = NA, use.names = TRUE)
... |
|
deparse.level |
Passed on to the method of the class the objects
extend. Default |
x |
For |
delayed, fill
|
Passed on to the method of the class the objects
extend: whether to combine assays as |
use.names |
Whether to match rows (for |
For some classes, combineCols() and combineRows()
of the class the objects extend return a different class:
combineCols() of a TreeSummarizedExperiment or
SpatialExperiment returns a SingleCellExperiment, and
combineRows() of a SingleCellExperiment,
TreeSummarizedExperiment or SpatialExperiment returns a
RangedSummarizedExperiment. The result is then the matching
ExperimentSubset class, such as
SubsetSingleCellExperiment, and each subset is converted to
that class too, so it loses what the class can't hold, as the main
object does: for example its reducedDims and altExps in a
SubsetRangedSummarizedExperiment.
combineCols() and combineRows() use the method for the
class of x only, so if x is a plain object, such as a
SingleCellExperiment, the result is a plain object without
subsets. Convert it with ExperimentSubset() first.
For cbind and rbind, an object of the same class
as the objects in .... For combineCols and
combineRows, the ExperimentSubset class matching the
result of the method of the class x extends; see Details.
# two objects with the same 10 genes and 20 cells each set.seed(1) counts1 <- matrix(rpois(200, lambda = 5), nrow = 10) rownames(counts1) <- paste0("gene", 1:10) colnames(counts1) <- paste0("cellA", 1:20) counts2 <- matrix(rpois(200, lambda = 5), nrow = 10) rownames(counts2) <- paste0("gene", 1:10) colnames(counts2) <- paste0("cellB", 1:20) es1 <- ExperimentSubset(list(counts = counts1)) es2 <- ExperimentSubset(list(counts = counts2)) # a subset in each object es1 <- createSubset(es1, subsetName = "firstA", rows = 1:5, cols = 1:8) es2 <- createSubset(es2, subsetName = "firstB", rows = 1:5, cols = 1:8) # combine the cells of both objects esBoth <- cbind(es1, es2) # both subsets are kept subsetNames(esBoth) subsetColnames(esBoth, subsetName = "firstB") # a third object, with genes 6 to 10 and 5 genes the others don't have counts3 <- matrix(rpois(200, lambda = 5), nrow = 10) rownames(counts3) <- paste0("gene", 6:15) colnames(counts3) <- paste0("cellC", 1:20) es3 <- ExperimentSubset(list(counts = counts3)) # a subset of the genes only the third object has es3 <- createSubset(es3, subsetName = "newGenes", rows = 6:10) # combine the cells, keeping the genes of both; the gaps are NA esAll <- combineCols(es1, es3) dim(esAll) # the subsets of both objects are kept subsetNames(esAll) # the new subset keeps its genes subsetRownames(esAll, subsetName = "newGenes")# two objects with the same 10 genes and 20 cells each set.seed(1) counts1 <- matrix(rpois(200, lambda = 5), nrow = 10) rownames(counts1) <- paste0("gene", 1:10) colnames(counts1) <- paste0("cellA", 1:20) counts2 <- matrix(rpois(200, lambda = 5), nrow = 10) rownames(counts2) <- paste0("gene", 1:10) colnames(counts2) <- paste0("cellB", 1:20) es1 <- ExperimentSubset(list(counts = counts1)) es2 <- ExperimentSubset(list(counts = counts2)) # a subset in each object es1 <- createSubset(es1, subsetName = "firstA", rows = 1:5, cols = 1:8) es2 <- createSubset(es2, subsetName = "firstB", rows = 1:5, cols = 1:8) # combine the cells of both objects esBoth <- cbind(es1, es2) # both subsets are kept subsetNames(esBoth) subsetColnames(esBoth, subsetName = "firstB") # a third object, with genes 6 to 10 and 5 genes the others don't have counts3 <- matrix(rpois(200, lambda = 5), nrow = 10) rownames(counts3) <- paste0("gene", 6:15) colnames(counts3) <- paste0("cellC", 1:20) es3 <- ExperimentSubset(list(counts = counts3)) # a subset of the genes only the third object has es3 <- createSubset(es3, subsetName = "newGenes", rows = 6:10) # combine the cells, keeping the genes of both; the gaps are NA esAll <- combineCols(es1, es3) dim(esAll) # the subsets of both objects are kept subsetNames(esAll) # the new subset keeps its genes subsetRownames(esAll, subsetName = "newGenes")
Get or set the metadata list of a subset by naming
it with subsetName. Without subsetName, metadata()
and metadata<- act on the main object, as for the class
x extends.
## S4 method for signature 'SubsetRangedSummarizedExperiment' metadata(x, ...) ## S4 replacement method for signature 'SubsetRangedSummarizedExperiment' metadata(x, ...) <- value ## S4 method for signature 'SubsetSingleCellExperiment' metadata(x, ...) ## S4 replacement method for signature 'SubsetSingleCellExperiment' metadata(x, ...) <- value ## S4 method for signature 'SubsetSummarizedExperiment' metadata(x, ...) ## S4 replacement method for signature 'SubsetSummarizedExperiment' metadata(x, ...) <- value ## S4 method for signature 'SubsetSpatialExperiment' metadata(x, ...) ## S4 replacement method for signature 'SubsetSpatialExperiment' metadata(x, ...) <- value ## S4 method for signature 'SubsetTreeSummarizedExperiment' metadata(x, ...) ## S4 replacement method for signature 'SubsetTreeSummarizedExperiment' metadata(x, ...) <- value## S4 method for signature 'SubsetRangedSummarizedExperiment' metadata(x, ...) ## S4 replacement method for signature 'SubsetRangedSummarizedExperiment' metadata(x, ...) <- value ## S4 method for signature 'SubsetSingleCellExperiment' metadata(x, ...) ## S4 replacement method for signature 'SubsetSingleCellExperiment' metadata(x, ...) <- value ## S4 method for signature 'SubsetSummarizedExperiment' metadata(x, ...) ## S4 replacement method for signature 'SubsetSummarizedExperiment' metadata(x, ...) <- value ## S4 method for signature 'SubsetSpatialExperiment' metadata(x, ...) ## S4 replacement method for signature 'SubsetSpatialExperiment' metadata(x, ...) <- value ## S4 method for signature 'SubsetTreeSummarizedExperiment' metadata(x, ...) ## S4 replacement method for signature 'SubsetTreeSummarizedExperiment' metadata(x, ...) <- value
x |
An |
... |
Without |
value |
A |
metadata() returns a list. metadata<-
returns x with the metadata set.
# an object with 10 genes and 20 cells set.seed(1) counts <- matrix(rpois(200, lambda = 5), nrow = 10) rownames(counts) <- paste0("gene", 1:10) colnames(counts) <- paste0("cell", 1:20) es <- ExperimentSubset(list(counts = counts)) # a subset of the first 5 genes and the first 8 cells es <- createSubset(es, subsetName = "first", rows = 1:5, cols = 1:8) # store a note in the subset's metadata metadata(es, subsetName = "first") <- list(note = "the first 8 cells") # read it back metadata(es, subsetName = "first") # the main object's metadata is unchanged metadata(es)# an object with 10 genes and 20 cells set.seed(1) counts <- matrix(rpois(200, lambda = 5), nrow = 10) rownames(counts) <- paste0("gene", 1:10) colnames(counts) <- paste0("cell", 1:20) es <- ExperimentSubset(list(counts = counts)) # a subset of the first 5 genes and the first 8 cells es <- createSubset(es, subsetName = "first", rows = 1:5, cols = 1:8) # store a note in the subset's metadata metadata(es, subsetName = "first") <- list(note = "the first 8 cells") # read it back metadata(es, subsetName = "first") # the main object's metadata is unchanged metadata(es)
Get or set the reduced dimensions, such as a PCA or UMAP,
of a subset by naming it with subsetName. Without
subsetName, these methods act on the main object, as for
SingleCellExperiment. They exist for the classes that extend
SingleCellExperiment: SubsetSingleCellExperiment,
SubsetSpatialExperiment and SubsetTreeSummarizedExperiment.
reducedDimNames and reducedDimNames<-
have their own pages.
## S4 method for signature 'SubsetSingleCellExperiment,character' reducedDim(x, type, ...) ## S4 method for signature 'SubsetSingleCellExperiment,missing' reducedDim(x, type, ...) ## S4 method for signature 'SubsetSingleCellExperiment,numeric' reducedDim(x, type, ...) ## S4 replacement method for signature 'SubsetSingleCellExperiment,character' reducedDim(x, type, withDimnames = TRUE, ...) <- value ## S4 replacement method for signature 'SubsetSingleCellExperiment,missing' reducedDim(x, type, withDimnames = TRUE, ...) <- value ## S4 replacement method for signature 'SubsetSingleCellExperiment,numeric' reducedDim(x, type, withDimnames = TRUE, ...) <- value ## S4 method for signature 'SubsetSingleCellExperiment' reducedDims(x, ...) ## S4 replacement method for signature 'SubsetSingleCellExperiment' reducedDims(x, withDimnames = TRUE, ...) <- value ## S4 method for signature 'SubsetSpatialExperiment,character' reducedDim(x, type, ...) ## S4 method for signature 'SubsetSpatialExperiment,missing' reducedDim(x, type, ...) ## S4 method for signature 'SubsetSpatialExperiment,numeric' reducedDim(x, type, ...) ## S4 replacement method for signature 'SubsetSpatialExperiment,character' reducedDim(x, type, withDimnames = TRUE, ...) <- value ## S4 replacement method for signature 'SubsetSpatialExperiment,missing' reducedDim(x, type, withDimnames = TRUE, ...) <- value ## S4 replacement method for signature 'SubsetSpatialExperiment,numeric' reducedDim(x, type, withDimnames = TRUE, ...) <- value ## S4 method for signature 'SubsetSpatialExperiment' reducedDims(x, ...) ## S4 replacement method for signature 'SubsetSpatialExperiment' reducedDims(x, withDimnames = TRUE, ...) <- value ## S4 method for signature 'SubsetTreeSummarizedExperiment,character' reducedDim(x, type, ...) ## S4 method for signature 'SubsetTreeSummarizedExperiment,missing' reducedDim(x, type, ...) ## S4 method for signature 'SubsetTreeSummarizedExperiment,numeric' reducedDim(x, type, ...) ## S4 replacement method for signature 'SubsetTreeSummarizedExperiment,character' reducedDim(x, type, withDimnames = TRUE, ...) <- value ## S4 replacement method for signature 'SubsetTreeSummarizedExperiment,missing' reducedDim(x, type, withDimnames = TRUE, ...) <- value ## S4 replacement method for signature 'SubsetTreeSummarizedExperiment,numeric' reducedDim(x, type, withDimnames = TRUE, ...) <- value ## S4 method for signature 'SubsetTreeSummarizedExperiment' reducedDims(x, ...) ## S4 replacement method for signature 'SubsetTreeSummarizedExperiment' reducedDims(x, withDimnames = TRUE, ...) <- value## S4 method for signature 'SubsetSingleCellExperiment,character' reducedDim(x, type, ...) ## S4 method for signature 'SubsetSingleCellExperiment,missing' reducedDim(x, type, ...) ## S4 method for signature 'SubsetSingleCellExperiment,numeric' reducedDim(x, type, ...) ## S4 replacement method for signature 'SubsetSingleCellExperiment,character' reducedDim(x, type, withDimnames = TRUE, ...) <- value ## S4 replacement method for signature 'SubsetSingleCellExperiment,missing' reducedDim(x, type, withDimnames = TRUE, ...) <- value ## S4 replacement method for signature 'SubsetSingleCellExperiment,numeric' reducedDim(x, type, withDimnames = TRUE, ...) <- value ## S4 method for signature 'SubsetSingleCellExperiment' reducedDims(x, ...) ## S4 replacement method for signature 'SubsetSingleCellExperiment' reducedDims(x, withDimnames = TRUE, ...) <- value ## S4 method for signature 'SubsetSpatialExperiment,character' reducedDim(x, type, ...) ## S4 method for signature 'SubsetSpatialExperiment,missing' reducedDim(x, type, ...) ## S4 method for signature 'SubsetSpatialExperiment,numeric' reducedDim(x, type, ...) ## S4 replacement method for signature 'SubsetSpatialExperiment,character' reducedDim(x, type, withDimnames = TRUE, ...) <- value ## S4 replacement method for signature 'SubsetSpatialExperiment,missing' reducedDim(x, type, withDimnames = TRUE, ...) <- value ## S4 replacement method for signature 'SubsetSpatialExperiment,numeric' reducedDim(x, type, withDimnames = TRUE, ...) <- value ## S4 method for signature 'SubsetSpatialExperiment' reducedDims(x, ...) ## S4 replacement method for signature 'SubsetSpatialExperiment' reducedDims(x, withDimnames = TRUE, ...) <- value ## S4 method for signature 'SubsetTreeSummarizedExperiment,character' reducedDim(x, type, ...) ## S4 method for signature 'SubsetTreeSummarizedExperiment,missing' reducedDim(x, type, ...) ## S4 method for signature 'SubsetTreeSummarizedExperiment,numeric' reducedDim(x, type, ...) ## S4 replacement method for signature 'SubsetTreeSummarizedExperiment,character' reducedDim(x, type, withDimnames = TRUE, ...) <- value ## S4 replacement method for signature 'SubsetTreeSummarizedExperiment,missing' reducedDim(x, type, withDimnames = TRUE, ...) <- value ## S4 replacement method for signature 'SubsetTreeSummarizedExperiment,numeric' reducedDim(x, type, withDimnames = TRUE, ...) <- value ## S4 method for signature 'SubsetTreeSummarizedExperiment' reducedDims(x, ...) ## S4 replacement method for signature 'SubsetTreeSummarizedExperiment' reducedDims(x, withDimnames = TRUE, ...) <- value
x |
An |
type |
|
... |
Other arguments are passed on to the |
withDimnames |
|
value |
For |
reducedDim() returns a matrix and reducedDims() a
list of them. reducedDim<- and reducedDims<- return
x with the reduced dimensions stored.
# an object with 10 genes and 20 cells set.seed(1) counts <- matrix(rpois(200, lambda = 5), nrow = 10) rownames(counts) <- paste0("gene", 1:10) colnames(counts) <- paste0("cell", 1:20) es <- ExperimentSubset(list(counts = counts)) # a subset of the first 5 genes and the first 8 cells es <- createSubset(es, subsetName = "first", rows = 1:5, cols = 1:8) # a 2-dimensional embedding of the subset's 8 cells embedding <- matrix(rnorm(16), ncol = 2) # store it in the subset reducedDim(es, "PCA", subsetName = "first") <- embedding # read it back reducedDim(es, "PCA", subsetName = "first") # all of the subset's reduced dimensions reducedDims(es, subsetName = "first") # replace them all with a list of two reducedDims(es, subsetName = "first") <- list(PCA = embedding, UMAP = embedding * 2) reducedDimNames(es, subsetName = "first")# an object with 10 genes and 20 cells set.seed(1) counts <- matrix(rpois(200, lambda = 5), nrow = 10) rownames(counts) <- paste0("gene", 1:10) colnames(counts) <- paste0("cell", 1:20) es <- ExperimentSubset(list(counts = counts)) # a subset of the first 5 genes and the first 8 cells es <- createSubset(es, subsetName = "first", rows = 1:5, cols = 1:8) # a 2-dimensional embedding of the subset's 8 cells embedding <- matrix(rnorm(16), ncol = 2) # store it in the subset reducedDim(es, "PCA", subsetName = "first") <- embedding # read it back reducedDim(es, "PCA", subsetName = "first") # all of the subset's reduced dimensions reducedDims(es, subsetName = "first") # replace them all with a list of two reducedDims(es, subsetName = "first") <- list(PCA = embedding, UMAP = embedding * 2) reducedDimNames(es, subsetName = "first")
Get or set the rowData or colData of a subset
by naming it with subsetName. Without subsetName, these
methods act on the main object, as for the class x extends.
A subset stores only its own columns. With parentRowData = TRUE
or parentColData = TRUE, the main object's columns come first,
for the subset's rows or columns, and a subset's own column hides the
main object's column of the same name, with a message if their values
differ. When setting a subset's data, columns that came from the main
object, in data read with parentRowData = TRUE or
parentColData = TRUE, are left out with a message, so only the
subset's own are stored. To add one column, use
colData(x, subsetName = "name")$column <- values.
## S4 method for signature 'SubsetRangedSummarizedExperiment' rowData(x, use.names = TRUE, ...) ## S4 method for signature 'SubsetRangedSummarizedExperiment' colData(x, ...) ## S4 replacement method for signature 'SubsetRangedSummarizedExperiment' rowData(x, ...) <- value ## S4 replacement method for signature 'SubsetRangedSummarizedExperiment,DataFrame' colData(x, ...) <- value ## S4 replacement method for signature 'SubsetRangedSummarizedExperiment,NULL' colData(x, ...) <- value ## S4 replacement method for signature 'SubsetRangedSummarizedExperiment,data.frame' colData(x, ...) <- value ## S4 replacement method for signature 'SubsetRangedSummarizedExperiment,ANY' colData(x, ...) <- value ## S4 method for signature 'SubsetSingleCellExperiment' rowData(x, use.names = TRUE, ...) ## S4 method for signature 'SubsetSingleCellExperiment' colData(x, ...) ## S4 replacement method for signature 'SubsetSingleCellExperiment' rowData(x, ...) <- value ## S4 replacement method for signature 'SubsetSingleCellExperiment,DataFrame' colData(x, ...) <- value ## S4 replacement method for signature 'SubsetSingleCellExperiment,NULL' colData(x, ...) <- value ## S4 replacement method for signature 'SubsetSingleCellExperiment,data.frame' colData(x, ...) <- value ## S4 replacement method for signature 'SubsetSingleCellExperiment,ANY' colData(x, ...) <- value ## S4 method for signature 'SubsetSummarizedExperiment' rowData(x, use.names = TRUE, ...) ## S4 method for signature 'SubsetSummarizedExperiment' colData(x, ...) ## S4 replacement method for signature 'SubsetSummarizedExperiment' rowData(x, ...) <- value ## S4 replacement method for signature 'SubsetSummarizedExperiment,DataFrame' colData(x, ...) <- value ## S4 replacement method for signature 'SubsetSummarizedExperiment,NULL' colData(x, ...) <- value ## S4 replacement method for signature 'SubsetSummarizedExperiment,data.frame' colData(x, ...) <- value ## S4 replacement method for signature 'SubsetSummarizedExperiment,ANY' colData(x, ...) <- value ## S4 method for signature 'SubsetSpatialExperiment' rowData(x, use.names = TRUE, ...) ## S4 method for signature 'SubsetSpatialExperiment' colData(x, ...) ## S4 replacement method for signature 'SubsetSpatialExperiment' rowData(x, ...) <- value ## S4 replacement method for signature 'SubsetSpatialExperiment,DataFrame' colData(x, ...) <- value ## S4 replacement method for signature 'SubsetSpatialExperiment,NULL' colData(x, ...) <- value ## S4 replacement method for signature 'SubsetSpatialExperiment,data.frame' colData(x, ...) <- value ## S4 replacement method for signature 'SubsetSpatialExperiment,ANY' colData(x, ...) <- value ## S4 method for signature 'SubsetTreeSummarizedExperiment' rowData(x, use.names = TRUE, ...) ## S4 method for signature 'SubsetTreeSummarizedExperiment' colData(x, ...) ## S4 replacement method for signature 'SubsetTreeSummarizedExperiment' rowData(x, ...) <- value ## S4 replacement method for signature 'SubsetTreeSummarizedExperiment,DataFrame' colData(x, ...) <- value ## S4 replacement method for signature 'SubsetTreeSummarizedExperiment,NULL' colData(x, ...) <- value ## S4 replacement method for signature 'SubsetTreeSummarizedExperiment,data.frame' colData(x, ...) <- value ## S4 replacement method for signature 'SubsetTreeSummarizedExperiment,ANY' colData(x, ...) <- value## S4 method for signature 'SubsetRangedSummarizedExperiment' rowData(x, use.names = TRUE, ...) ## S4 method for signature 'SubsetRangedSummarizedExperiment' colData(x, ...) ## S4 replacement method for signature 'SubsetRangedSummarizedExperiment' rowData(x, ...) <- value ## S4 replacement method for signature 'SubsetRangedSummarizedExperiment,DataFrame' colData(x, ...) <- value ## S4 replacement method for signature 'SubsetRangedSummarizedExperiment,NULL' colData(x, ...) <- value ## S4 replacement method for signature 'SubsetRangedSummarizedExperiment,data.frame' colData(x, ...) <- value ## S4 replacement method for signature 'SubsetRangedSummarizedExperiment,ANY' colData(x, ...) <- value ## S4 method for signature 'SubsetSingleCellExperiment' rowData(x, use.names = TRUE, ...) ## S4 method for signature 'SubsetSingleCellExperiment' colData(x, ...) ## S4 replacement method for signature 'SubsetSingleCellExperiment' rowData(x, ...) <- value ## S4 replacement method for signature 'SubsetSingleCellExperiment,DataFrame' colData(x, ...) <- value ## S4 replacement method for signature 'SubsetSingleCellExperiment,NULL' colData(x, ...) <- value ## S4 replacement method for signature 'SubsetSingleCellExperiment,data.frame' colData(x, ...) <- value ## S4 replacement method for signature 'SubsetSingleCellExperiment,ANY' colData(x, ...) <- value ## S4 method for signature 'SubsetSummarizedExperiment' rowData(x, use.names = TRUE, ...) ## S4 method for signature 'SubsetSummarizedExperiment' colData(x, ...) ## S4 replacement method for signature 'SubsetSummarizedExperiment' rowData(x, ...) <- value ## S4 replacement method for signature 'SubsetSummarizedExperiment,DataFrame' colData(x, ...) <- value ## S4 replacement method for signature 'SubsetSummarizedExperiment,NULL' colData(x, ...) <- value ## S4 replacement method for signature 'SubsetSummarizedExperiment,data.frame' colData(x, ...) <- value ## S4 replacement method for signature 'SubsetSummarizedExperiment,ANY' colData(x, ...) <- value ## S4 method for signature 'SubsetSpatialExperiment' rowData(x, use.names = TRUE, ...) ## S4 method for signature 'SubsetSpatialExperiment' colData(x, ...) ## S4 replacement method for signature 'SubsetSpatialExperiment' rowData(x, ...) <- value ## S4 replacement method for signature 'SubsetSpatialExperiment,DataFrame' colData(x, ...) <- value ## S4 replacement method for signature 'SubsetSpatialExperiment,NULL' colData(x, ...) <- value ## S4 replacement method for signature 'SubsetSpatialExperiment,data.frame' colData(x, ...) <- value ## S4 replacement method for signature 'SubsetSpatialExperiment,ANY' colData(x, ...) <- value ## S4 method for signature 'SubsetTreeSummarizedExperiment' rowData(x, use.names = TRUE, ...) ## S4 method for signature 'SubsetTreeSummarizedExperiment' colData(x, ...) ## S4 replacement method for signature 'SubsetTreeSummarizedExperiment' rowData(x, ...) <- value ## S4 replacement method for signature 'SubsetTreeSummarizedExperiment,DataFrame' colData(x, ...) <- value ## S4 replacement method for signature 'SubsetTreeSummarizedExperiment,NULL' colData(x, ...) <- value ## S4 replacement method for signature 'SubsetTreeSummarizedExperiment,data.frame' colData(x, ...) <- value ## S4 replacement method for signature 'SubsetTreeSummarizedExperiment,ANY' colData(x, ...) <- value
x |
An |
use.names |
|
... |
Without |
value |
A |
rowData() and colData() return a DataFrame.
The setters return x with the data set.
subsetRowData, subsetColData,
rowData,
colData
# an object with 10 genes and 20 cells set.seed(1) counts <- matrix(rpois(200, lambda = 5), nrow = 10) rownames(counts) <- paste0("gene", 1:10) colnames(counts) <- paste0("cell", 1:20) es <- ExperimentSubset(list(counts = counts)) # a sample label for every cell of the main object es$sample <- rep(c("A", "B"), each = 10) # a subset of the first 5 genes and the first 8 cells es <- createSubset(es, subsetName = "first", rows = 1:5, cols = 1:8) # a cluster label for each of the subset's 8 cells colData(es, subsetName = "first")$cluster <- rep(1:2, times = 4) # the subset's own columns colData(es, subsetName = "first") # with the main object's columns first colData(es, subsetName = "first", parentColData = TRUE) # the subset's rowData, which has no columns yet rowData(es, subsetName = "first")# an object with 10 genes and 20 cells set.seed(1) counts <- matrix(rpois(200, lambda = 5), nrow = 10) rownames(counts) <- paste0("gene", 1:10) colnames(counts) <- paste0("cell", 1:20) es <- ExperimentSubset(list(counts = counts)) # a sample label for every cell of the main object es$sample <- rep(c("A", "B"), each = 10) # a subset of the first 5 genes and the first 8 cells es <- createSubset(es, subsetName = "first", rows = 1:5, cols = 1:8) # a cluster label for each of the subset's 8 cells colData(es, subsetName = "first")$cluster <- rep(1:2, times = 4) # the subset's own columns colData(es, subsetName = "first") # with the main object's columns first colData(es, subsetName = "first", parentColData = TRUE) # the subset's rowData, which has no columns yet rowData(es, subsetName = "first")
x[i, j] keeps rows i and columns j of
the main object, as for the class it extends, and also updates every
subset. Each subset keeps the rows and columns that remain, in its own
order, together with its own assays, rowData, colData, reducedDims and
altExps. A subset none of whose rows or columns remain is kept with no
rows or no columns. If i or j repeats a row or column,
subsets keep one copy of it.
## S4 method for signature 'SubsetRangedSummarizedExperiment,ANY,ANY,ANY' x[i, j, ..., drop = TRUE] ## S4 method for signature 'SubsetSingleCellExperiment,ANY,ANY,ANY' x[i, j, ..., drop = TRUE] ## S4 method for signature 'SubsetSummarizedExperiment,ANY,ANY,ANY' x[i, j, ..., drop = TRUE] ## S4 method for signature 'SubsetSpatialExperiment,ANY,ANY,ANY' x[i, j, ..., drop = TRUE] ## S4 method for signature 'SubsetTreeSummarizedExperiment,ANY,ANY,ANY' x[i, j, ..., drop = TRUE]## S4 method for signature 'SubsetRangedSummarizedExperiment,ANY,ANY,ANY' x[i, j, ..., drop = TRUE] ## S4 method for signature 'SubsetSingleCellExperiment,ANY,ANY,ANY' x[i, j, ..., drop = TRUE] ## S4 method for signature 'SubsetSummarizedExperiment,ANY,ANY,ANY' x[i, j, ..., drop = TRUE] ## S4 method for signature 'SubsetSpatialExperiment,ANY,ANY,ANY' x[i, j, ..., drop = TRUE] ## S4 method for signature 'SubsetTreeSummarizedExperiment,ANY,ANY,ANY' x[i, j, ..., drop = TRUE]
x |
An |
i, j
|
Rows and columns to keep: positions, names or logical vectors,
as for the class |
... |
Passed on to the method of the class |
drop |
Ignored, as for |
An object of the same class as x.
# an object with 10 genes and 20 cells set.seed(1) counts <- matrix(rpois(200, lambda = 5), nrow = 10) rownames(counts) <- paste0("gene", 1:10) colnames(counts) <- paste0("cell", 1:20) es <- ExperimentSubset(list(counts = counts)) # a subset of the first 5 genes and the first 8 cells es <- createSubset(es, subsetName = "first", rows = 1:5, cols = 1:8) # keep genes 3 to 10 of the main object esSmaller <- es[3:10, ] # the subset keeps genes 3 to 5 subsetRownames(esSmaller, subsetName = "first")# an object with 10 genes and 20 cells set.seed(1) counts <- matrix(rpois(200, lambda = 5), nrow = 10) rownames(counts) <- paste0("gene", 1:10) colnames(counts) <- paste0("cell", 1:20) es <- ExperimentSubset(list(counts = counts)) # a subset of the first 5 genes and the first 8 cells es <- createSubset(es, subsetName = "first", rows = 1:5, cols = 1:8) # keep genes 3 to 10 of the main object esSmaller <- es[3:10, ] # the subset keeps genes 3 to 5 subsetRownames(esSmaller, subsetName = "first")
ExperimentSubset object.Get subset assay from an ExperimentSubset object.
getSubsetAssay(x, subsetName, subsetAssayName = NULL) ## S4 method for signature 'SubsetRangedSummarizedExperiment' getSubsetAssay(x, subsetName, subsetAssayName = NULL) ## S4 method for signature 'SubsetSingleCellExperiment' getSubsetAssay(x, subsetName, subsetAssayName = NULL) ## S4 method for signature 'SubsetSummarizedExperiment' getSubsetAssay(x, subsetName, subsetAssayName = NULL) ## S4 method for signature 'SubsetSpatialExperiment' getSubsetAssay(x, subsetName, subsetAssayName = NULL) ## S4 method for signature 'SubsetTreeSummarizedExperiment' getSubsetAssay(x, subsetName, subsetAssayName = NULL)getSubsetAssay(x, subsetName, subsetAssayName = NULL) ## S4 method for signature 'SubsetRangedSummarizedExperiment' getSubsetAssay(x, subsetName, subsetAssayName = NULL) ## S4 method for signature 'SubsetSingleCellExperiment' getSubsetAssay(x, subsetName, subsetAssayName = NULL) ## S4 method for signature 'SubsetSummarizedExperiment' getSubsetAssay(x, subsetName, subsetAssayName = NULL) ## S4 method for signature 'SubsetSpatialExperiment' getSubsetAssay(x, subsetName, subsetAssayName = NULL) ## S4 method for signature 'SubsetTreeSummarizedExperiment' getSubsetAssay(x, subsetName, subsetAssayName = NULL)
x |
Input |
subsetName |
The name of the subset to fetch the assay from, or an
assay seen in a subset written as |
subsetAssayName |
|
Subset assay
data(sce_chcl, package = "scds") es <- ExperimentSubset(sce_chcl) es <- createSubset(es, "subset1", rows = c(10,11,50,56,98,99,102,105,109, 200), cols = c(20,21,40,45,90,99,100,123,166,299), parentAssay = "counts") getSubsetAssay(es, "subset1") # store a changed copy of the subset's counts inside the subset subset1Counts <- getSubsetAssay(es, "subset1") es <- setSubsetAssay(es, "subset1", subset1Counts + 1, "plusOne") getSubsetAssay(es, "subset1", subsetAssayName = "plusOne")data(sce_chcl, package = "scds") es <- ExperimentSubset(sce_chcl) es <- createSubset(es, "subset1", rows = c(10,11,50,56,98,99,102,105,109, 200), cols = c(20,21,40,45,90,99,100,123,166,299), parentAssay = "counts") getSubsetAssay(es, "subset1") # store a changed copy of the subset's counts inside the subset subset1Counts <- getSubsetAssay(es, "subset1") es <- setSubsetAssay(es, "subset1", subset1Counts + 1, "plusOne") getSubsetAssay(es, "subset1", subsetAssayName = "plusOne")
Returns a subset as an object of the main object's class
(for example a SingleCellExperiment), so that any tool written
for that class can be run on the subset. Store what the tool added with
setSubsetExperiment.
getSubsetExperiment(x, subsetName, parentData = TRUE) ## S4 method for signature 'SubsetRangedSummarizedExperiment' getSubsetExperiment(x, subsetName, parentData = TRUE) ## S4 method for signature 'SubsetSingleCellExperiment' getSubsetExperiment(x, subsetName, parentData = TRUE) ## S4 method for signature 'SubsetSummarizedExperiment' getSubsetExperiment(x, subsetName, parentData = TRUE) ## S4 method for signature 'SubsetSpatialExperiment' getSubsetExperiment(x, subsetName, parentData = TRUE) ## S4 method for signature 'SubsetTreeSummarizedExperiment' getSubsetExperiment(x, subsetName, parentData = TRUE)getSubsetExperiment(x, subsetName, parentData = TRUE) ## S4 method for signature 'SubsetRangedSummarizedExperiment' getSubsetExperiment(x, subsetName, parentData = TRUE) ## S4 method for signature 'SubsetSingleCellExperiment' getSubsetExperiment(x, subsetName, parentData = TRUE) ## S4 method for signature 'SubsetSummarizedExperiment' getSubsetExperiment(x, subsetName, parentData = TRUE) ## S4 method for signature 'SubsetSpatialExperiment' getSubsetExperiment(x, subsetName, parentData = TRUE) ## S4 method for signature 'SubsetTreeSummarizedExperiment' getSubsetExperiment(x, subsetName, parentData = TRUE)
x |
Input |
subsetName |
|
parentData |
|
An object of the main object's class with the subset's rows and
columns and row and column names. Its assays are every assay the subset
sees, its own and those linked from its parent, under their names, with
the subset's primary assay first. Its rowData and colData are the
subset's, after the main object's columns if parentData = TRUE.
Its altExps are every altExp the subset sees, its own and those linked
from the main object or a parent subset, cut to its columns (see
ExperimentSubset-altExp). Its reducedDims and metadata
are the subset's. Everything else,
such as row ranges, row and column trees, spatial coordinates, images,
colPairs and rowPairs, comes from the main object.
data(sce_chcl, package = "scds") es <- ExperimentSubset(sce_chcl) es <- createSubset(es, "subset1", rows = 1:100, cols = 1:50) subset1 <- getSubsetExperiment(es, "subset1") subset1data(sce_chcl, package = "scds") es <- ExperimentSubset(sce_chcl) es <- createSubset(es, "subset1", rows = 1:100, cols = 1:50) subset1 <- getSubsetExperiment(es, "subset1") subset1
A wrapper to the reducedDimNames from
reducedDims method with additional support for
subsets.
reducedDimNames(x, ...) ## S4 method for signature 'ANY' reducedDimNames(x, ...)reducedDimNames(x, ...) ## S4 method for signature 'ANY' reducedDimNames(x, ...)
x |
Input |
... |
Only |
The reducedDimNames from the specified subset or same as
reducedDimNames from reducedDims when
subsetName is missing.
data(sce_chcl, package = "scds") es <- ExperimentSubset(sce_chcl) es <- createSubset(es, "subset1", rows = c(1:50), cols = c(1:20), parentAssay = "counts") # two small reduced dimensions, one row per cell in the subset set.seed(1) pca1 <- matrix(rnorm(40), nrow = 20) pca2 <- matrix(rnorm(40), nrow = 20) reducedDims(es, subsetName = "subset1") <- list(PCA_1 = pca1, PCA_2 = pca2) reducedDimNames(es, subsetName = "subset1")data(sce_chcl, package = "scds") es <- ExperimentSubset(sce_chcl) es <- createSubset(es, "subset1", rows = c(1:50), cols = c(1:20), parentAssay = "counts") # two small reduced dimensions, one row per cell in the subset set.seed(1) pca1 <- matrix(rnorm(40), nrow = 20) pca2 <- matrix(rnorm(40), nrow = 20) reducedDims(es, subsetName = "subset1") <- list(PCA_1 = pca1, PCA_2 = pca2) reducedDimNames(es, subsetName = "subset1")
A wrapper to the reducedDimNames<- from
reducedDims method with additional support for
subsets.
reducedDimNames(x, subsetName) <- value ## S4 replacement method for signature 'ANY' reducedDimNames(x, subsetName) <- valuereducedDimNames(x, subsetName) <- value ## S4 replacement method for signature 'ANY' reducedDimNames(x, subsetName) <- value
x |
Input |
subsetName |
Specify the name of the subset to which the
|
value |
Input value same as |
Input object with reducedDimNames<- set.
data(sce_chcl, package = "scds") es <- ExperimentSubset(sce_chcl) es <- createSubset(es, "subset1", rows = c(1:50), cols = c(1:20), parentAssay = "counts") # two small reduced dimensions, one row per cell in the subset set.seed(1) pca1 <- matrix(rnorm(40), nrow = 20) pca2 <- matrix(rnorm(40), nrow = 20) reducedDims(es, subsetName = "subset1") <- list(PCA_1 = pca1, PCA_2 = pca2) reducedDimNames(es, subsetName = "subset1") <- c("rDim1", "rDim2")data(sce_chcl, package = "scds") es <- ExperimentSubset(sce_chcl) es <- createSubset(es, "subset1", rows = c(1:50), cols = c(1:20), parentAssay = "counts") # two small reduced dimensions, one row per cell in the subset set.seed(1) pca1 <- matrix(rnorm(40), nrow = 20) pca2 <- matrix(rnorm(40), nrow = 20) reducedDims(es, subsetName = "subset1") <- list(PCA_1 = pca1, PCA_2 = pca2) reducedDimNames(es, subsetName = "subset1") <- c("rDim1", "rDim2")
Store a new subset assay inside a specified subset in the
input ExperimentSubset object.
setSubsetAssay(x, subsetName, inputMatrix, subsetAssayName, unlink = FALSE) ## S4 method for signature 'SubsetRangedSummarizedExperiment' setSubsetAssay(x, subsetName, inputMatrix, subsetAssayName, unlink = FALSE) ## S4 method for signature 'SubsetSingleCellExperiment' setSubsetAssay(x, subsetName, inputMatrix, subsetAssayName, unlink = FALSE) ## S4 method for signature 'SubsetSummarizedExperiment' setSubsetAssay(x, subsetName, inputMatrix, subsetAssayName, unlink = FALSE) ## S4 method for signature 'SubsetSpatialExperiment' setSubsetAssay(x, subsetName, inputMatrix, subsetAssayName, unlink = FALSE) ## S4 method for signature 'SubsetTreeSummarizedExperiment' setSubsetAssay(x, subsetName, inputMatrix, subsetAssayName, unlink = FALSE)setSubsetAssay(x, subsetName, inputMatrix, subsetAssayName, unlink = FALSE) ## S4 method for signature 'SubsetRangedSummarizedExperiment' setSubsetAssay(x, subsetName, inputMatrix, subsetAssayName, unlink = FALSE) ## S4 method for signature 'SubsetSingleCellExperiment' setSubsetAssay(x, subsetName, inputMatrix, subsetAssayName, unlink = FALSE) ## S4 method for signature 'SubsetSummarizedExperiment' setSubsetAssay(x, subsetName, inputMatrix, subsetAssayName, unlink = FALSE) ## S4 method for signature 'SubsetSpatialExperiment' setSubsetAssay(x, subsetName, inputMatrix, subsetAssayName, unlink = FALSE) ## S4 method for signature 'SubsetTreeSummarizedExperiment' setSubsetAssay(x, subsetName, inputMatrix, subsetAssayName, unlink = FALSE)
x |
|
subsetName |
|
inputMatrix |
A matrix-like object (for example a |
subsetAssayName |
|
unlink |
|
Updated ExperimentSubset object with the new assay
stored inside the specified subset.
data(sce_chcl, package = "scds") es <- ExperimentSubset(sce_chcl) es <- createSubset(es, "subset1", rows = c(10,11,50,56,98,99,102,105,109, 200), cols = c(20,21,40,45,90,99,100,123,166,299), parentAssay = "counts") counts1p <- assay(es, "subset1") counts1p[,] <- counts1p[,] + 1 es <- setSubsetAssay(es, "subset1", counts1p, "scaledSubset1") esdata(sce_chcl, package = "scds") es <- ExperimentSubset(sce_chcl) es <- createSubset(es, "subset1", rows = c(10,11,50,56,98,99,102,105,109, 200), cols = c(20,21,40,45,90,99,100,123,166,299), parentAssay = "counts") counts1p <- assay(es, "subset1") counts1p[,] <- counts1p[,] + 1 es <- setSubsetAssay(es, "subset1", counts1p, "scaledSubset1") es
Stores what a tool added to an object returned by
getSubsetExperiment: new assays, rowData and colData columns,
reducedDims, altExps and metadata.
setSubsetExperiment(x, subsetName, value, unlink = FALSE) ## S4 method for signature 'SubsetRangedSummarizedExperiment' setSubsetExperiment(x, subsetName, value, unlink = FALSE) ## S4 method for signature 'SubsetSingleCellExperiment' setSubsetExperiment(x, subsetName, value, unlink = FALSE) ## S4 method for signature 'SubsetSummarizedExperiment' setSubsetExperiment(x, subsetName, value, unlink = FALSE) ## S4 method for signature 'SubsetSpatialExperiment' setSubsetExperiment(x, subsetName, value, unlink = FALSE) ## S4 method for signature 'SubsetTreeSummarizedExperiment' setSubsetExperiment(x, subsetName, value, unlink = FALSE)setSubsetExperiment(x, subsetName, value, unlink = FALSE) ## S4 method for signature 'SubsetRangedSummarizedExperiment' setSubsetExperiment(x, subsetName, value, unlink = FALSE) ## S4 method for signature 'SubsetSingleCellExperiment' setSubsetExperiment(x, subsetName, value, unlink = FALSE) ## S4 method for signature 'SubsetSummarizedExperiment' setSubsetExperiment(x, subsetName, value, unlink = FALSE) ## S4 method for signature 'SubsetSpatialExperiment' setSubsetExperiment(x, subsetName, value, unlink = FALSE) ## S4 method for signature 'SubsetTreeSummarizedExperiment' setSubsetExperiment(x, subsetName, value, unlink = FALSE)
x |
Input |
subsetName |
|
value |
An object of the main object's class (not a subclass or a
parent class) with the subset's dimensions and the subset's row and
column names, in the same order. A tool that drops rows or columns is
followed by |
unlink |
|
Updated ExperimentSubset object. Linked assays that are
in value hold the same values as what the subset sees (whatever
their dimnames, type or class) are not stored, and neither are the main
object's rowData and colData columns added by getSubsetExperiment.
altExps are stored as altExp<- stores them (see
ExperimentSubset-altExp): only the assays and data that
differ from a linked altExp, and a linked altExp missing from
value stays linked.
Everything else in value replaces the subset's own data: an own
assay, reducedDim, altExp or column that value no longer has is
removed from the subset, except an assay another subset was made from,
which is an error. Nothing else is stored: not row ranges, row and
column trees, spatial coordinates, images, colPairs,
rowPairs or mainExpName.
data(sce_chcl, package = "scds") es <- ExperimentSubset(sce_chcl) es <- createSubset(es, "subset1", rows = 1:100, cols = 1:50) subset1 <- getSubsetExperiment(es, "subset1") # add a reducedDim and a colData column to the standalone object reducedDim(subset1, "random") <- matrix(rnorm(100), nrow = 50) subset1$group <- rep(c("a", "b"), 25) # and store them in the subset es <- setSubsetExperiment(es, "subset1", subset1) reducedDimNames(es, subsetName = "subset1")data(sce_chcl, package = "scds") es <- ExperimentSubset(sce_chcl) es <- createSubset(es, "subset1", rows = 1:100, cols = 1:50) subset1 <- getSubsetExperiment(es, "subset1") # add a reducedDim and a colData column to the standalone object reducedDim(subset1, "random") <- matrix(rnorm(100), nrow = 50) subset1$group <- rep(c("a", "b"), 25) # and store them in the subset es <- setSubsetExperiment(es, "subset1", subset1) reducedDimNames(es, subsetName = "subset1")
Get the count of the total available subsets and the subset
assays inside these subsets in an ExperimentSubset object.
subsetAssayCount(x) ## S4 method for signature 'SubsetRangedSummarizedExperiment' subsetAssayCount(x) ## S4 method for signature 'SubsetSingleCellExperiment' subsetAssayCount(x) ## S4 method for signature 'SubsetSummarizedExperiment' subsetAssayCount(x) ## S4 method for signature 'SubsetSpatialExperiment' subsetAssayCount(x) ## S4 method for signature 'SubsetTreeSummarizedExperiment' subsetAssayCount(x)subsetAssayCount(x) ## S4 method for signature 'SubsetRangedSummarizedExperiment' subsetAssayCount(x) ## S4 method for signature 'SubsetSingleCellExperiment' subsetAssayCount(x) ## S4 method for signature 'SubsetSummarizedExperiment' subsetAssayCount(x) ## S4 method for signature 'SubsetSpatialExperiment' subsetAssayCount(x) ## S4 method for signature 'SubsetTreeSummarizedExperiment' subsetAssayCount(x)
x |
|
A numeric value representing the sum of the subset count and
subset assay count.
data(sce_chcl, package = "scds") es <- ExperimentSubset(sce_chcl) es <- createSubset(es, "subset1", rows = c(10,11,50,56,98,99,102,105,109, 200), cols = c(20,21,40,45,90,99,100,123,166,299), parentAssay = "counts") assay(es, "subset1", subsetAssayName = "subset1pAssay") <- assay(es, "subset1")[,] + 1 subsetAssayCount(es)data(sce_chcl, package = "scds") es <- ExperimentSubset(sce_chcl) es <- createSubset(es, "subset1", rows = c(10,11,50,56,98,99,102,105,109, 200), cols = c(20,21,40,45,90,99,100,123,166,299), parentAssay = "counts") assay(es, "subset1", subsetAssayName = "subset1pAssay") <- assay(es, "subset1")[,] + 1 subsetAssayCount(es)
Retrieves the names of all the subsets as well as the subset assays.
subsetAssayNames(x, subsetName = NULL) ## S4 method for signature 'SubsetRangedSummarizedExperiment' subsetAssayNames(x, subsetName = NULL) ## S4 method for signature 'SubsetSingleCellExperiment' subsetAssayNames(x, subsetName = NULL) ## S4 method for signature 'SubsetSummarizedExperiment' subsetAssayNames(x, subsetName = NULL) ## S4 method for signature 'SubsetSpatialExperiment' subsetAssayNames(x, subsetName = NULL) ## S4 method for signature 'SubsetTreeSummarizedExperiment' subsetAssayNames(x, subsetName = NULL)subsetAssayNames(x, subsetName = NULL) ## S4 method for signature 'SubsetRangedSummarizedExperiment' subsetAssayNames(x, subsetName = NULL) ## S4 method for signature 'SubsetSingleCellExperiment' subsetAssayNames(x, subsetName = NULL) ## S4 method for signature 'SubsetSummarizedExperiment' subsetAssayNames(x, subsetName = NULL) ## S4 method for signature 'SubsetSpatialExperiment' subsetAssayNames(x, subsetName = NULL) ## S4 method for signature 'SubsetTreeSummarizedExperiment' subsetAssayNames(x, subsetName = NULL)
x |
|
subsetName |
|
A vector containing the names of the subsets followed by
each assay stored in a subset as "subset/assay", or, with
subsetName, the names of the assays seen in that subset.
data(sce_chcl, package = "scds") es <- ExperimentSubset(sce_chcl) es <- createSubset(es, "subset1", rows = c(10,11,50,56,98,99,102,105,109, 200), cols = c(20,21,40,45,90,99,100,123,166,299), parentAssay = "counts") assay(es, "subset1", subsetAssayName = "subset1pAssay") <- assay(es, "subset1")[,] + 1 subsetAssayNames(es) subsetAssayNames(es, subsetName = "subset1")data(sce_chcl, package = "scds") es <- ExperimentSubset(sce_chcl) es <- createSubset(es, "subset1", rows = c(10,11,50,56,98,99,102,105,109, 200), cols = c(20,21,40,45,90,99,100,123,166,299), parentAssay = "counts") assay(es, "subset1", subsetAssayName = "subset1pAssay") <- assay(es, "subset1")[,] + 1 subsetAssayNames(es) subsetAssayNames(es, subsetName = "subset1")
Get colData from a subset.
Set colData to a subset.
subsetColData(x, subsetName, parentColData) subsetColData(x, subsetName) <- value ## S4 method for signature 'SubsetRangedSummarizedExperiment' subsetColData(x, subsetName, parentColData) ## S4 replacement method for signature 'SubsetRangedSummarizedExperiment' subsetColData(x, subsetName) <- value ## S4 method for signature 'SubsetSingleCellExperiment' subsetColData(x, subsetName, parentColData) ## S4 replacement method for signature 'SubsetSingleCellExperiment' subsetColData(x, subsetName) <- value ## S4 replacement method for signature 'SubsetSummarizedExperiment' subsetColData(x, subsetName) <- value ## S4 method for signature 'SubsetSummarizedExperiment' subsetColData(x, subsetName, parentColData) ## S4 method for signature 'SubsetSpatialExperiment' subsetColData(x, subsetName, parentColData) ## S4 replacement method for signature 'SubsetSpatialExperiment' subsetColData(x, subsetName) <- value ## S4 method for signature 'SubsetTreeSummarizedExperiment' subsetColData(x, subsetName, parentColData)subsetColData(x, subsetName, parentColData) subsetColData(x, subsetName) <- value ## S4 method for signature 'SubsetRangedSummarizedExperiment' subsetColData(x, subsetName, parentColData) ## S4 replacement method for signature 'SubsetRangedSummarizedExperiment' subsetColData(x, subsetName) <- value ## S4 method for signature 'SubsetSingleCellExperiment' subsetColData(x, subsetName, parentColData) ## S4 replacement method for signature 'SubsetSingleCellExperiment' subsetColData(x, subsetName) <- value ## S4 replacement method for signature 'SubsetSummarizedExperiment' subsetColData(x, subsetName) <- value ## S4 method for signature 'SubsetSummarizedExperiment' subsetColData(x, subsetName, parentColData) ## S4 method for signature 'SubsetSpatialExperiment' subsetColData(x, subsetName, parentColData) ## S4 replacement method for signature 'SubsetSpatialExperiment' subsetColData(x, subsetName) <- value ## S4 method for signature 'SubsetTreeSummarizedExperiment' subsetColData(x, subsetName, parentColData)
x |
|
subsetName |
|
parentColData |
|
value |
Input |
The colData from input object.
Input object with colData stored.
data(sce_chcl, package = "scds") es <- ExperimentSubset(sce_chcl) es <- createSubset(es, "subset1", rows = c(10,11,50,56,98,99,102,105,109, 200), cols = c(20,21,40,45,90,99,100,123,166,299), parentAssay = "counts") subsetColData(es, "subset1")data(sce_chcl, package = "scds") es <- ExperimentSubset(sce_chcl) es <- createSubset(es, "subset1", rows = c(10,11,50,56,98,99,102,105,109, 200), cols = c(20,21,40,45,90,99,100,123,166,299), parentAssay = "counts") subsetColData(es, "subset1")
Get colLinks from a subset: the links of its columns
to the nodes of the tree that subsetColTree returns.
subsetColLinks(x, subsetName, parentColLinkData = TRUE) ## S4 method for signature 'SubsetTreeSummarizedExperiment' subsetColLinks(x, subsetName, parentColLinkData = TRUE)subsetColLinks(x, subsetName, parentColLinkData = TRUE) ## S4 method for signature 'SubsetTreeSummarizedExperiment' subsetColLinks(x, subsetName, parentColLinkData = TRUE)
x |
|
subsetName |
|
parentColLinkData |
|
The colLinks of the subset's columns, with the subset's
column names, or NULL.
# a small TreeSummarizedExperiment with a tree on both rows and columns data("tinyTree", package = "TreeSummarizedExperiment") counts <- matrix(1:100, nrow = 10) # name rows and columns after the tips of the tree rownames(counts) <- tinyTree$tip.label colnames(counts) <- tinyTree$tip.label tse <- TreeSummarizedExperiment(assays = list(counts = counts), rowTree = tinyTree, colTree = tinyTree) es <- ExperimentSubset(tse) es <- createSubset(es, "subset1", rows = 1:5, cols = 1:5) subsetColLinks(es, subsetName = "subset1")# a small TreeSummarizedExperiment with a tree on both rows and columns data("tinyTree", package = "TreeSummarizedExperiment") counts <- matrix(1:100, nrow = 10) # name rows and columns after the tips of the tree rownames(counts) <- tinyTree$tip.label colnames(counts) <- tinyTree$tip.label tse <- TreeSummarizedExperiment(assays = list(counts = counts), rowTree = tinyTree, colTree = tinyTree) es <- ExperimentSubset(tse) es <- createSubset(es, "subset1", rows = 1:5, cols = 1:5) subsetColLinks(es, subsetName = "subset1")
Get colnames from a subset in the ExperimentSubset
object.
Set colnames to a subset in the ExperimentSubset
object.
subsetColnames(x, subsetName) subsetColnames(x, subsetName) <- value ## S4 method for signature 'SubsetRangedSummarizedExperiment' subsetColnames(x, subsetName) ## S4 replacement method for signature 'SubsetRangedSummarizedExperiment' subsetColnames(x, subsetName) <- value ## S4 method for signature 'SubsetSingleCellExperiment' subsetColnames(x, subsetName) ## S4 replacement method for signature 'SubsetSingleCellExperiment' subsetColnames(x, subsetName) <- value ## S4 method for signature 'SubsetSummarizedExperiment' subsetColnames(x, subsetName) ## S4 replacement method for signature 'SubsetSummarizedExperiment' subsetColnames(x, subsetName) <- value ## S4 method for signature 'SubsetSpatialExperiment' subsetColnames(x, subsetName) ## S4 replacement method for signature 'SubsetSpatialExperiment' subsetColnames(x, subsetName) <- value ## S4 method for signature 'SubsetTreeSummarizedExperiment' subsetColnames(x, subsetName) ## S4 replacement method for signature 'SubsetTreeSummarizedExperiment' subsetColnames(x, subsetName) <- valuesubsetColnames(x, subsetName) subsetColnames(x, subsetName) <- value ## S4 method for signature 'SubsetRangedSummarizedExperiment' subsetColnames(x, subsetName) ## S4 replacement method for signature 'SubsetRangedSummarizedExperiment' subsetColnames(x, subsetName) <- value ## S4 method for signature 'SubsetSingleCellExperiment' subsetColnames(x, subsetName) ## S4 replacement method for signature 'SubsetSingleCellExperiment' subsetColnames(x, subsetName) <- value ## S4 method for signature 'SubsetSummarizedExperiment' subsetColnames(x, subsetName) ## S4 replacement method for signature 'SubsetSummarizedExperiment' subsetColnames(x, subsetName) <- value ## S4 method for signature 'SubsetSpatialExperiment' subsetColnames(x, subsetName) ## S4 replacement method for signature 'SubsetSpatialExperiment' subsetColnames(x, subsetName) <- value ## S4 method for signature 'SubsetTreeSummarizedExperiment' subsetColnames(x, subsetName) ## S4 replacement method for signature 'SubsetTreeSummarizedExperiment' subsetColnames(x, subsetName) <- value
x |
Input |
subsetName |
Name of the subset to set |
value |
Specify the colname values to replace. |
A vector of colnames.
Input object with colnames set to a subset.
data(sce_chcl, package = "scds") es <- ExperimentSubset(sce_chcl) es <- createSubset(es, "subset1", rows = c(10,11,50,56,98,99,102,105,109, 200), cols = c(20,21,40,45,90,99,100,123,166,299), parentAssay = "counts") subsetColnames(es, "subset1")data(sce_chcl, package = "scds") es <- ExperimentSubset(sce_chcl) es <- createSubset(es, "subset1", rows = c(10,11,50,56,98,99,102,105,109, 200), cols = c(20,21,40,45,90,99,100,123,166,299), parentAssay = "counts") subsetColnames(es, "subset1")
Get the column tree of a subset: its own, if it stores one;
otherwise that of the nearest subset it was made from that stores one;
otherwise the main object's. TreeSummarizedExperiment's
colTree takes no subsetName, so subsets use
subsetColTree.
subsetColTree<- stores a tree of the subset's own, linking each
column to the node whose label is the column's name in the subset,
without changing the main object or other subsets. Subsets made from
it use the tree too, unless they store their own. NULL removes
the subset's own tree. setSubsetExperiment also stores a column
tree that a tool changed, but not the removal of one, as a subset
always uses its own tree, a parent's or the main object's. A subset's
own tree is its only column tree, so get it with whichTree = 1.
rbind and cbind keep subsets' own trees;
combineCols and combineRows return classes without
trees (see ExperimentSubset-combine).
subsetColTree(x, subsetName, whichTree = 1) subsetColTree(x, subsetName) <- value ## S4 method for signature 'SubsetTreeSummarizedExperiment' subsetColTree(x, subsetName, whichTree = 1) ## S4 replacement method for signature 'SubsetTreeSummarizedExperiment' subsetColTree(x, subsetName) <- valuesubsetColTree(x, subsetName, whichTree = 1) subsetColTree(x, subsetName) <- value ## S4 method for signature 'SubsetTreeSummarizedExperiment' subsetColTree(x, subsetName, whichTree = 1) ## S4 replacement method for signature 'SubsetTreeSummarizedExperiment' subsetColTree(x, subsetName) <- value
x |
|
subsetName |
|
whichTree |
The name or position of the tree to get, as in
|
value |
A |
For subsetColTree, a phylo tree, or NULL if
there is none. For subsetColTree<-, the input object with the
subset's tree stored.
# a small TreeSummarizedExperiment with a tree on its columns data("tinyTree", package = "TreeSummarizedExperiment") counts <- matrix(1:100, nrow = 10) colnames(counts) <- tinyTree$tip.label tse <- TreeSummarizedExperiment(assays = list(counts = counts), colTree = tinyTree) es <- ExperimentSubset(tse) es <- createSubset(es, "subset1", cols = 1:5) # store a tree with the same labels on other tips ownTree <- tinyTree ownTree$tip.label <- rev(tinyTree$tip.label) subsetColTree(es, subsetName = "subset1") <- ownTree subsetColTree(es, subsetName = "subset1") subsetColLinks(es, subsetName = "subset1")# a small TreeSummarizedExperiment with a tree on its columns data("tinyTree", package = "TreeSummarizedExperiment") counts <- matrix(1:100, nrow = 10) colnames(counts) <- tinyTree$tip.label tse <- TreeSummarizedExperiment(assays = list(counts = counts), colTree = tinyTree) es <- ExperimentSubset(tse) es <- createSubset(es, "subset1", cols = 1:5) # store a tree with the same labels on other tips ownTree <- tinyTree ownTree$tip.label <- rev(tinyTree$tip.label) subsetColTree(es, subsetName = "subset1") <- ownTree subsetColTree(es, subsetName = "subset1") subsetColLinks(es, subsetName = "subset1")
Get the total count of the available subsets (excluding subset
assays) in an ExperimentSubset object.
subsetCount(x) ## S4 method for signature 'SubsetRangedSummarizedExperiment' subsetCount(x) ## S4 method for signature 'SubsetSingleCellExperiment' subsetCount(x) ## S4 method for signature 'SubsetSummarizedExperiment' subsetCount(x) ## S4 method for signature 'SubsetSpatialExperiment' subsetCount(x) ## S4 method for signature 'SubsetTreeSummarizedExperiment' subsetCount(x)subsetCount(x) ## S4 method for signature 'SubsetRangedSummarizedExperiment' subsetCount(x) ## S4 method for signature 'SubsetSingleCellExperiment' subsetCount(x) ## S4 method for signature 'SubsetSummarizedExperiment' subsetCount(x) ## S4 method for signature 'SubsetSpatialExperiment' subsetCount(x) ## S4 method for signature 'SubsetTreeSummarizedExperiment' subsetCount(x)
x |
|
A numeric value representing the total count of the subsets.
data(sce_chcl, package = "scds") es <- ExperimentSubset(sce_chcl) es <- createSubset(es, "subset1", rows = c(10,11,50,56,98,99,102,105,109, 200), cols = c(20,21,40,45,90,99,100,123,166,299), parentAssay = "counts") subsetCount(es)data(sce_chcl, package = "scds") es <- ExperimentSubset(sce_chcl) es <- createSubset(es, "subset1", rows = c(10,11,50,56,98,99,102,105,109, 200), cols = c(20,21,40,45,90,99,100,123,166,299), parentAssay = "counts") subsetCount(es)
Retrieves the dimensions of the specified subset in an
ExperimentSubset object.
subsetDim(x, subsetName) ## S4 method for signature 'SubsetRangedSummarizedExperiment' subsetDim(x, subsetName) ## S4 method for signature 'SubsetSingleCellExperiment' subsetDim(x, subsetName) ## S4 method for signature 'SubsetSummarizedExperiment' subsetDim(x, subsetName) ## S4 method for signature 'SubsetSpatialExperiment' subsetDim(x, subsetName) ## S4 method for signature 'SubsetTreeSummarizedExperiment' subsetDim(x, subsetName)subsetDim(x, subsetName) ## S4 method for signature 'SubsetRangedSummarizedExperiment' subsetDim(x, subsetName) ## S4 method for signature 'SubsetSingleCellExperiment' subsetDim(x, subsetName) ## S4 method for signature 'SubsetSummarizedExperiment' subsetDim(x, subsetName) ## S4 method for signature 'SubsetSpatialExperiment' subsetDim(x, subsetName) ## S4 method for signature 'SubsetTreeSummarizedExperiment' subsetDim(x, subsetName)
x |
|
subsetName |
|
A vector containing the dimensions of the specified subset
i.e. the number of rows and the number of columns in the subset.
data(sce_chcl, package = "scds") es <- ExperimentSubset(sce_chcl) es <- createSubset(es, "subset1", rows = c(10,11,50,56,98,99,102,105,109, 200), cols = c(20,21,40,45,90,99,100,123,166,299), parentAssay = "counts") subsetDim(es, "subset1")data(sce_chcl, package = "scds") es <- ExperimentSubset(sce_chcl) es <- createSubset(es, "subset1", rows = c(10,11,50,56,98,99,102,105,109, 200), cols = c(20,21,40,45,90,99,100,123,166,299), parentAssay = "counts") subsetDim(es, "subset1")
Get the images of a subset: the rows of the main object's
imgData whose sample_id is the sample of one or more of
the subset's spots. They are looked up from the main object each time,
so they are always current; subsets don't store images of their own.
subsetImgData(x, subsetName) ## S4 method for signature 'SubsetSpatialExperiment' subsetImgData(x, subsetName)subsetImgData(x, subsetName) ## S4 method for signature 'SubsetSpatialExperiment' subsetImgData(x, subsetName)
x |
|
subsetName |
|
A DataFrame of the subset's images, with the columns of
imgData().
# a small SpatialExperiment with six spots in two samples, and an image # of each sample counts <- matrix(1:60, nrow = 10) coords <- cbind(x = 1:6, y = 6:1) sampleIds <- rep(c("A", "B"), each = 3) image <- SpatialImage(as.raster(matrix(c(0, 1, 1, 0), nrow = 2))) images <- DataFrame(sample_id = c("A", "B"), image_id = "lowres", data = I(list(image, image)), scaleFactor = 1) spe <- SpatialExperiment(assays = list(counts = counts), sample_id = sampleIds, spatialCoords = coords, imgData = images) es <- ExperimentSubset(spe) # a subset of spots from sample B only es <- createSubset(es, "sampleB", cols = 4:6) subsetImgData(es, subsetName = "sampleB")# a small SpatialExperiment with six spots in two samples, and an image # of each sample counts <- matrix(1:60, nrow = 10) coords <- cbind(x = 1:6, y = 6:1) sampleIds <- rep(c("A", "B"), each = 3) image <- SpatialImage(as.raster(matrix(c(0, 1, 1, 0), nrow = 2))) images <- DataFrame(sample_id = c("A", "B"), image_id = "lowres", data = I(list(image, image)), scaleFactor = 1) spe <- SpatialExperiment(assays = list(counts = counts), sample_id = sampleIds, spatialCoords = coords, imgData = images) es <- ExperimentSubset(spe) # a subset of spots from sample B only es <- createSubset(es, "sampleB", cols = 4:6) subsetImgData(es, subsetName = "sampleB")
Retrieves the names of the available subsets (not the subset
assays) in an ExperimentSubset object.
subsetNames(x) ## S4 method for signature 'SubsetRangedSummarizedExperiment' subsetNames(x) ## S4 method for signature 'SubsetSingleCellExperiment' subsetNames(x) ## S4 method for signature 'SubsetSummarizedExperiment' subsetNames(x) ## S4 method for signature 'SubsetSpatialExperiment' subsetNames(x) ## S4 method for signature 'SubsetTreeSummarizedExperiment' subsetNames(x)subsetNames(x) ## S4 method for signature 'SubsetRangedSummarizedExperiment' subsetNames(x) ## S4 method for signature 'SubsetSingleCellExperiment' subsetNames(x) ## S4 method for signature 'SubsetSummarizedExperiment' subsetNames(x) ## S4 method for signature 'SubsetSpatialExperiment' subsetNames(x) ## S4 method for signature 'SubsetTreeSummarizedExperiment' subsetNames(x)
x |
|
A vector of subset names.
data(sce_chcl, package = "scds") es <- ExperimentSubset(sce_chcl) es <- createSubset(es, "subset1", rows = c(10,11,50,56,98,99,102,105,109, 200), cols = c(20,21,40,45,90,99,100,123,166,299), parentAssay = "counts") subsetNames(es)data(sce_chcl, package = "scds") es <- ExperimentSubset(sce_chcl) es <- createSubset(es, "subset1", rows = c(10,11,50,56,98,99,102,105,109, 200), cols = c(20,21,40,45,90,99,100,123,166,299), parentAssay = "counts") subsetNames(es)
Retrieves a complete 'subset to parent' link from a specified subset.
subsetParent(x, subsetName) ## S4 method for signature 'SubsetRangedSummarizedExperiment' subsetParent(x, subsetName) ## S4 method for signature 'SubsetSingleCellExperiment' subsetParent(x, subsetName) ## S4 method for signature 'SubsetSummarizedExperiment' subsetParent(x, subsetName) ## S4 method for signature 'SubsetSpatialExperiment' subsetParent(x, subsetName) ## S4 method for signature 'SubsetTreeSummarizedExperiment' subsetParent(x, subsetName)subsetParent(x, subsetName) ## S4 method for signature 'SubsetRangedSummarizedExperiment' subsetParent(x, subsetName) ## S4 method for signature 'SubsetSingleCellExperiment' subsetParent(x, subsetName) ## S4 method for signature 'SubsetSummarizedExperiment' subsetParent(x, subsetName) ## S4 method for signature 'SubsetSpatialExperiment' subsetParent(x, subsetName) ## S4 method for signature 'SubsetTreeSummarizedExperiment' subsetParent(x, subsetName)
x |
|
subsetName |
|
A list containing the 'subset to parent' link.
data(sce_chcl, package = "scds") es <- ExperimentSubset(sce_chcl) es <- createSubset(es, "subset1", rows = c(10,11,50,56,98,99,102,105,109, 200), cols = c(20,21,40,45,90,99,100,123,166,299), parentAssay = "counts") assay(es, "subset1", subsetAssayName = "subset1pAssay") <- assay(es, "subset1")[,] + 1 subsetParent(es, "subset1/subset1pAssay")data(sce_chcl, package = "scds") es <- ExperimentSubset(sce_chcl) es <- createSubset(es, "subset1", rows = c(10,11,50,56,98,99,102,105,109, 200), cols = c(20,21,40,45,90,99,100,123,166,299), parentAssay = "counts") assay(es, "subset1", subsetAssayName = "subset1pAssay") <- assay(es, "subset1")[,] + 1 subsetParent(es, "subset1/subset1pAssay")
RangedSummarizedExperiment objects with added support
for subsets.An S4 class for RangedSummarizedExperiment objects with added support
for subsets.
## S4 method for signature 'SubsetRangedSummarizedExperiment' show(object)## S4 method for signature 'SubsetRangedSummarizedExperiment' show(object)
object |
The object to print, with its subsets and their assays. |
show() prints the object and returns NULL
invisibly.
subsetsA list of AssaySubset objects.
Get rowData from a subset.
Set rowData to a subset.
subsetRowData(x, subsetName, parentRowData) subsetRowData(x, subsetName) <- value ## S4 method for signature 'SubsetRangedSummarizedExperiment' subsetRowData(x, subsetName, parentRowData) ## S4 replacement method for signature 'SubsetRangedSummarizedExperiment' subsetRowData(x, subsetName) <- value ## S4 method for signature 'SubsetSingleCellExperiment' subsetRowData(x, subsetName, parentRowData) ## S4 replacement method for signature 'SubsetSingleCellExperiment' subsetRowData(x, subsetName) <- value ## S4 replacement method for signature 'SubsetSummarizedExperiment' subsetRowData(x, subsetName) <- value ## S4 method for signature 'SubsetSummarizedExperiment' subsetRowData(x, subsetName, parentRowData) ## S4 method for signature 'SubsetSpatialExperiment' subsetRowData(x, subsetName, parentRowData) ## S4 replacement method for signature 'SubsetSpatialExperiment' subsetRowData(x, subsetName) <- value ## S4 method for signature 'SubsetTreeSummarizedExperiment' subsetRowData(x, subsetName, parentRowData)subsetRowData(x, subsetName, parentRowData) subsetRowData(x, subsetName) <- value ## S4 method for signature 'SubsetRangedSummarizedExperiment' subsetRowData(x, subsetName, parentRowData) ## S4 replacement method for signature 'SubsetRangedSummarizedExperiment' subsetRowData(x, subsetName) <- value ## S4 method for signature 'SubsetSingleCellExperiment' subsetRowData(x, subsetName, parentRowData) ## S4 replacement method for signature 'SubsetSingleCellExperiment' subsetRowData(x, subsetName) <- value ## S4 replacement method for signature 'SubsetSummarizedExperiment' subsetRowData(x, subsetName) <- value ## S4 method for signature 'SubsetSummarizedExperiment' subsetRowData(x, subsetName, parentRowData) ## S4 method for signature 'SubsetSpatialExperiment' subsetRowData(x, subsetName, parentRowData) ## S4 replacement method for signature 'SubsetSpatialExperiment' subsetRowData(x, subsetName) <- value ## S4 method for signature 'SubsetTreeSummarizedExperiment' subsetRowData(x, subsetName, parentRowData)
x |
|
subsetName |
|
parentRowData |
|
value |
Input |
The rowData from input object.
Input object with rowData stored.
data(sce_chcl, package = "scds") es <- ExperimentSubset(sce_chcl) es <- createSubset(es, "subset1", rows = c(10,11,50,56,98,99,102,105,109, 200), cols = c(20,21,40,45,90,99,100,123,166,299), parentAssay = "counts") subsetRowData(es, "subset1")data(sce_chcl, package = "scds") es <- ExperimentSubset(sce_chcl) es <- createSubset(es, "subset1", rows = c(10,11,50,56,98,99,102,105,109, 200), cols = c(20,21,40,45,90,99,100,123,166,299), parentAssay = "counts") subsetRowData(es, "subset1")
Get rowLinks from a subset: the links of its rows to
the nodes of the tree that subsetRowTree returns.
subsetRowLinks(x, subsetName, parentRowLinkData = TRUE) ## S4 method for signature 'SubsetTreeSummarizedExperiment' subsetRowLinks(x, subsetName, parentRowLinkData = TRUE)subsetRowLinks(x, subsetName, parentRowLinkData = TRUE) ## S4 method for signature 'SubsetTreeSummarizedExperiment' subsetRowLinks(x, subsetName, parentRowLinkData = TRUE)
x |
|
subsetName |
|
parentRowLinkData |
|
The rowLinks of the subset's rows, with the subset's
rownames, or NULL.
# a small TreeSummarizedExperiment with a tree on both rows and columns data("tinyTree", package = "TreeSummarizedExperiment") counts <- matrix(1:100, nrow = 10) # name rows and columns after the tips of the tree rownames(counts) <- tinyTree$tip.label colnames(counts) <- tinyTree$tip.label tse <- TreeSummarizedExperiment(assays = list(counts = counts), rowTree = tinyTree, colTree = tinyTree) es <- ExperimentSubset(tse) es <- createSubset(es, "subset1", rows = 1:5, cols = 1:5) subsetRowLinks(es, subsetName = "subset1")# a small TreeSummarizedExperiment with a tree on both rows and columns data("tinyTree", package = "TreeSummarizedExperiment") counts <- matrix(1:100, nrow = 10) # name rows and columns after the tips of the tree rownames(counts) <- tinyTree$tip.label colnames(counts) <- tinyTree$tip.label tse <- TreeSummarizedExperiment(assays = list(counts = counts), rowTree = tinyTree, colTree = tinyTree) es <- ExperimentSubset(tse) es <- createSubset(es, "subset1", rows = 1:5, cols = 1:5) subsetRowLinks(es, subsetName = "subset1")
Get rownames from a subset in the ExperimentSubset
object.
Set rownames to a subset in the
ExperimentSubset object.
subsetRownames(x, subsetName) subsetRownames(x, subsetName) <- value ## S4 method for signature 'SubsetRangedSummarizedExperiment' subsetRownames(x, subsetName) ## S4 replacement method for signature 'SubsetRangedSummarizedExperiment' subsetRownames(x, subsetName) <- value ## S4 method for signature 'SubsetSingleCellExperiment' subsetRownames(x, subsetName) ## S4 replacement method for signature 'SubsetSingleCellExperiment' subsetRownames(x, subsetName) <- value ## S4 method for signature 'SubsetSummarizedExperiment' subsetRownames(x, subsetName) ## S4 replacement method for signature 'SubsetSummarizedExperiment' subsetRownames(x, subsetName) <- value ## S4 method for signature 'SubsetSpatialExperiment' subsetRownames(x, subsetName) ## S4 replacement method for signature 'SubsetSpatialExperiment' subsetRownames(x, subsetName) <- value ## S4 method for signature 'SubsetTreeSummarizedExperiment' subsetRownames(x, subsetName) ## S4 replacement method for signature 'SubsetTreeSummarizedExperiment' subsetRownames(x, subsetName) <- valuesubsetRownames(x, subsetName) subsetRownames(x, subsetName) <- value ## S4 method for signature 'SubsetRangedSummarizedExperiment' subsetRownames(x, subsetName) ## S4 replacement method for signature 'SubsetRangedSummarizedExperiment' subsetRownames(x, subsetName) <- value ## S4 method for signature 'SubsetSingleCellExperiment' subsetRownames(x, subsetName) ## S4 replacement method for signature 'SubsetSingleCellExperiment' subsetRownames(x, subsetName) <- value ## S4 method for signature 'SubsetSummarizedExperiment' subsetRownames(x, subsetName) ## S4 replacement method for signature 'SubsetSummarizedExperiment' subsetRownames(x, subsetName) <- value ## S4 method for signature 'SubsetSpatialExperiment' subsetRownames(x, subsetName) ## S4 replacement method for signature 'SubsetSpatialExperiment' subsetRownames(x, subsetName) <- value ## S4 method for signature 'SubsetTreeSummarizedExperiment' subsetRownames(x, subsetName) ## S4 replacement method for signature 'SubsetTreeSummarizedExperiment' subsetRownames(x, subsetName) <- value
x |
Input |
subsetName |
Name of the subset to get |
value |
Specify the rownames values to replace. |
A vector of rownames.
Input object with rownames set to a subset.
data(sce_chcl, package = "scds") es <- ExperimentSubset(sce_chcl) es <- createSubset(es, "subset1", rows = c(10,11,50,56,98,99,102,105,109, 200), cols = c(20,21,40,45,90,99,100,123,166,299), parentAssay = "counts") subsetRownames(es, "subset1")data(sce_chcl, package = "scds") es <- ExperimentSubset(sce_chcl) es <- createSubset(es, "subset1", rows = c(10,11,50,56,98,99,102,105,109, 200), cols = c(20,21,40,45,90,99,100,123,166,299), parentAssay = "counts") subsetRownames(es, "subset1")
Get the row tree of a subset: its own, if it stores one;
otherwise that of the nearest subset it was made from that stores one;
otherwise the main object's. TreeSummarizedExperiment's
rowTree takes no subsetName, so subsets use
subsetRowTree.
subsetRowTree<- stores a tree of the subset's own, linking each
row to the node whose label is the row's name in the subset, without
changing the main object or other subsets. Subsets made from it use
the tree too, unless they store their own. NULL removes the
subset's own tree. setSubsetExperiment also stores a row tree
that a tool changed, but not the removal of one, as a subset always
uses its own tree, a parent's or the main object's. A subset's own
tree is its only row tree, so get it with whichTree = 1.
rbind and cbind keep subsets' own trees;
combineCols and combineRows return classes without
trees (see ExperimentSubset-combine).
subsetRowTree(x, subsetName, whichTree = 1) subsetRowTree(x, subsetName) <- value ## S4 method for signature 'SubsetTreeSummarizedExperiment' subsetRowTree(x, subsetName, whichTree = 1) ## S4 replacement method for signature 'SubsetTreeSummarizedExperiment' subsetRowTree(x, subsetName) <- valuesubsetRowTree(x, subsetName, whichTree = 1) subsetRowTree(x, subsetName) <- value ## S4 method for signature 'SubsetTreeSummarizedExperiment' subsetRowTree(x, subsetName, whichTree = 1) ## S4 replacement method for signature 'SubsetTreeSummarizedExperiment' subsetRowTree(x, subsetName) <- value
x |
|
subsetName |
|
whichTree |
The name or position of the tree to get, as in
|
value |
A |
For subsetRowTree, a phylo tree, or NULL if
there is none. For subsetRowTree<-, the input object with the
subset's tree stored.
# a small TreeSummarizedExperiment with a tree on its rows data("tinyTree", package = "TreeSummarizedExperiment") counts <- matrix(1:100, nrow = 10) rownames(counts) <- tinyTree$tip.label tse <- TreeSummarizedExperiment(assays = list(counts = counts), rowTree = tinyTree) es <- ExperimentSubset(tse) es <- createSubset(es, "subset1", rows = 1:5) # the subset uses the main object's tree subsetRowTree(es, subsetName = "subset1") # store a tree with the same labels on other tips ownTree <- tinyTree ownTree$tip.label <- rev(tinyTree$tip.label) subsetRowTree(es, subsetName = "subset1") <- ownTree subsetRowLinks(es, subsetName = "subset1") # the main object's links are unchanged rowLinks(es)[1:5, ]# a small TreeSummarizedExperiment with a tree on its rows data("tinyTree", package = "TreeSummarizedExperiment") counts <- matrix(1:100, nrow = 10) rownames(counts) <- tinyTree$tip.label tse <- TreeSummarizedExperiment(assays = list(counts = counts), rowTree = tinyTree) es <- ExperimentSubset(tse) es <- createSubset(es, "subset1", rows = 1:5) # the subset uses the main object's tree subsetRowTree(es, subsetName = "subset1") # store a tree with the same labels on other tips ownTree <- tinyTree ownTree$tip.label <- rev(tinyTree$tip.label) subsetRowTree(es, subsetName = "subset1") <- ownTree subsetRowLinks(es, subsetName = "subset1") # the main object's links are unchanged rowLinks(es)[1:5, ]
SingleCellExperiment objects with added support for
subsets.An S4 class for SingleCellExperiment objects with added support for
subsets.
## S4 method for signature 'SubsetSingleCellExperiment' show(object)## S4 method for signature 'SubsetSingleCellExperiment' show(object)
object |
The object to print, with its subsets and their assays. |
show() prints the object and returns NULL
invisibly.
subsetsA list of AssaySubset objects.
Get spatialCoords from a subset, with
subsetSpatialCoords(x, subsetName) or
spatialCoords(x, subsetName = ). Without subsetName,
spatialCoords() returns the main object's, as for
SpatialExperiment.
subsetSpatialCoords(x, subsetName) <- value stores
a subset's own spatialCoords, for example
after a transformation, without changing the main object's. A subset
with its own coordinates returns them from
subsetSpatialCoords(), spatialCoords(x, subsetName = )
and getSubsetExperiment(), and subsets made from it see them,
cut to their spots. A subset without its own coordinates sees those of
the nearest subset it was made from that has them, or else the main
object's.
subsetSpatialCoords(x, subsetName) subsetSpatialCoords(x, subsetName) <- value ## S4 method for signature 'SubsetSpatialExperiment' subsetSpatialCoords(x, subsetName) ## S4 replacement method for signature 'SubsetSpatialExperiment' subsetSpatialCoords(x, subsetName) <- value ## S4 method for signature 'SubsetSpatialExperiment' spatialCoords(x, ...)subsetSpatialCoords(x, subsetName) subsetSpatialCoords(x, subsetName) <- value ## S4 method for signature 'SubsetSpatialExperiment' subsetSpatialCoords(x, subsetName) ## S4 replacement method for signature 'SubsetSpatialExperiment' subsetSpatialCoords(x, subsetName) <- value ## S4 method for signature 'SubsetSpatialExperiment' spatialCoords(x, ...)
x |
|
subsetName |
|
value |
A numeric |
... |
For
Without |
For subsetSpatialCoords() and spatialCoords(), the
spatialCoords the subset sees.
For subsetSpatialCoords<-, the input object with the
subset's spatialCoords stored.
# a small SpatialExperiment with six spots counts <- matrix(1:60, nrow = 10) coords <- cbind(x = 1:6, y = 6:1) spe <- SpatialExperiment(assays = list(counts = counts), spatialCoords = coords) es <- ExperimentSubset(spe) es <- createSubset(es, "subset1", cols = 2:4) subsetSpatialCoords(es, "subset1") # the same, through spatialCoords() spatialCoords(es, subsetName = "subset1") # a small SpatialExperiment with six spots counts <- matrix(1:60, nrow = 10) coords <- cbind(x = 1:6, y = 6:1) spe <- SpatialExperiment(assays = list(counts = counts), spatialCoords = coords) es <- ExperimentSubset(spe) es <- createSubset(es, "subset1", cols = 2:4) # store coordinates moved 100 to the right movedCoords <- subsetSpatialCoords(es, subsetName = "subset1") movedCoords[, "x"] <- movedCoords[, "x"] + 100 subsetSpatialCoords(es, subsetName = "subset1") <- movedCoords subsetSpatialCoords(es, subsetName = "subset1") # the main object's coordinates are unchanged spatialCoords(es)# a small SpatialExperiment with six spots counts <- matrix(1:60, nrow = 10) coords <- cbind(x = 1:6, y = 6:1) spe <- SpatialExperiment(assays = list(counts = counts), spatialCoords = coords) es <- ExperimentSubset(spe) es <- createSubset(es, "subset1", cols = 2:4) subsetSpatialCoords(es, "subset1") # the same, through spatialCoords() spatialCoords(es, subsetName = "subset1") # a small SpatialExperiment with six spots counts <- matrix(1:60, nrow = 10) coords <- cbind(x = 1:6, y = 6:1) spe <- SpatialExperiment(assays = list(counts = counts), spatialCoords = coords) es <- ExperimentSubset(spe) es <- createSubset(es, "subset1", cols = 2:4) # store coordinates moved 100 to the right movedCoords <- subsetSpatialCoords(es, subsetName = "subset1") movedCoords[, "x"] <- movedCoords[, "x"] + 100 subsetSpatialCoords(es, subsetName = "subset1") <- movedCoords subsetSpatialCoords(es, subsetName = "subset1") # the main object's coordinates are unchanged spatialCoords(es)
subsetSpatialData() and
spatialData(x, subsetName =) are deprecated, and
subsetSpatialData<- is defunct, because
spatialData() and spatialData<- are deprecated in
SpatialExperiment, which now keeps these columns in colData.
Use subsetColData(x, subsetName) to get them, which returns
all of the subset's colData columns, with
parentColData = TRUE to include the main object's, and
colData(x, subsetName = "name")$column <- values to add a
column to a subset. The getters will be defunct in the next
release.
subsetSpatialData(x, subsetName, parentSpatialData) subsetSpatialData(x, subsetName) <- value ## S4 method for signature 'SubsetSpatialExperiment' subsetSpatialData(x, subsetName, parentSpatialData) ## S4 method for signature 'SubsetSpatialExperiment' spatialData(x, ...) ## S4 replacement method for signature 'SubsetSpatialExperiment' subsetSpatialData(x, subsetName) <- valuesubsetSpatialData(x, subsetName, parentSpatialData) subsetSpatialData(x, subsetName) <- value ## S4 method for signature 'SubsetSpatialExperiment' subsetSpatialData(x, subsetName, parentSpatialData) ## S4 method for signature 'SubsetSpatialExperiment' spatialData(x, ...) ## S4 replacement method for signature 'SubsetSpatialExperiment' subsetSpatialData(x, subsetName) <- value
x |
|
subsetName |
|
parentSpatialData |
|
value |
Ignored: the setter is defunct. |
... |
For |
The spatialData from input object, with a deprecation
warning. The setter fails with an error.
SpatialExperiment objects with added support for
subsets.An S4 class for SpatialExperiment objects with added support for
subsets.
## S4 method for signature 'SubsetSpatialExperiment' show(object)## S4 method for signature 'SubsetSpatialExperiment' show(object)
object |
The object to print, with its subsets and their assays. |
show() prints the object and returns NULL
invisibly.
subsetsA list of AssaySubset objects.
SummarizedExperiment objects with added support for
subsets.An S4 class for SummarizedExperiment objects with added support for
subsets.
## S4 method for signature 'SubsetSummarizedExperiment' show(object)## S4 method for signature 'SubsetSummarizedExperiment' show(object)
object |
The object to print, with its subsets and their assays. |
show() prints the object and returns NULL
invisibly.
subsetsA list of AssaySubset objects.
The function displays the content of an ExperimentSubset
object including all available main assays, all subsets and the subset
assays inside these subsets. This function also depicts how and in what
order the subsets in the object are linked with their parents. Moreover,
all supplementary data inside the subsets such as reducedDims and
altExps are also displayed against each subset entry.
subsetSummary(x) ## S4 method for signature 'SubsetRangedSummarizedExperiment' subsetSummary(x) ## S4 method for signature 'SubsetSingleCellExperiment' subsetSummary(x) ## S4 method for signature 'SubsetSummarizedExperiment' subsetSummary(x) ## S4 method for signature 'SubsetSpatialExperiment' subsetSummary(x) ## S4 method for signature 'SubsetTreeSummarizedExperiment' subsetSummary(x)subsetSummary(x) ## S4 method for signature 'SubsetRangedSummarizedExperiment' subsetSummary(x) ## S4 method for signature 'SubsetSingleCellExperiment' subsetSummary(x) ## S4 method for signature 'SubsetSummarizedExperiment' subsetSummary(x) ## S4 method for signature 'SubsetSpatialExperiment' subsetSummary(x) ## S4 method for signature 'SubsetTreeSummarizedExperiment' subsetSummary(x)
x |
|
Prints all the available subset information against the input
ExperimentSubset object.
data(sce_chcl, package = "scds") es <- ExperimentSubset(sce_chcl) es <- createSubset(es, "subset1", rows = c(10,11,50,56,98,99,102,105,109, 200), cols = c(20,21,40,45,90,99,100,123,166,299), parentAssay = "counts") assay(es, "subset1", subsetAssayName = "subset1pAssay") <- assay(es, "subset1")[,] + 1 subsetSummary(es)data(sce_chcl, package = "scds") es <- ExperimentSubset(sce_chcl) es <- createSubset(es, "subset1", rows = c(10,11,50,56,98,99,102,105,109, 200), cols = c(20,21,40,45,90,99,100,123,166,299), parentAssay = "counts") assay(es, "subset1", subsetAssayName = "subset1pAssay") <- assay(es, "subset1")[,] + 1 subsetSummary(es)
TreeSummarizedExperiment objects with added support
for subsets.An S4 class for TreeSummarizedExperiment objects with added support
for subsets.
## S4 method for signature 'SubsetTreeSummarizedExperiment' show(object)## S4 method for signature 'SubsetTreeSummarizedExperiment' show(object)
object |
The object to print, with its subsets and their assays. |
show() prints the object and returns NULL
invisibly.
subsetsA list of AssaySubset objects.