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.
FindClusters(object, genes.use = NULL, reduction.type = "pca",
dims.use = NULL, k.param = 30, plot.SNN = FALSE, prune.SNN = 1/15,
print.output = TRUE, distance.matrix = NULL, save.SNN = FALSE,
reuse.SNN = FALSE, force.recalc = FALSE, nn.eps = 0,
modularity.fxn = 1, resolution = 0.8, algorithm = 1, n.start = 100,
n.iter = 10, random.seed = 0, temp.file.location = NULL,
edge.file.name = NULL)
Seurat object
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).
Name of dimensional reduction technique to use in construction of SNN graph. (e.g. "pca", "ica")
A vector of the dimensions to use in construction of the SNN graph (e.g. To use the first 10 PCs, pass 1:10)
Defines k for the k-nearest neighbor algorithm
Plot the SNN graph
Sets the cutoff for acceptable Jaccard index 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).
Whether or not to print output to the console
Build SNN from distance matrix (experimental)
Saves the SNN matrix associated with the calculation in object@snn
Force utilization of stored SNN. If none store, this will throw an error.
Force recalculation of SNN.
Error bound when performing nearest neighbor seach using RANN; default of 0.0 implies exact nearest neighbor search
Modularity function (1 = standard; 2 = alternative).
Value of the resolution parameter, use a value above (below) 1.0 if you want to obtain a larger (smaller) number of communities.
Algorithm for modularity optimization (1 = original Louvain algorithm; 2 = Louvain algorithm with multilevel refinement; 3 = SLM algorithm).
Number of random starts.
Maximal number of iterations per random start.
Seed of the random number generator.
Directory where intermediate files will be written. Specify the ABSOLUTE path.
Edge file to use as input for modularity optimizer jar.
Returns a Seurat object and optionally the SNN matrix, object@ident has been updated with new cluster info
# 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