resTuner: Generate a specific number of clusters by tuning the...

View source: R/resTuner.R

resTunerR Documentation

Generate a specific number of clusters by tuning the resolution parameter of graph-based clustering algorithms

Description

Existing functions for graph-based clustering allow users to obtain a larger or smaller number of clusters by varying parameters, in particular the resolution parameter. This function allows users to directly control the number of clusters by iteratively updating the resolution parameter such that a certain number of clusters are generated. The cluster_number parameter can be an exact number of clusters or a range. Clustering can be repeated to obtain variant clusterings with the desired number of clusters.

Usage

resTuner(
  input_data,
  cluster_number,
  cluster_repeats = 5,
  seed_resolution = 0.005,
  max_iter = 10,
  cluster_function = Dufy::seurat_cluster_wrapper,
  label_prefix = "seurat_",
  ...
)

Arguments

input_data

A matrix where features correspond to rows and cells correspond to columns.

cluster_number

Either a positive integer specifying the exact number of clusters desired or a vector of length two specifying range.

cluster_repeats

The number of rounds of clusterings to perform. Default: 5.

seed_resolution

The initial value of resolution.

max_iter

The maximum number of iterations per clustering. Default: 10.

cluster_function

A resTuner-compatible function that performs nearest-neighbor graph generation and graph-based clustering. Must contain these three named arguments: input_data, resolution, and k. Must return a vector of length ncol(input_data) containing cluster assignments. Default: seurat_cluster_wrapper

label_prefix

A character string to be prepended to the colnames of the returned matrix.

...

Additional arguments passed to cluster_function

Value

A ncol(input_data) by cluster_repeats matrix containing cluster assignments.

Author(s)

Kevin Brulois


kbrulois/Dufy documentation built on May 4, 2022, 3:54 a.m.