benchmark.clustering: Benchmarks the cluster assignments

Description Usage Arguments Value Examples

View source: R/benchmark.clustering.R

Description

Supervised (ARI and NMI) and unsupervised (ASW, Dunn Index, and Connectivity) benchmarking metrics are calculated for cluster assignments. assays, clustering and reduction for distance calculations are iterated through.

Usage

1
2
3
4
5
6
7
8
9
benchmark.clustering(
  object,
  assay,
  clustering,
  reduction,
  n.dims = 2,
  dist.method = "euclidean",
  ground.truth = NULL
)

Arguments

object

IBRAP S4 class object

assay

Character. String containing indicating which assay to use

clustering

Character. The names of the cluster assignment dataframes to use

reduction

Character. Which reduction(s) within the assay should be supplied for distance calcultions

n.dims

Numerical. How many dimensions of the reduction should be supplied. Default = 1:3

dist.method

Character. Which distance method should be used, options: 'euclidean', 'maximum', 'manhattan', 'canberra', 'binary', 'minkowski'. Default = 'euclidean'

ground.truth

Vector. If available, supply the vector in the same order as colnames of the ground truth, i.e. true cell type labels. If this is not supplied, only unsupervised methods will be supplied. Default = NULL

Value

Benchmarking scores for the supplied cluster assignments

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
# without ground truth labels 

object <- benchmark.clustering(object = object, assay = c('SCT', 'SCRAN', 'SCANPY'), 
                                         clustering = c("pca_harmony_nn:louvain"), 
                                         reduction = c('pca_harmony_umap'), 
                                         n.dims = 1:2)

# With ground truth labels 

object <- benchmark.clustering(object = object, assay = c('SCT', 'SCRAN', 'SCANPY'), 
                                         clustering = c("pca_harmony_nn.v1:louvain"), 
                                         reduction = c('pca_harmony_umap'), 
                                         n.dims = 1:2, ground.truth = metadata$celltypes)

connorhknight/IBRAP_no_decontX documentation built on Feb. 13, 2022, 2:32 p.m.