AutoFindGranuleResolution: AutoFindGranuleResolution

View source: R/gruffi.R

AutoFindGranuleResolutionR Documentation

AutoFindGranuleResolution

Description

AutoFindGranuleResolution

Usage

AutoFindGranuleResolution(
  obj = combined.obj,
  min.med.granule.size = 100,
  max.med.granule.size = 200,
  min.res = round(ncol(obj)/10000),
  max.res = round(ncol(obj)/1000),
  assay = c("integrated", "RNA")[1],
  max.iter = 20,
  clust.method = NULL,
  n.threads = 1
)

Arguments

obj

Seurat object to perform clustering on. Defaults to 'combined.obj'.

min.med.granule.size

Minimum acceptable median cell count per cluster. Default is 100.

max.med.granule.size

Maximum acceptable median cell count per cluster. Default is 200.

min.res

Starting lower bound for clustering resolution search. Defaults to: round(ncol(obj)/10000).

max.res

Starting upper bound for clustering resolution search. Defaults to: round(ncol(obj)/1000).

assay

Specifies the assay to use for clustering. Default is 'integrated, with "RNA" as an alternative taken from on Seurat::DefaultAssay(obj).

max.iter

Maximum number of iterations for adjusting clustering resolution. Default is 20.

clust.method

A Seurat method for running leiden (defaults to matrix which is fast for small datasets). Enable method = "igraph" to avoid casting large data to a dense matrix.

Details

The function iterates over clustering resolutions within the specified bounds to find an optimal resolution that results in median cluster sizes within the target range. It uses Seurat's clustering functionality and adjusts based on the median cell count per cluster.

Value

A Seurat object with updated clustering at the optimal resolution found, including modifications to obj@meta.data and Idents(obj) to reflect the new clustering.

See Also

reexports, FindClusters iprint

Examples

# Assuming `combined.obj` is a pre-loaded Seurat object
optimal.obj <- AutoFindGranuleResolution(obj = combined.obj)


jn-goe/gruffi documentation built on Nov. 7, 2024, 10:38 p.m.