ComputeSilhouette_Ser | R Documentation |
This function calculates the silhouette score for a Seurat object based on the provided dimensional reduction method (e.g., PCA, UMAP) and the metadata label (e.g., batch or biological annotation).
ComputeSilhouette_Ser(
SerObj,
reduction = "pca",
dims = 1:15,
batch.label = "cell_type"
)
SerObj |
A Seurat object containing the single-cell RNA-seq data. |
reduction |
Character. The dimensional reduction method to use for computing the silhouette score (e.g., "pca", "umap"). Default is '"pca"'. |
dims |
Numeric vector. The dimensions of the reduced embedding to use. Default is '1:15'. |
batch.label |
Character. The metadata label from 'SerObj@meta.data' to use for silhouette computation (e.g., "batch", "cell_type"). Default is '"cell_type"'. |
The average silhouette width for the given reduction and metadata label. Higher scores indicate better separation of the specified groups.
# Compute silhouette score for PCA reduction using cell_type as labels
silhouette_score <- ComputeSilhouette_Ser(SerObj, reduction = "pca", dims = 1:15, batch.label = "cell_type")
# Compute silhouette score for UMAP reduction using batch as labels
silhouette_score <- ComputeSilhouette_Ser(SerObj, reduction = "umap", dims = 1:10, batch.label = "batch")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.