This function returns a SummarizedExperiment with clustering
information in its colData or rowData
addCluster(
x,
BLUSPARAM,
assay.type = assay_name,
assay_name = "counts",
by = MARGIN,
MARGIN = "rows",
full = FALSE,
name = "clusters",
clust.col = "clusters",
...
)
# S4 method for class 'SummarizedExperiment'
addCluster(
x,
BLUSPARAM,
assay.type = assay_name,
assay_name = "counts",
by = MARGIN,
MARGIN = "rows",
full = FALSE,
name = "clusters",
clust.col = "clusters",
...
)A
SummarizedExperiment
object.
A BlusterParam object specifying the algorithm to use.
Character scalar. Specifies the name of the
assay used in calculation. (Default: "counts")
Deprecated. Use assay.type instead.
Character scalar. Determines if association is calculated
row-wise / for features ('rows') or column-wise / for samples ('cols').
Must be 'rows' or 'cols'.
Deprecated. Use by instead.
Logical scalar indicating whether the full clustering statistics should be returned for each method.
Character scalar. The name to store the result in
metadata
Character scalar. Indicates the name of the
rowData (or colData) where the data will be stored.
(Default: "clusters")
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,
by = "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