| runKM | R Documentation | 
Executes k-means clustering on multiple subsets of data defined by singular value decomposition (SVD) components, and then aggregates the results into a consensus matrix.
runKM(
  logX,
  v,
  maxSets = 8,
  k,
  consMin = 0.75,
  kmNStart,
  kmMax = 1000,
  BPPARAM = bpparam()
)
logX | 
 A (sparse or dense) numeric matrix representing the transpose of a log-normalized gene expression matrix. Rows correspond to cells, and columns correspond to genes.  | 
v | 
 A matrix of right singular vectors obtained from SVD of a distance matrix derived from 'logX'.  | 
maxSets | 
 (Optional) The maximum number of sub-datasets used for
consensus clustering (default:   | 
k | 
 (Optional) The number of clusters (cell groups) in the data. If not provided, it is estimated using the Tracy-Widom Bound.  | 
consMin | 
 (Optional) The low-pass filter threshold for processing the
consensus matrix (default:   | 
kmNStart | 
 nstart parameter passed to   | 
kmMax | 
 iter.max parameter passed to   | 
BPPARAM | 
 (Optional) A   | 
A consensus matrix summarizing the clustering results across multiple sub-datasets.
library(scater)
library(BiocParallel)
library(splatter)
sce <- splatSimulate(group.prob = rep(1, 5)/5, sparsify = FALSE, 
        batchCells=100, nGenes=1000, method = "groups", verbose = FALSE, 
        dropout.type = "experiment")
sce <- logNormCounts(sce)
cores <- 2
logX <- as.matrix(logcounts(sce))
w <- rowVars_fast(logX, cores)
corMat <- getCorM("spearman", logcounts(sce), w, cores)
v <- doSVD(corMat, nCores=cores)
BPPARAM = MulticoreParam(cores)
consMtx <- runKM(logX, v, BPPARAM=bpparam())
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.