silhouette_width: batch_sil

Description Usage Arguments Value Examples

View source: R/metrics.R

Description

Determine batch/bio effect using the silhouette coefficient (adopted from scone):

Usage

1
silhouette_width(reduction, meta.data, keys)

Arguments

reduction

a matrix of reduced dimensions

meta.data

dataframe with meta.data associated with reduction

keys

columns in meta.data to calculate silhoette for to use (default: all)

Value

The average silhouette width for all clusters. For batch effect, the smaller the better. For biological effect, the larger the better.

Examples

1
2
3
4
5
6
7
8
## calculate the the silhoeuette width score on two sets of labels
## NOTE: this requires computation of a distance matrix, so does not
##       scale well to large datasets
data(sceiad_subset_data)
features <- sceiad_subset_data[, paste0('scviDim_', 1:8)]
metadata <- sceiad_subset_data[,c('Barcode', 'cluster',
              'subcluster', 'CellType', 'CellType_predict')]
silhouette_width(features, metadata, 'CellType_predict')

scPOP documentation built on Aug. 4, 2021, 5:06 p.m.