Skip to contents

This function combines multiple statistical approaches to automatically determine the optimal number of principal components (PCs) for downstream single-cell analysis. It integrates variance-based heuristics, elbow detection algorithms, and provides comprehensive visualization for result validation.

Usage

FindRobustElbow(obj, verbose = TRUE, ndims = 50)

Arguments

obj

A Seurat object that has PCA computed (after RunPCA)

verbose

Logical, if TRUE outputs detailed method results and creates visualization plot. If FALSE returns only the final dimension.

ndims

Integer, maximum number of dimensions to consider (default: 50)

Value

Integer, the recommended number of PCA dimensions for downstream analysis

See also

Other single_cell_preprocess: ClusterAndReduce(), FilterTumorCell(), ProcessSeuratObject(), QCPatternFilter()

Examples

if (FALSE) { # \dontrun{
# After running PCA on Seurat object
pbmc <- RunPCA(pbmc, npcs = 50)
optimal_dims <- FindRobustElbow(pbmc, verbose = TRUE)
pbmc <- FindNeighbors(pbmc, dims = 1:optimal_dims)
} # }