From 9271d920368fd499f198bb21c875fc6c423c354a Mon Sep 17 00:00:00 2001 From: Zhongzheng Li <103617127+Zhongzheng99@users.noreply.github.com> Date: Wed, 7 Aug 2024 23:57:14 +0800 Subject: [PATCH] Update utils.py (#410) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In some versions of scipy(e.g. 1.14), M.A might not be available. In such cases, you should use M.toarray() to convert the sparse matrix to a dense one. Co-authored-by: Michaela Müller <51025211+mumichae@users.noreply.github.com> --- scib/metrics/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scib/metrics/utils.py b/scib/metrics/utils.py index f3af7327..ee558f4e 100644 --- a/scib/metrics/utils.py +++ b/scib/metrics/utils.py @@ -138,7 +138,7 @@ def diffusion_nn(adata, k, max_iterations=26): ) M.setdiag(0) - k_indices = np.argpartition(M.A, -k, axis=1)[:, -k:] + k_indices = np.argpartition(M.toarray(), -k, axis=1)[:, -k:] return k_indices