diff --git a/src/palantir/core.py b/src/palantir/core.py index 228c39e7..d24b7456 100644 --- a/src/palantir/core.py +++ b/src/palantir/core.py @@ -316,7 +316,7 @@ def _construct_markov_chain(wp_data, knn, pseudotime, n_jobs): # Directed graph construction # pseudotime position of all the neighbors traj_nbrs = pd.DataFrame( - pseudotime[np.ravel(waypoints[ind])].values.reshape( + pseudotime[np.ravel(waypoints.values[ind])].values.reshape( [len(waypoints), n_neighbors] ), index=waypoints, diff --git a/src/palantir/utils.py b/src/palantir/utils.py index d3e533aa..f7b6d17a 100644 --- a/src/palantir/utils.py +++ b/src/palantir/utils.py @@ -38,11 +38,7 @@ def run_diffusion_maps(data_df, n_components=10, knn=30, alpha=0): print("Determing nearest neighbor graph...") temp = sc.AnnData(data_df.values) sc.pp.neighbors(temp, n_pcs=0, n_neighbors=knn) - # maintaining backwards compatibility to Scanpy `sc.pp.neighbors` - try: - kNN = temp.uns["neighbors"]["distances"] - except KeyError: - kNN = temp.obsp['distances'] + kNN = temp.obsp['distances'] # Adaptive k adaptive_k = int(np.floor(knn / 3))