mantispy.metrics.lisi#
- mantispy.metrics.lisi(adata, key, use_rep='X_pca', perplexity=30, kind='auto')#
Median LISI over rows [Korsunsky et al., 2019].
- Parameters:
adata (
AnnData) – Object with the embedding to measure in.key (
str) –obscolumn whose labels the neighborhoods are scored over.use_rep (
str(default:'X_pca')) –obsmkey of the embedding.perplexity (
float(default:30)) – Perplexity the kernel width is calibrated to. Each neighborhood holds3 * perplexityrows, so an object with no more rows than that cannot support it and the value is NaN.kind (
str(default:'auto')) –"batch"names the resultilisi(higher is better mixed) and"label"names itclisi(lower means the biological groups stay separated)."auto"guesses from the column name: a key containing batch, plate, source, week or run is a batch and anything else a label, so"Metadata_Site"counts as a label. Passkindexplicitly when one table holds both, or the two rows get the same metric name.
- Return type:
- Returns:
A one-row tidy frame holding
ilisiorclisi, whose value is NaN when the object holds too few rows forperplexity, which is what a 48-well plate or a consensus object with one row per perturbation does.- Raises:
KeyError –
obsmholds nothing underuse_rep.ValueError –
kindis not one of the three accepted values.ValueError –
obs[key]has missing values.