Base class for components that are based on hierarchical clustered data.
Source:R/components-clust.R
componentsClust-class.RdThis base class is derived from components and is used to store components resulting from hierarchical
clustering information, for instance, generated by generateComponentsIntClust and
generateComponentsSpecClust.
Usage
# S4 method for class 'componentsClust'
delete(obj, ...)
# S4 method for class 'componentsClust'
clusters(obj)
# S4 method for class 'componentsClust'
cutClusters(obj)
# S4 method for class 'componentsClust'
clusterProperties(obj)
# S4 method for class 'componentsClust'
treeCut(obj, k = NULL, h = NULL)
# S4 method for class 'componentsClust'
treeCutDynamic(obj, maxTreeHeight, deepSplit, minModuleSize)
# S4 method for class 'componentsClust,missing'
plot(
x,
pal = "Paired",
numericLabels = TRUE,
colourBranches = length(x) < 50,
showLegend = length(x) < 20,
...
)
# S4 method for class 'componentsClust'
plotSilhouettes(obj, kSeq, pch = 16, type = "b", ...)Arguments
- ...
Further options passed to
plot.dendrogram(plot) orplot(plotSilhouettes).- k, h
Desired number of clusters or tree height to be used for cutting the dendrogram, respectively. One or the other must be specified. Analogous to
cutree.- maxTreeHeight, deepSplit, minModuleSize
Arguments used by
cutreeDynamicTree.- x, obj
A
componentsClust(derived) object.- pal
Colour palette to be used from RColorBrewer.
- numericLabels
Set to
TRUEto label with numeric indices instead of (long) feature group names.- colourBranches
Whether branches from cut clusters (and their labels) should be coloured. Might be slow with large numbers of clusters, hence, the default is only
TRUEwhen this is not the case.- showLegend
If
TRUEandcolourBranchesis alsoTRUEthen a legend will be shown which outlines cluster numbers and their colours. By defaultTRUEfor small amount of clusters to avoid overflowing the plot.- kSeq
An integer vector containing the sequence that should be used for average silhouette width calculation.
- pch, type
Passed to
plot.
Methods (by generic)
clusters(componentsClust): Accessor method to theclustslot, which was generated byhclust.cutClusters(componentsClust): Accessor method to thecutClustersslot. Returns a vector with cluster membership for each candidate (format ascutree).clusterProperties(componentsClust): Returns a list with properties on how the clustering was performed.treeCut(componentsClust): Manually (re-)cut the dendrogram.treeCutDynamic(componentsClust): Automatically (re-)cut the dendrogram using thecutreeDynamicTreefunction from dynamicTreeCut.plot(x = componentsClust, y = missing): generates a dendrogram from a given cluster object and optionally highlights resulting branches when the cluster is cut.plotSilhouettes(componentsClust): Plots the average silhouette width when the clusters are cut by a sequence of k numbers. The k value with the highest value (marked in the plot) may be considered as the optimal number of clusters.
Slots
distmDistance matrix that was used for clustering (obtained with
daisy).clustObject returned by
hclust.cutClustersA
listwith assigned clusters (same format as whatcutreereturns).gInfoThe
groupInfoof the feature groups object that was used.propertiesA list containing general properties and parameters used for clustering.
alteredSet to
TRUEif the object was altered (e.g. filtered) after its creation.
Note
The intensity values for components (used by plotSpectrum) are set
to a dummy value (1) as no single intensity value exists for this kind of
components.
When the object is altered (e.g. by filtering or subsetting it), methods that need the original clustered data such as plotting methods do not work anymore and stop with an error.
IMS workflows
When components are re-made by treeCut or treeCutDynamic any
expanded data should be re-added by calling expandForIMS.
References
Schollee JE, Bourgin M, von Gunten U, McArdell CS, Hollender J (2018). “Non-target screening to trace ozonation transformation products in a wastewater treatment train including different post-treatments.” Water Research, 142, 267–278. doi:10.1016/j.watres.2018.05.045 .