dpeerlab / Palantir

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

palantir don't find values inside anndata #110

Closed rdesantis90 closed 1 year ago

rdesantis90 commented 1 year ago

hi! thank you for your work! palantir is amazing. I am an old user and I recently started to use the new version but I encountered some issues, it seems that palantir cannot fetch the count matrix inside the anndata object, please see the error below. Can you help my fix this?

dm_res = palantir.utils.run_diffusion_maps(ad, n_components=5) Determing nearest neighbor graph...

AttributeError Traceback (most recent call last) in <cell line: 2>() 1 # Run diffusion maps ----> 2 dm_res = palantir.utils.run_diffusion_maps(ad, n_components=5)

/usr/local/lib/python3.10/dist-packages/palantir/utils.py 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'

my installation is: Requirement already satisfied: palantir in /usr/local/lib/python3.10/dist-packages (1.2) Requirement already satisfied: numpy>=1.14.2 in /usr/local/lib/python3.10/dist-packages (from palantir) (1.24.4) Requirement already satisfied: pandas>=0.22.0 in /usr/local/lib/python3.10/dist-packages (from palantir) (1.5.3) Requirement already satisfied: scipy>=1.3 in /usr/local/lib/python3.10/dist-packages (from palantir) (1.10.1) Requirement already satisfied: networkx>=2.1 in /usr/local/lib/python3.10/dist-packages (from palantir) (3.1) Requirement already satisfied: scikit-learn in /usr/local/lib/python3.10/dist-packages (from palantir) (1.2.2) Requirement already satisfied: joblib in /usr/local/lib/python3.10/dist-packages (from palantir) (1.2.0) Requirement already satisfied: fcsparser>=0.1.2 in /usr/local/lib/python3.10/dist-packages (from palantir) (0.2.6) Requirement already satisfied: PhenoGraph>=1.5.3 in /usr/local/lib/python3.10/dist-packages (from palantir) (1.5.7) Requirement already satisfied: tables>=3.4.2 in /usr/local/lib/python3.10/dist-packages (from palantir) (3.8.0) Requirement already satisfied: Cython in /usr/local/lib/python3.10/dist-packages (from palantir) (0.29.35) Requirement already satisfied: cmake in /usr/local/lib/python3.10/dist-packages (from palantir) (3.25.2) Requirement already satisfied: matplotlib>=2.2.2 in /usr/local/lib/python3.10/dist-packages (from palantir) (3.7.1) Requirement already satisfied: seaborn>=0.8.1 in /usr/local/lib/python3.10/dist-packages (from palantir) (0.12.2) Requirement already satisfied: tzlocal in /usr/local/lib/python3.10/dist-packages (from palantir) (5.0.1) Requirement already satisfied: scanpy>=1.6.0 in /usr/local/lib/python3.10/dist-packages (from palantir) (1.9.3) Requirement already satisfied: pygam in /usr/local/lib/python3.10/dist-packages (from palantir) (0.9.0) Requirement already satisfied: contourpy>=1.0.1 in /usr/local/lib/python3.10/dist-packages (from matplotlib>=2.2.2->palantir) (1.1.0) Requirement already satisfied: cycler>=0.10 in /usr/local/lib/python3.10/dist-packages (from matplotlib>=2.2.2->palantir) (0.11.0) Requirement already satisfied: fonttools>=4.22.0 in /usr/local/lib/python3.10/dist-packages (from matplotlib>=2.2.2->palantir) (4.40.0) Requirement already satisfied: kiwisolver>=1.0.1 in /usr/local/lib/python3.10/dist-packages (from matplotlib>=2.2.2->palantir) (1.4.4) Requirement already satisfied: packaging>=20.0 in /usr/local/lib/python3.10/dist-packages (from matplotlib>=2.2.2->palantir) (23.1) Requirement already satisfied: pillow>=6.2.0 in /usr/local/lib/python3.10/dist-packages (from matplotlib>=2.2.2->palantir) (8.4.0) Requirement already satisfied: pyparsing>=2.3.1 in /usr/local/lib/python3.10/dist-packages (from matplotlib>=2.2.2->palantir) (3.1.0) Requirement already satisfied: python-dateutil>=2.7 in /usr/local/lib/python3.10/dist-packages (from matplotlib>=2.2.2->palantir) (2.8.2) Requirement already satisfied: pytz>=2020.1 in /usr/local/lib/python3.10/dist-packages (from pandas>=0.22.0->palantir) (2022.7.1) Requirement already satisfied: leidenalg>=0.8.2 in /usr/local/lib/python3.10/dist-packages (from PhenoGraph>=1.5.3->palantir) (0.10.0) Requirement already satisfied: setuptools>=18.0.1 in /usr/local/lib/python3.10/dist-packages (from PhenoGraph>=1.5.3->palantir) (67.7.2) Requirement already satisfied: psutil>4 in /usr/local/lib/python3.10/dist-packages (from PhenoGraph>=1.5.3->palantir) (5.9.5) Requirement already satisfied: anndata>=0.7.4 in /usr/local/lib/python3.10/dist-packages (from scanpy>=1.6.0->palantir) (0.8.0) Requirement already satisfied: h5py>=3 in /usr/local/lib/python3.10/dist-packages (from scanpy>=1.6.0->palantir) (3.8.0) Requirement already satisfied: tqdm in /usr/local/lib/python3.10/dist-packages (from scanpy>=1.6.0->palantir) (4.65.0) Requirement already satisfied: statsmodels>=0.10.0rc2 in /usr/local/lib/python3.10/dist-packages (from scanpy>=1.6.0->palantir) (0.13.5) Requirement already satisfied: patsy in /usr/local/lib/python3.10/dist-packages (from scanpy>=1.6.0->palantir) (0.5.3) Requirement already satisfied: natsort in /usr/local/lib/python3.10/dist-packages (from scanpy>=1.6.0->palantir) (8.3.1) Requirement already satisfied: numba>=0.41.0 in /usr/local/lib/python3.10/dist-packages (from scanpy>=1.6.0->palantir) (0.57.1) Requirement already satisfied: umap-learn>=0.3.10 in /usr/local/lib/python3.10/dist-packages (from scanpy>=1.6.0->palantir) (0.5.3) Requirement already satisfied: session-info in /usr/local/lib/python3.10/dist-packages (from scanpy>=1.6.0->palantir) (1.0.0) Requirement already satisfied: threadpoolctl>=2.0.0 in /usr/local/lib/python3.10/dist-packages (from scikit-learn->palantir) (3.1.0) Requirement already satisfied: numexpr>=2.6.2 in /usr/local/lib/python3.10/dist-packages (from tables>=3.4.2->palantir) (2.8.4) Requirement already satisfied: blosc2~=2.0.0 in /usr/local/lib/python3.10/dist-packages (from tables>=3.4.2->palantir) (2.0.0) Requirement already satisfied: py-cpuinfo in /usr/local/lib/python3.10/dist-packages (from tables>=3.4.2->palantir) (9.0.0) Requirement already satisfied: progressbar2<5.0.0,>=4.2.0 in /usr/local/lib/python3.10/dist-packages (from pygam->palantir) (4.2.0) Requirement already satisfied: msgpack in /usr/local/lib/python3.10/dist-packages (from blosc2~=2.0.0->tables>=3.4.2->palantir) (1.0.5) Requirement already satisfied: igraph<0.11,>=0.10.0 in /usr/local/lib/python3.10/dist-packages (from leidenalg>=0.8.2->PhenoGraph>=1.5.3->palantir) (0.10.5) Requirement already satisfied: llvmlite<0.41,>=0.40.0dev0 in /usr/local/lib/python3.10/dist-packages (from numba>=0.41.0->scanpy>=1.6.0->palantir) (0.40.1) Requirement already satisfied: python-utils>=3.0.0 in /usr/local/lib/python3.10/dist-packages (from progressbar2<5.0.0,>=4.2.0->pygam->palantir) (3.7.0) Requirement already satisfied: six>=1.5 in /usr/local/lib/python3.10/dist-packages (from python-dateutil>=2.7->matplotlib>=2.2.2->palantir) (1.16.0) Requirement already satisfied: pynndescent>=0.5 in /usr/local/lib/python3.10/dist-packages (from umap-learn>=0.3.10->scanpy>=1.6.0->palantir) (0.5.10) Requirement already satisfied: stdlib-list in /usr/local/lib/python3.10/dist-packages (from session-info->scanpy>=1.6.0->palantir) (0.9.0) Requirement already satisfied: texttable>=1.6.2 in /usr/local/lib/python3.10/dist-packages (from igraph<0.11,>=0.10.0->leidenalg>=0.8.2->PhenoGraph>=1.5.3->palantir) (1.6.7) Requirement already satisfied: typing-extensions>3.10.0.2 in /usr/local/lib/python3.10/dist-packages (from python-utils>=3.0.0->progressbar2<5.0.0,>=4.2.0->pygam->palantir) (4.6.3)

ManuSetty commented 1 year ago

Thank you for your interest!

We have made changes to the interface that are still getting propagated to pip. In the meantime, please install directly from GitHub pip install git+https://github.com/dpeerlab/Palantir.git to grab the latest version which should fix this issue.

rdesantis90 commented 1 year ago

it worked! Thank you very much