Description Usage Arguments Details Value Examples
View source: R/cluster_cells.R
Perform K-means clustering on cells, to obtain cell identities.
Based on Seurat::DoKMeans
.
1 2 3 4 5 |
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) |
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.
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)
1 2 3 | pbmc_small
# Cluster single cells
pbmc_small <- ClusterCellsKmeans(pbmc_small, k.cells = 3)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.