scib.metrics.ilisi_graph

scib.metrics.ilisi_graph(adata, batch_key, type_, use_rep='X_emb', k0=90, subsample=None, scale=True, n_cores=1, verbose=False)

Integration LISI (iLISI) score

Local Inverse Simpson’s Index metrics adapted from Korsunsky et al. 2019 to run on all full feature, embedding and kNN integration outputs via shortest path-based distance computation on single-cell kNN graphs. By default, this function returns a value scaled between 0 and 1 instead of the original LISI range of 0 to the number of batches.

Parameters:
  • adata – adata object to calculate on

  • batch_key – batch column name in adata.obs

  • type_ – type of data integration, one of ‘knn’, ‘embed’ or ‘full’

  • use_rep – embedding slot in .obsm, only used for embedding input

  • k0 – number of nearest neighbors to compute lisi score Please note that the initial neighborhood size that is used to compute shortest paths is 15.

  • subsample – Percentage of observations (integer between 0 and 100) to which lisi scoring should be subsampled

  • scale – scale output values between 0 and 1 (True/False)

  • n_cores – number of cores (i.e. CPUs or CPU cores to use for multiprocessing)

Returns:

Median of iLISI scores per batch labels

This function can be applied to all integration output types and recomputes the kNN graph for feature and embedding output with specific parameters. Thus, no preprocessing is required, but the correct output type must be specified in type_.

Examples

# feature output or unintegrated object
scib.me.ilisi_graph(adata, batch_key="batch", type="full")

# embeding output
scib.me.ilisi_graph(adata, batch_key="batch", type="embed", use_rep="X_emb")

# knn output
scib.me.ilisi_graph(adata, batch_key="batch", type="knn")