Learn R Programming

Seurat (version 1.2.1)

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 = NULL, k.seed = 1, do.plot = TRUE, data.cut = 2.5, k.cols = pyCols, pc.row.order = NULL, pc.col.order = NULL, rev.pc.order = FALSE, use.imputed = FALSE, set.ident = TRUE, ...)

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 TRUE)
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
pc.row.order
Order gene clusters based on the average PC score within a cluster. Can be useful if you want to visualize clusters, for example, based on their average score for PC1.
pc.col.order
Order cell clusters based on the average PC score within a cluster
rev.pc.order
Use the reverse PC ordering for gene and cell clusters (since the sign of a PC is arbitrary)
use.imputed
Cluster imputed values (default is FALSE)
set.ident
If clustering cells (so k.cells>0), set the cell identity class to its K-means cluster (default is TRUE)
...
Additional parameters passed to doHeatMap for plotting

Value

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

Details

K-means and heatmap are calculated on object@scale.data