clusterCells {scran} | R Documentation

## Cluster cells in a SingleCellExperiment

### Description

A SingleCellExperiment-compatible wrapper around `clusterRows` from the bluster package.

### Usage

    clusterCells(
      x,
      assay.type = NULL,
      use.dimred = NULL,
      BLUSPARAM = NNGraphParam(),
      ...
    )

### Arguments

`x` | A SummarizedExperiment or SingleCellExperiment object containing cells in the columns.
`assay.type` | Integer or string specifying the assay values to use for clustering, typically log-normalized expression.
`use.dimred` | Integer or string specifying the reduced dimensions to use for clustering, typically PC scores. Only used when `assay.type=NULL`, and only applicable if `x` is a SingleCellExperiment.
`BLUSPARAM` | A BlusterParam object specifying the clustering algorithm to use, defaults to a graph-based method.
`...` | Further arguments to pass to `clusterRows`.

### Details

This is largely a convenience wrapper to avoid the need to manually extract the relevant assays or reduced dimensions from `x`. Altering `BLUSPARAM` can easily change the parameters or algorithm used for clustering - see `?"BlusterParam-class"` for more details.

### Value

A factor of cluster identities for each cell in `x`, or a list containing such a factor - see the return value of `?clusterRows`.

### Author(s)

Aaron Lun

### Examples

    library(scuttle)
    sce <- mockSCE()
    sce <- logNormCounts(sce)

    # From log-expression values:
    clusters <- clusterCells(sce, assay.type="logcounts")

    # From PCs:
    sce <- scater::runPCA(sce)
    clusters2 <- clusterCells(sce, use.dimred="PCA")

    # With different parameters:
    library(bluster)
    clusters3 <- clusterCells(sce, use.dimred="PCA", BLUSPARAM=NNGraphParam(k=5))

    # With different algorithms:
    clusters4 <- clusterCells(sce, use.dimred="PCA", BLUSPARAM=KmeansParam(centers=10))

[Package scran version 1.22.1 Index]