ClusterCellsKmeans: Cluster cells with K-means clustering and mini-batch K-means...

Description Usage Arguments Details Value Examples

View source: R/cluster_cells.R

Description

Perform K-means clustering on cells, to obtain cell identities. Based on Seurat::DoKMeans.

Usage

1
2
3
4
5
ClusterCellsKmeans(object, genes.use = NULL, reduction.type = NULL,
  dims.use = NULL, num_init = 5, center = TRUE, k.cells = NULL,
  k.seed = 1, do.plot = FALSE, data.cut = NULL,
  k.cols = PurpleAndYellow(), set.ident = TRUE, minibatch = FALSE,
  do.constrained = FALSE, assay.type = "RNA", ...)

Arguments

object

Seurat object

genes.use

Genes to use for clustering

reduction.type

Name of dimensional reduction technique to use in k-means clustering. If NULL, genes will be used. (default is NULL)

dims.use

A vector of the dimensions to use in k-means clustering graph (e.g. To use the first 10 PCs, pass 1:10)

num_init

A number of times the algorithm will be run with different centroid seeds. (default is 5)

center

Center the cells/rows (default is TRUE)

k.cells

K value to use for clustering cells

k.seed

Random seed

do.plot

Draw heatmap of clustered genes/cells (default is FALSE).

data.cut

Clip all z-scores to have an absolute value below this. Reduces the effect of huge outliers in the data. (default is NULL)

k.cols

Color palette for heatmap

set.ident

If clustering cells (so k.cells>0), set the cell identity class to its K-means cluster (default is TRUE)

minibatch

FALSE by default. If TRUE, use the mini-batch K-means clustering implemented in the ClusterR package.

do.constrained

FALSE by default. If TRUE, use the constrained K-means function implemented in the tclust package.

assay.type

Type of data to normalize for (default is RNA), but can be changed for multimodal analyses.

...

Additional parameters passed to kmeans (or tkmeans)

Details

K-means clustering is performed on either scaled data or reduced dimensions, with a number of subpopulations set to k.cells. After the initial K-means clustering is performed, one can use EvaluateIdent to test individual cell identities, as given by K-means clustering.

Value

Seurat object where the k-means results for genes is stored in object@kmeans.gene[[1]]. The cluster for each cell is stored in object@meta.data[,"kmeans.ident"] and also object@ident (if set.ident=TRUE)

Examples

1
2
3
pbmc_small
# Cluster single cells
pbmc_small <- ClusterCellsKmeans(pbmc_small, k.cells = 3)

ncchung/SeuratAddon documentation built on May 3, 2019, 3:17 p.m.