Learn R Programming

Seurat (version 2.3.4)

DoKMeans: K-Means Clustering

Description

Perform k-means clustering on both genes and single cells

Usage

DoKMeans(object, genes.use = NULL, k.genes = NULL, k.cells = 0,
  k.seed = 1, do.plot = FALSE, data.cut = 2.5,
  k.cols = PurpleAndYellow(), set.ident = TRUE, do.constrained = FALSE,
  assay.type = "RNA", ...)

Arguments

object

Seurat object

genes.use

Genes to use for clustering

k.genes

K value to use for clustering genes

k.cells

K value to use for clustering cells (default is NULL, cells are not clustered)

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.

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)

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)

Value

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

Details

K-means and heatmap are calculated on [email protected]

Examples

Run this code
# NOT RUN {
pbmc_small
# Cluster on genes only
pbmc_small <- DoKMeans(pbmc_small, k.genes = 3)
# Cluster on genes and cell
pbmc_small <- DoKMeans(pbmc_small, k.genes = 3, k.cells = 3)

# }

Run the code above in your browser using DataLab