Skip to content

Commit

Permalink
scanpy<1.10 compat
Browse files Browse the repository at this point in the history
  • Loading branch information
ivirshup committed Mar 28, 2024
1 parent b4fccbb commit 140c54b
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion muon/_core/preproc.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
from sklearn.utils import check_random_state

from anndata import AnnData
import scanpy
from scanpy import logging
from scanpy.tools._utils import _choose_representation
from scanpy.neighbors._connectivity import umap
Expand All @@ -26,6 +27,13 @@
from umap.umap_ import nearest_neighbors
from numba import njit, prange

from packaging.version import Version

if Version(scanpy.__version__) < Version("1.10"):
from scanpy.neighbors import _compute_connectivities_umap
else:
from scanpy.neighbors._connectivity import umap as _compute_connectivities_umap

from mudata import MuData

# Computational methods for preprocessing
Expand Down Expand Up @@ -585,7 +593,7 @@ def neighdist(cell, nz):
neighbordistances = _sparse_csr_fast_knn(neighbordistances, n_neighbors + 1)

logging.info("Calculating connectivities...")
connectivities = umap(
connectivities = _compute_connectivities_umap(
knn_indices=neighbordistances.indices.reshape(
(neighbordistances.shape[0], n_neighbors + 1)
),
Expand Down

0 comments on commit 140c54b

Please sign in to comment.