# Class ClusterExperiment

### Description

`ClusterExperiment`

is a class that extends
`SummarizedExperiment`

and is used to store the data
and clustering information.

In addition to the slots of the `SummarizedExperiment`

class, the `ClusterExperiment`

object has the additional slots described
in the Slots section.

There are several methods implemented for this class. The most
important methods (e.g., `clusterMany`

, `combineMany`

,
...) have their own help page. Simple helper methods are described in the
Methods section. For a comprehensive list of methods specific to this class
see the Reference Manual.

The constructor `clusterExperiment`

creates an object of
the class `ClusterExperiment`

. However, the typical way of creating
these objects is the result of a call to `clusterMany`

or
`clusterSingle`

.

Note that when subsetting the data, the co-clustering and dendrogram information are lost.

### Usage

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | ```
clusterExperiment(se, clusters, ...)
## S4 method for signature 'matrix,ANY'
clusterExperiment(se, clusters, ...)
## S4 method for signature 'SummarizedExperiment,numeric'
clusterExperiment(se, clusters, ...)
## S4 method for signature 'SummarizedExperiment,character'
clusterExperiment(se, clusters, ...)
## S4 method for signature 'SummarizedExperiment,factor'
clusterExperiment(se, clusters, ...)
## S4 method for signature 'SummarizedExperiment,matrix'
clusterExperiment(se, clusters,
transformation, primaryIndex = 1, clusterTypes = "User",
clusterInfo = NULL, orderSamples = 1:ncol(se), dendro_samples = NULL,
dendro_index = NA_real_, dendro_clusters = NULL, coClustering = NULL)
``` |

### Arguments

`se` |
a matrix or |

`clusters` |
can be either a numeric or character vector, a factor, or a numeric matrix, containing the cluster labels. |

`...` |
The arguments |

`transformation` |
function. A function to transform the data before performing steps that assume normal-like data (i.e. constant variance), such as the log. |

`primaryIndex` |
integer. Sets the 'primaryIndex' slot (see Slots). |

`clusterTypes` |
a string describing the nature of the clustering. The values 'clusterSingle', 'clusterMany', 'mergeClusters', 'combineMany' are reserved for the clustering coming from the package workflow and should not be used when creating a new object with the constructor. |

`clusterInfo` |
a list with information on the clustering (see Slots). |

`orderSamples` |
a vector of integers. Sets the 'orderSamples' slot (see Slots). |

`dendro_samples` |
dendrogram. Sets the 'dendro_samples' slot (see Slots). |

`dendro_index` |
numeric. Sets the dendro_index slot (see Slots). |

`dendro_clusters` |
dendrogram. Sets the 'dendro_clusters' slot (see Slots). |

`coClustering` |
matrix. Sets the 'coClustering' slot (see Slots). |

### Details

The `clusterExperiment`

constructor function gives clusterLabels
based on the column names of the input matrix/SummarizedExperiment. If
missing, will assign labels "cluster1","cluster2", etc.

### Value

A `ClusterExperiment`

object.

### Slots

`transformation`

function. Function to transform the data by when methods that assume normal-like data (e.g. log)

`clusterMatrix`

matrix. A matrix giving the integer-valued cluster ids for each sample. The rows of the matrix correspond to clusterings and columns to samples. The integer values are assigned in the order that the clusters were found, if found by setting sequential=TRUE in clusterSingle. "-1" indicates the sample was not clustered.

`primaryIndex`

numeric. An index that specifies the primary set of labels.

`clusterInfo`

list. A list with info about the clustering. If created from

`clusterSingle`

, clusterInfo will include the parameter used for the call, and the call itself. If`sequential = TRUE`

it will also include the following components.`clusterInfo`

if sequential=TRUE and clusters were successfully found, a matrix of information regarding the algorithm behavior for each cluster (the starting and stopping K for each cluster, and the number of iterations for each cluster).`whyStop`

if sequential=TRUE and clusters were successfully found, a character string explaining what triggered the algorithm to stop.

`clusterTypes`

character vector with the origin of each column of clusterMatrix.

`dendro_samples`

dendrogram. A dendrogram containing the cluster relationship (leaves are samples; see

`makeDendrogram`

for details).`dendro_clusters`

dendrogram. A dendrogram containing the cluster relationship (leaves are clusters; see

`makeDendrogram`

for details).`dendro_index`

numeric. An integer giving the cluster that was used to make the dendrograms. NA_real_ value if no dendrograms are saved.

`coClustering`

matrix. A matrix with the cluster co-occurrence information; this can either be based on subsampling or on co-clustering across parameter sets (see

`clusterMany`

). The matrix is a square matrix with number of rows/columns equal to the number of samples.`clusterLegend`

a list, one per cluster in

`clusterMatrix`

. Each element of the list is a matrix with nrows equal to the number of different clusters in the clustering, and consisting of at least two columns with the following column names: "clusterId" and "color".`orderSamples`

a numeric vector (of integers) defining the order of samples to be used for plotting of samples. Usually set internally by other functions.

### Examples

1 2 3 4 5 | ```
se <- matrix(data=rnorm(200), ncol=10)
labels <- gl(5, 2)
cc <- clusterExperiment(se, as.numeric(labels), transformation =
function(x){x})
``` |