mergeSEs | R Documentation |
Merge SE objects into single SE object.
mergeSEs(x, ...)
## S4 method for signature 'SimpleList'
mergeSEs(
x,
assay.type = "counts",
assay_name = NULL,
join = "full",
missing.values = missing_values,
missing_values = NA,
collapse.cols = collapse_samples,
collapse_samples = FALSE,
collapse.rows = collapse_features,
collapse_features = TRUE,
verbose = TRUE,
...
)
## S4 method for signature 'SummarizedExperiment'
mergeSEs(x, y = NULL, ...)
## S4 method for signature 'list'
mergeSEs(x, ...)
x |
|
... |
optional arguments (not used). |
assay.type |
|
assay_name |
Deprecated. Use |
join |
|
missing.values |
|
missing_values |
Deprecated. Use |
collapse.cols |
|
collapse_samples |
Deprecated. Use |
collapse.rows |
|
collapse_features |
Deprecated. Use |
verbose |
|
y |
a |
This function merges multiple SummarizedExperiment
objects. It combines
rowData
, assays
, and colData
so that the output includes
each unique row and column ones. The merging is done based on rownames
and
colnames
. rowTree
and colTree
are preserved if linkage
between rows/cols and the tree is found.
Equally named rows are interpreted as equal. Further
matching based on rowData
is not done. For samples, collapsing
is disabled by default meaning that equally named samples that are stored
in different objects are interpreted as unique. Collapsing can be enabled
with collapse.cols = TRUE
when equally named samples describe the same
sample.
If, for example, all rows are not shared with
individual objects, there are missing values in assays
. The notation of missing
can be specified with the missing.values
argument. If input consists of
TreeSummarizedExperiment
objects, also rowTree
, colTree
, and
referenceSeq
are preserved if possible. The data is preserved if
all the rows or columns can be found from it.
Compared to cbind
and rbind
mergeSEs
allows more freely merging since cbind
and rbind
expect
that rows and columns are matching, respectively.
You can choose joining methods from 'full'
, 'inner'
,
'left'
, and 'right'
. In all the methods, all the samples are
included in the result object. However, with different methods, it is possible
to choose which rows are included.
full
– all unique features
inner
– all shared features
left
– all the features of the first object
right
– all the features of the second object
The output depends on the input. If the input contains SummarizedExperiment
object, then the output will be SummarizedExperiment
. When all the input
objects belong to TreeSummarizedExperiment
, the output will be
TreeSummarizedExperiment
.
A single SummarizedExperiment
object.
TreeSummarizedExperiment::cbind
TreeSummarizedExperiment::rbind
full_join
inner_join
left_join
right_join
data(GlobalPatterns)
data(esophagus)
data(enterotype)
# Take only subsets so that it wont take so long
tse1 <- GlobalPatterns[1:100, ]
tse2 <- esophagus
tse3 <- enterotype[1:100, ]
# Merge two TreeSEs
tse <- mergeSEs(tse1, tse2)
# Merge a list of TreeSEs
list <- SimpleList(tse1, tse2, tse3)
tse <- mergeSEs(list, assay.type = "counts", missing.values = 0)
tse
# With 'join', it is possible to specify the merging method. Subsets are used
# here just to show the functionality
tse_temp <- mergeSEs(tse[1:10, 1:10], tse[5:100, 11:20], join = "left")
tse_temp
# If your objects contain samples that describe one and same sample,
# you can collapse equally named samples to one by specifying 'collapse.cols'
tse_temp <- mergeSEs(list(tse[1:10, 1], tse[1:20, 1], tse[1:5, 1]),
collapse.cols = TRUE,
join = "inner")
tse_temp
# Merge all available assays
tse <- transformAssay(tse, method="relabundance")
ts1 <- transformAssay(tse1, method="relabundance")
tse_temp <- mergeSEs(tse, tse1, assay.type = assayNames(tse))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.