Hiya,
I used to be able to run
from scib_metrics import lisi_knn
labels = adata.obs.perturbation_name.values
labels = np.asarray(pd.Categorical(labels).codes)
adata.obs['lisi'] = lisi_knn(adata.obsp['distances'], labels, perplexity=None)
However, the input to lisi_knn
has since changed to a NeighborsResult object, which I cannot figure out how to generate. Could an example please be provided so that I can continue using these metrics?
Thanks,
Yuge
Bumping this! Would really appreciate a note.
Haven’t touched scib-metrics in a while, but it looks like it’s meant to directly take output nearest neighbor modules like that of sklearn.neighbors.NearestNeighbors (scib-metrics/tests/utils/data.py at v0.5.1 · YosefLab/scib-metrics · GitHub). As long as you can massage the adata.obsp[“distances”] in the same form along with the appropriate indices, it should work.
Usage example: scib-metrics/tests/test_metrics.py at v0.5.1 · YosefLab/scib-metrics · GitHub