scvi metrics

use the scib-metrics package to assess the quality of the integration.

Parameters

batch_key: str Use a batch key.


label_key: str Use a label key.


Web view

scvi_metrics_screenshot

Python equivalent

import scanpy as sc
from scib_metrics.benchmark import Benchmarker

SCANVI_LATENT_KEY = "X_scANVI"
SCVI_LATENT_KEY = "X_scVI"

latent_keys = []
if SCVI_LATENT_KEY in adata.obsm_keys():
    latent_keys.append(SCVI_LATENT_KEY) 
    if SCANVI_LATENT_KEY in adata.obsm_keys():
        latent_keys.append(SCANVI_LATENT_KEY)
    sc.tl.pca(adata)
    latent_keys.append("X_pca")

    bm = Benchmarker(
        adata,
        batch_key="_scvi_batch",
        label_key="_scvi_batch",
        embedding_obsm_keys=latent_keys,
        n_jobs=-1,
    )

    bm.benchmark()
    df = bm.get_results(min_max_scale=False)
    print(df)