API#

Benchmarking pipeline#

Import as:

from scib_metrics.benchmark import Benchmarker

benchmark.Benchmarker(adata, batch_key, ...)

Benchmarking pipeline for the single-cell integration task.

benchmark.BioConservation([isolated_labels, ...])

Specification of bio conservation metrics to run in the pipeline.

benchmark.BatchCorrection([...])

Specification of which batch correction metrics to run in the pipeline.

Metrics#

Import as:

import scib_metrics
scib_metrics.ilisi_knn(...)

isolated_labels(X, labels, batch[, rescale, ...])

Isolated label score [Luecken et al., 2022].

nmi_ari_cluster_labels_kmeans(X, labels)

Compute nmi and ari between k-means clusters and labels.

nmi_ari_cluster_labels_leiden(X, labels[, ...])

Compute nmi and ari between leiden clusters and labels.

pcr_comparison(X_pre, X_post, covariate[, scale])

Principal component regression (PCR) comparison [Büttner et al., 2018].

silhouette_label(X, labels[, rescale, ...])

Average silhouette width (ASW) [Luecken et al., 2022].

silhouette_batch(X, labels, batch[, ...])

Average silhouette width (ASW) with respect to batch ids within each label [Luecken et al., 2022].

ilisi_knn(X, batches[, perplexity, scale])

Compute the integration local inverse simpson index (iLISI) for each cell [Korsunsky et al., 2019].

clisi_knn(X, labels[, perplexity, scale])

Compute the cell-type local inverse simpson index (cLISI) for each cell [Korsunsky et al., 2019].

kbet(X, batches[, alpha])

Compute kbet [Büttner et al., 2018].

kbet_per_label(X, batches, labels[, alpha, ...])

Compute kBET score per cell type label as in [Luecken et al., 2022].

graph_connectivity(X, labels)

Quantify the connectivity of the subgraph per cell type label.

Utils#

utils.cdist(x, y)

Jax implementation of scipy.spatial.distance.cdist().

utils.pdist_squareform(X)

Jax implementation of scipy.spatial.distance.pdist() and scipy.spatial.distance.squareform().

utils.silhouette_samples(X, labels[, chunk_size])

Compute the Silhouette Coefficient for each observation.

utils.KMeans([n_clusters, init, n_init, ...])

Jax implementation of sklearn.cluster.KMeans.

utils.pca(X[, n_components, return_svd])

Principal component analysis (PCA).

utils.principal_component_regression(X, ...)

Principal component regression (PCR) [Büttner et al., 2018].

utils.one_hot(y[, n_classes])

One-hot encode an array.

utils.compute_simpson_index(knn_dists, ...)

Compute the Simpson index for each cell.

utils.convert_knn_graph_to_idx(X)

Convert a kNN graph to indices and distances.

utils.check_square(X)

Check if a matrix is square.

utils.diffusion_nn(X, k[, n_comps])

Diffusion-based neighbors.

Nearest neighbors#

nearest_neighbors.pynndescent(X, n_neighbors)

Run pynndescent approximate nearest neighbor search.

nearest_neighbors.jax_approx_min_k(X, ...[, ...])

Run approximate nearest neighbor search using jax.

nearest_neighbors.NeighborsResults(indices, ...)

Nearest neighbors results data store.

Settings#

An instance of the ScibConfig is available as scib_metrics.settings and allows configuring scib_metrics.

_settings.ScibConfig

Config manager for scib-metrics.