dpeerlab / Palantir

Single cell trajectory detection
https://palantir.readthedocs.io
GNU General Public License v2.0
213 stars 50 forks source link

`AttributeError: 'AnnData' object has no attribute 'values'` in the tutorial notebook `Palantir_sample_notebook.ipynb` #129

Closed danli349 closed 8 months ago

danli349 commented 8 months ago

Hi

I run the tutorial notebook Palantir_sample_notebook.ipynb:

# Run diffusion maps
dm_res = palantir.utils.run_diffusion_maps(ad, n_components=5)
Determing nearest neighbor graph...
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
Cell In[8], line 2
      1 # Run diffusion maps
----> 2 dm_res = palantir.utils.run_diffusion_maps(ad, n_components=5)

File ~/miniconda3/lib/python3.8/site-packages/palantir/utils.py:57, in run_diffusion_maps(data_df, n_components, knn, alpha, seed)
     55 if not issparse(data_df):
     56     print("Determing nearest neighbor graph...")
---> 57     temp = sc.AnnData(data_df.values)
     58     sc.pp.neighbors(temp, n_pcs=0, n_neighbors=knn)
     59     kNN = temp.obsp['distances']

AttributeError: 'AnnData' object has no attribute 'values'

scanpy==1.9.5 anndata==0.8.0 umap==0.5.3 numpy==1.23.0 scipy==1.10.1 pandas==1.5.3 scikit-learn==1.2.2 statsmodels==0.12.1 igraph==0.10.8 louvain==0.8.1 pynndescent==0.5.8 palantir==1.2

Could you please let me know how to fix this error? Thanks

danli349 commented 8 months ago

I fixed this error by upgrading to palantir==1.3.2, Thanks

katosh commented 8 months ago

Good call. Thanks!