SpatialExperiment-combine | R Documentation |
The SpatialExperiment
class provides modified methods to
combine multiple SpatialExperiment
objects by column, for example from
multiple samples. These methods ensure that all data fields remain
synchronized when samples are added or removed.
## S4 method for signature 'SpatialExperiment'
cbind(..., deparse.level = 1)
... |
a list of |
deparse.level |
refer to |
a combined SpatialExperiment
object
The ...
argument is assumed to contain one or more
SpatialExperiment
objects.
cbind(..., deparse.level=1)
:Returns a SpatialExperiment
where all objects in ...
are
combined column-wise, i.e., columns in successive objects are appended to the
first object.
Each SpatialExperiment
object in ...
must have the same
colData
(with the same spatialCoords
). If multiple
objects use the same sample_id
, the method will proceed by assigning
unique sample_id
s.
Additionally, the method combines imgData
by row using rbind
.
Refer to ?"cbind,SingleCellExperiment-method"
for details on
how metadata and other inherited attributes are combined in the output
object.
Refer to ?cbind
for the interpretation of
deparse.level
.
Dario Righelli
example(SpatialExperiment)
# merging with duplicated 'sample_id's
# will automatically assign unique identifiers
spe1 <- spe2 <- spe
spe3 <- cbind(spe1, spe2)
unique(spe3$sample_id)
# assign unique sample identifiers
spe1 <- spe2 <- spe
spe1$sample_id <- paste(spe1$sample_id, "sample1", sep = ".")
spe2$sample_id <- paste(spe2$sample_id, "sample2", sep = ".")
# combine into single object
spe <- cbind(spe1, spe2)
# view joint 'imgData'
imgData(spe)
# tabulate number of spots mapped to tissue
cd <- colData(spe)
table(
in_tissue = cd$in_tissue,
sample_id = cd$sample_id)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.