calcPerClusterMappingMetric: Per-cluster Confidence Score: Calculates the Mahalanobis...

View source: R/confidenceScores.R

calcPerClusterMappingMetricR Documentation

Per-cluster Confidence Score: Calculates the Mahalanobis distance from user-defined query clusters to their nearest reference centroid after initial projection into reference PCA space. All query cells in a cluster get the same score. Higher distance indicates less confidence. Due to the instability of estimating covariance with small numbers of cells, we do not assign a score to clusters smaller than u * d, where d is the dimensionality of the embedding and u is specified.

Description

Per-cluster Confidence Score: Calculates the Mahalanobis distance from user-defined query clusters to their nearest reference centroid after initial projection into reference PCA space. All query cells in a cluster get the same score. Higher distance indicates less confidence. Due to the instability of estimating covariance with small numbers of cells, we do not assign a score to clusters smaller than u * d, where d is the dimensionality of the embedding and u is specified.

Usage

calcPerClusterMappingMetric(
  reference,
  query,
  query_cluster_labels,
  metric = "mahalanobis",
  u = 2,
  lambda = 0
)

Arguments

reference

Reference object as returned by Symphony buildReference()

query

Query object as returned by Symphony mapQuery()

query_cluster_labels

Vector of user-defined labels denoting clusters / putative novel cell type to calculate the score for

metric

Uses Mahalanobis by default, but added as a parameter for potential future use

u

Do not assign scores to clusters smaller than u * d (see above description)

lambda

Optional ridge parameter added to covariance diagonal to help stabilize numeric estimates

Value

A data.frame of per-cluster mapping metric scores for each user-specified query cluster.


symphony documentation built on Jan. 17, 2023, 1:13 a.m.