ClusterExperiment-methods {clusterExperiment} | R Documentation

## Helper methods for the ClusterExperiment class

### Description

This is a collection of helper methods for the ClusterExperiment class.

### Usage

    ## S4 method for signature 'ClusterExperiment'
    show(object)

    ## S4 method for signature 'ClusterExperiment'
    transformation(x)

    ## S4 replacement method for signature 'ClusterExperiment,'function''
    transformation(object) <- value

    ## S4 method for signature 'ClusterExperiment'
    nClusterings(x)

    ## S4 method for signature 'ClusterExperiment'
    nClusters(x, ignoreUnassigned = TRUE)

    ## S4 method for signature 'ClusterExperiment'
    nFeatures(x)

    ## S4 method for signature 'ClusterExperiment'
    nSamples(x)

    ## S4 method for signature 'ClusterExperiment'
    clusterMatrixNamed(x, whichClusters = "all")

    ## S4 method for signature 'ClusterExperiment'
    clusterMatrixColors(x, whichClusters = "all")

    ## S4 method for signature 'ClusterExperiment'
    clusterMatrix(x, whichClusters)

    ## S4 method for signature 'ClusterExperiment'
    primaryCluster(x)

    ## S4 method for signature 'ClusterExperiment'
    primaryClusterIndex(x)

    ## S4 method for signature 'ClusterExperiment'
    primaryClusterLabel(x)

    ## S4 method for signature 'ClusterExperiment'
    primaryClusterNamed(x)

    ## S4 method for signature 'ClusterExperiment'
    primaryClusterType(x)

    ## S4 replacement method for signature 'ClusterExperiment,numeric'
    primaryClusterIndex(object) <- value

    ## S4 method for signature 'ClusterExperiment'
    dendroClusterIndex(x)

    ## S4 method for signature 'ClusterExperiment'
    coClustering(x)

    ## S4 replacement method for signature 'ClusterExperiment,matrix'
    coClustering(object) <- value

    ## S4 replacement method for signature 'ClusterExperiment,dsCMatrix'
    coClustering(object) <- value

    ## S4 replacement method for signature 'ClusterExperiment,numeric'
    coClustering(object) <- value

    ## S4 method for signature 'ClusterExperiment'
    clusterTypes(x)

    ## S4 method for signature 'ClusterExperiment'
    clusteringInfo(x)

    ## S4 method for signature 'ClusterExperiment'
    clusterLabels(x)

    ## S4 replacement method for signature 'ClusterExperiment,character'
    clusterLabels(object) <- value

    ## S4 method for signature 'ClusterExperiment'
    clusterLegend(x)

    ## S4 replacement method for signature 'ClusterExperiment,list'
    clusterLegend(object) <- value

    ## S4 method for signature 'ClusterExperiment'
    orderSamples(x)

    ## S4 replacement method for signature 'ClusterExperiment,numeric'
    orderSamples(object) <- value

    ## S4 replacement method for signature 'ClusterExperiment,character'
    clusterTypes(object) <- value

    ## S4 method for signature 'ClusterExperiment'
    addToColData(object, ...)

    ## S4 method for signature 'ClusterExperiment'
    colDataClusters(
      object,
      whichClusters = "primary",
      useNames = TRUE,
      makeFactor = TRUE,
      ...
    )

### Arguments

`x, object` | a ClusterExperiment object.
`value` | The value to be substituted in the corresponding slot. See the slot descriptions in `ClusterExperiment` for details on what objects may be passed to these functions.
`ignoreUnassigned` | logical. If true, ignore the clusters with -1 or -2 assignments in calculating the number of clusters per clustering.
`whichClusters` | argument that can be either numeric or character vector indicating the clusterings to be used. See details of `getClusterIndex`.
`...` | For `addToColData`, arguments passed to `colDataClusters`.
`useNames` | for `tableClusters`, whether the output should be tabled with names (`useNames=TRUE`) or ids (`useNames=FALSE`)
`makeFactor` | logical for `colDataClusters`. If TRUE the clustering will be added to the `colData` slot as a factor. If FALSE, the clustering will be added to the `colData` slot as a character vector if `useNames=TRUE` and as a numeric vector if `useNames=FALSE`.

### Details

Note that redefining the transformation function via `transformation(x)<-` will check the validity of the transformation on the data assay. If the assay is large, this may be time consuming. Consider using a call to ClusterExperiment, which has the option as to whether to check the validity of the transformation.

### Value

`transformation` prints the function used to transform the data prior to clustering.

`nClusterings` returns the number of clusterings (i.e., ncol of clusterMatrix).

`nClusters` returns the number of clusters per clustering

`nFeatures` returns the number of features (same as 'nrow').

`nSamples` returns the number of samples (same as 'ncol').

`clusterMatrixNamed` returns a matrix with cluster labels.

`clusterMatrixColors` returns the matrix with all the clusterings, using the internally stored colors for each cluster

`clusterMatrix` returns the matrix with all the clusterings.

`primaryCluster` returns the primary clustering (as numeric).

`primaryClusterIndex` returns/sets the primary clustering index (i.e., which column of clusterMatrix corresponds to the primary clustering).

`primaryClusterIndex` returns/sets the primary clustering index (i.e., which column of clusterMatrix corresponds to the primary clustering).

`primaryClusterNamed` returns the primary cluster (using cluster labels).

`primaryClusterIndex` returns/sets the primary clustering index (i.e., which column of clusterMatrix corresponds to the primary clustering).

`dendroClusterIndex` returns/sets the clustering index of the clusters used to create dendrogram (i.e., which column of clusterMatrix corresponds to the clustering).

`coClustering` returns/sets the co-clustering matrix.

`clusterTypes` returns/sets the clusterTypes slot.

`clusteringInfo` returns the clusterInfo slot.

`clusterLabels` returns/sets the column names of the clusterMatrix slot.

`clusterLegend` returns/sets the clusterLegend slot.

`orderSamples` returns/sets the orderSamples slot.

`addToColData` returns a `ClusterExperiment` object with the clusterings in clusterMatrix slot added to the `colData` slot

`colDataClusters` returns a `DataFrame` object that has the clusterings in clusterMatrix slot added to the `DataFrame` in the `colData` slot

### Examples

    # load data:
    data(rsecFluidigm)
    show(rsecFluidigm)
    #Number of clusterings
    nClusterings(rsecFluidigm)
    # Number of clusters per clustering
    nClusters(rsecFluidigm)
    # Number of features/samples
    nSamples(rsecFluidigm)
    nFeatures(rsecFluidigm)
    # retrieve all clustering assignments
    # (either as cluster ids, cluster names or cluster colors)
    head(clusterMatrix(rsecFluidigm)[,1:5])
    head(clusterMatrixNamed(rsecFluidigm)[,1:5])
    head(clusterMatrixColors(rsecFluidigm)[,1:5])
    # clustering Types/Labels
    clusterTypes(rsecFluidigm)
    clusterLabels(rsecFluidigm)
    # Add a clustering assignment to the colData of the object
    # (useful if working with function that relies on colData)
    colData(rsecFluidigm)
    test<-addToColData(rsecFluidigm,whichCluster="primary")
    colData(test)

[Package clusterExperiment version 2.14.0 Index]