runKMeans: Get clustering with KMeans

Description Usage Arguments Value Examples

View source: R/getCluster.R

Description

Perform KMeans clustering on a SingleCellExperiment object, with kmeans.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
runKMeans(
  inSCE,
  useReducedDim = "PCA",
  clusterName = "KMeans_cluster",
  nCenters,
  nIter = 10,
  nStart = 1,
  seed = 12345,
  algorithm = c("Hartigan-Wong", "Lloyd", "MacQueen")
)

Arguments

inSCE

A SingleCellExperiment object.

useReducedDim

A single character, specifying which low-dimension representation to perform the clustering algorithm on. Default "PCA".

clusterName

A single character, specifying the name to store the cluster label in colData. Default "scranSNN_cluster".

nCenters

An integer, the number of centroids (clusters).

nIter

An integer, the maximum number of iterations allowed. Default 10.

nStart

An integer, the number of random sets to choose. Default 1.

seed

An integer. The seed for the random number generator. Default 12345.

algorithm

A single character. Choose from "Hartigan-Wong", "Lloyd", "MacQueen". May be abbreviated. Default "Hartigan-Wong".

Value

The input SingleCellExperiment object with factor cluster labeling updated in colData(inSCE)[[clusterName]].

Examples

1
2
3
4
data("mouseBrainSubsetSCE")
mouseBrainSubsetSCE <- runKMeans(mouseBrainSubsetSCE,
                                 useReducedDim = "PCA_logcounts",
                                 nCenters = 2)

singleCellTK documentation built on Nov. 8, 2020, 5:21 p.m.