Skip to content

Commit

Permalink
Merge pull request #43 from dpeerlab/issue41
Browse files Browse the repository at this point in the history
Fix for issue 41
  • Loading branch information
awnimo authored Sep 3, 2020
2 parents 91f301b + a1b20c2 commit 33aa7fc
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/palantir/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
6 changes: 1 addition & 5 deletions src/palantir/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down

0 comments on commit 33aa7fc

Please # to comment.