R: Class "AggExResult"

AggExResult-class {apcluster} | R Documentation

## Class "AggExResult"

### Description

S4 class for storing results of exemplar-based agglomerative clustering

### Objects

Objects of this class can be created by calling `aggExCluster` for a given similarity matrix.

### Slots

The following slots are defined for AggExResult objects:

`l`:

  number of samples in the data set

`sel`:

  subset of samples used for leveraged clustering (empty for normal clustering)

`maxNoClusters`:

  maximum number of clusters in the cluster hierarchy, i.e. it contains clusterings with 1 - `maxNoClusters` clusters.

`exemplars`:

  list of length `maxNoClusters`; the `i`-th component of the list is a vector of `i` exemplars (corresponding to the level with `i` clusters).

`clusters`:

  list of length `maxNoClusters`; the `i`-th component of `clusters` is a list of `i` clusters, each of which is a vector of sample indices.

`merge`:

  a `maxNoClusters-1` by 2 matrix that contains the merging hierarchy; fully analogous to the slot `merge` in the class `hclust`.

`height`:

  a vector of length `maxNoClusters-1` that contains the merging objective of each merge; largely analogous to the slot `height` in the class `hclust` except that the slot `height` in `AggExResult` objects is supposed to be non-increasing, since `aggExCluster` is based on similarities, whereas `hclust` uses dissimilarities.

`order`:

  a vector containing a permutation of indices that can be used for plotting proper dendrograms without crossing branches; fully analogous to the slot `order` in the class `hclust`.

`labels`:

  a character vector containing labels of clustered objects used for plotting dendrograms.

`sim`:

  similarity matrix; only available if `aggExCluster` was called with similarity function and `includeSim=TRUE`.

`call`:

  method call used to produce this clustering result

### Methods

plot

  `signature(x="AggExResult")`: see `plot-methods`

plot

  `signature(x="AggExResult", y="matrix")`: see `plot-methods`

heatmap

  `signature(x="AggExResult")`: see `heatmap-methods`

heatmap

  `signature(x="AggExResult", y="matrix")`: see `heatmap-methods`

show

  `signature(object="AggExResult")`: see `show-methods`

cutree

  `signature(object="AggExResult", k="ANY", h="ANY")`: see `cutree-methods`

length

  `signature(x="AggExResult")`: gives the number of clustering levels in the clustering result.

as.hclust

  `signature(x="AggExResult")`: see `coerce-methods`

as.dendrogram

  `signature(object="AggExResult")`: see `coerce-methods`

### Accessors

In the following code snippets, `x` is an `AggExResult` object.

  `x[[i]]`: Returns an object of class `ExClust` corresponding to the clustering level with `i` clusters; synonymous to `cutree(x, i)`.

  `x[i]`: Returns a list of `ExClust` objects with all clustering levels specified in vector `i`. So, the list has as many components as the argument `i` has elements. A list is returned even if `i` is a single level.

similarity

  `signature(x="AggExResult")`: gives the similarity matrix.

### Author(s)

Ulrich Bodenhofer, Andreas Kothmeier & Johannes Palme apcluster@bioinf.jku.at

### References

http://www.bioinf.jku.at/software/apcluster

Bodenhofer, U., Kothmeier, A., and Hochreiter, S. (2011) APCluster: an R package for affinity propagation clustering. Bioinformatics 27, 2463-2464. DOI: 10.1093/bioinformatics/btr406.

### See Also

`aggExCluster`, `show-methods`, `plot-methods`, `cutree-methods`

### Examples

    ## create two Gaussian clouds
    cl1 <- cbind(rnorm(50, 0.2, 0.05), rnorm(50, 0.8, 0.06))
    cl2 <- cbind(rnorm(50, 0.7, 0.08), rnorm(50, 0.3, 0.05))
    x <- rbind(cl1, cl2)

    ## compute similarity matrix (negative squared Euclidean)
    sim <- negDistMat(x, r=2)

    ## compute agglomerative clustering from scratch
    aggres1 <- aggExCluster(sim)

    ## show results
    show(aggres1)

    ## plot dendrogram
    plot(aggres1)

    ## plot heatmap along with dendrogram
    heatmap(aggres1, sim)

    ## plot level with two clusters
    plot(aggres1, x, k=2)

    ## run affinity propagation
    apres <- apcluster(sim, q=0.7)

    ## create hierarchy of clusters determined by affinity propagation
    aggres2 <- aggExCluster(sim, apres)

    ## show results
    show(aggres2)

    ## plot dendrogram
    plot(aggres2)

    ## plot heatmap
    heatmap(aggres2, sim)

    ## plot level with two clusters
    plot(aggres2, x, k=2)

[Package apcluster version 1.4.7 Index]