This function returns a SummarizedExperiment
with clustering
information in its colData or rowData
addCluster(
x,
BLUSPARAM,
assay.type = assay_name,
assay_name = "counts",
MARGIN = "features",
full = FALSE,
name = "clusters",
clust.col = "clusters",
...
)
# S4 method for SummarizedExperiment
addCluster(
x,
BLUSPARAM,
assay.type = assay_name,
assay_name = "counts",
MARGIN = "features",
full = FALSE,
name = "clusters",
clust.col = "clusters",
...
)
A
SummarizedExperiment
object.
A BlusterParam object specifying the algorithm to use.
a single character
value for specifying which
assay to use for calculation.
a single character
value for specifying which
assay to use for calculation.
(Please use assay.type
instead. At some point assay_name
will be disabled.)
A single character value for specifying whether the
transformation is applied sample (column) or feature (row) wise.
(By default: MARGIN = "samples"
)
Logical scalar indicating whether the full clustering statistics should be returned for each method.
the name to store the result in
metadata
A single character value indicating the name of the
rowData
(or colData
) where the data will be stored.
Additional parameters to use altExps for example
addCluster
returns an object of the same type as the x
parameter
with clustering information named clusters
stored in colData
or rowData
.
This is a wrapper for the clusterRows
function from the
bluster
package.
When setting full = TRUE
, the clustering information will be stored in
the metadata of the object.
By default, clustering is done on the features.
library(bluster)
data(GlobalPatterns, package = "mia")
tse <- GlobalPatterns
# Cluster on rows using Kmeans
tse <- addCluster(tse, KmeansParam(centers = 3))
# Clustering done on the samples using Hclust
tse <- addCluster(tse,
MARGIN = "samples",
HclustParam(metric = "bray", dist.fun = vegan::vegdist))
# Getting the clusters
colData(tse)$clusters
#> CL3 CC1 SV1 M31Fcsw M11Fcsw M31Plmr M11Plmr F21Plmr
#> 1 2 3 4 5 6 7 8
#> M31Tong M11Tong LMEpi24M SLEpi20M AQC1cm AQC4cm AQC7cm NP2
#> 9 10 11 12 13 13 13 14
#> NP3 NP5 TRRsed1 TRRsed2 TRRsed3 TS28 TS29 Even1
#> 15 16 17 18 18 19 20 21
#> Even2 Even3
#> 21 21
#> Levels: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21