This function calculates silhouette scores for each cell in a Seurat object based on the clusters specified in a metadata column. It adds the silhouette scores to the metadata for PCA, UMAP, and t-SNE embeddings.

clusterTH_silhouette_score(seurat_obj, cluster_col)

Arguments

seurat_obj

A Seurat object.

cluster_col

A column name in the metadata specifying clusters.

Value

A data.frame containing the silhouette scores for PCA, UMAP, and t-SNE embeddings.

Examples

library(Seurat)
# Assuming seurat_obj is a Seurat object and "Cell_line" is a metadata column
scores <- clusterTH_silhouette_score(seurat_obj, "Cell_line")
#> Error in clusterTH_silhouette_score(seurat_obj, "Cell_line"): Column Cell_line not found in metadata
head(scores)
#> Error in h(simpleError(msg, call)): error in evaluating the argument 'x' in selecting a method for function 'head': object 'scores' not found