Learn R Programming

Seurat (version 2.1.0)

FindClusters: Cluster Determination

Description

Identify clusters of cells by a shared nearest neighbor (SNN) modularity optimization based clustering algorithm. First calculate k-nearest neighbors and construct the SNN graph. Then optimize the modularity function to determine clusters. For a full description of the algorithms, see Waltman and van Eck (2013) The European Physical Journal B.

Usage

FindClusters(object, genes.use = NULL, reduction.type = "pca",
  dims.use = NULL, k.param = 30, k.scale = 25, plot.SNN = FALSE,
  prune.SNN = 1/15, print.output = TRUE, distance.matrix = NULL,
  save.SNN = FALSE, reuse.SNN = FALSE, force.recalc = FALSE,
  modularity.fxn = 1, resolution = 0.8, algorithm = 1, n.start = 100,
  n.iter = 10, random.seed = 0, temp.file.location = NULL)

Arguments

object

Seurat object

genes.use

A vector of gene names to use in construction of SNN graph if building directly based on expression data rather than a dimensionally reduced representation (i.e. PCs).

reduction.type

Name of dimensional reduction technique to use in construction of SNN graph. (e.g. "pca", "ica")

dims.use

A vector of the dimensions to use in construction of the SNN graph (e.g. To use the first 10 PCs, pass 1:10)

k.param

Defines k for the k-nearest neighbor algorithm

k.scale

Granularity option for k.param

plot.SNN

Plot the SNN graph

prune.SNN

Sets the cutoff for acceptable Jaccard distances when computing the neighborhood overlap for the SNN construction. Any edges with values less than or equal to this will be set to 0 and removed from the SNN graph. Essentially sets the strigency of pruning (0 --- no pruning, 1 --- prune everything).

print.output

Whether or not to print output to the console

distance.matrix

Build SNN from distance matrix (experimental)

save.SNN

Saves the SNN matrix associated with the calculation in object@snn

reuse.SNN

Force utilization of stored SNN. If none store, this will throw an error.

force.recalc

Force recalculation of SNN.

modularity.fxn

Modularity function (1 = standard; 2 = alternative).

resolution

Value of the resolution parameter, use a value above (below) 1.0 if you want to obtain a larger (smaller) number of communities.

algorithm

Algorithm for modularity optimization (1 = original Louvain algorithm; 2 = Louvain algorithm with multilevel refinement; 3 = SLM algorithm).

n.start

Number of random starts.

n.iter

Maximal number of iterations per random start.

random.seed

Seed of the random number generator.

temp.file.location

Directory where intermediate files will be written. Specify the ABSOLUTE path.

Value

Returns a Seurat object and optionally the SNN matrix, object@ident has been updated with new cluster info

Examples

Run this code
# NOT RUN {
pbmc_small
pmbc_small <- FindClusters(
  object = pbmc_small,
  reduction.type = "pca",
  dims.use = 1:10,
  save.SNN = TRUE
)
# To explore a range of clustering options, pass a vector of values to the resolution parameter
pbmc_small <- FindClusters(
  object = pbmc_small,
  reduction.type = "pca",
  resolution = c(0.4, 0.8, 1.2),
  dims.use = 1:10,
  save.SNN = TRUE
)
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab