Teichlab / bbknn

Batch balanced KNN
MIT License
149 stars 25 forks source link

KeyError: 'connectivities' while running running UMAP function #38

Closed aditisk closed 3 years ago

aditisk commented 3 years ago

Hello,

I'm following the tutorial which integrates with Scanpy. I was able to successfully run this line of code:

sc.external.pp.bbknn(adata, batch_key='sample_id',metric='euclidean')

In the next step I get this error:

sc.tl.umap(adata) computing UMAP

KeyError Traceback (most recent call last)

in ----> 1 sc.tl.umap(adata) /miniconda3/envs/scanpy/lib/python3.7/site-packages/scanpy/tools/_umap.py in umap(adata, min_dist, spread, n_components, maxiter, alpha, gamma, negative_sample_rate, init_pos, random_state, a, b, copy, method) 142 X_umap = simplicial_set_embedding( 143 X, --> 144 adata.uns['neighbors']['connectivities'].tocoo(), 145 n_components, 146 alpha, KeyError: 'connectivities' Am I doing something incorrectly ? How can I fix this problem ? Thanks a lot for your help.
ktpolanski commented 3 years ago

It seems you've got some sort of version incompatibility going on - .uns['neighbors']['connectivities'] used to be where you put your graph back in the day, but it's now .obsp['connectivities']. Try upgrading scanpy and see if that helps?