Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sc.external.tl.palantir uses invalid keywork in run_diffusion_maps() #2608

Closed
3 tasks done
soerenab opened this issue Aug 9, 2023 · 3 comments · Fixed by #2672
Closed
3 tasks done

sc.external.tl.palantir uses invalid keywork in run_diffusion_maps() #2608

soerenab opened this issue Aug 9, 2023 · 3 comments · Fixed by #2672
Labels

Comments

@soerenab
Copy link

soerenab commented Aug 9, 2023

Please make sure these conditions are met

  • I have checked that this issue has not already been reported.
  • I have confirmed this bug exists on the latest version of scanpy.
  • (optional) I have confirmed this bug exists on the master branch of scanpy.

What happened?

Running sc.external.tl.palantir(adata) raises TypeError: run_diffusion_maps() got an unexpected keyword argument 'data_df'. This seems to be a bug in scanpy/external/tl/_palantir.py which uses the keyword data_df which seems to have changed from data_df to data in the latest palantir version.

Minimal code sample

# from the documentation: https://scanpy.readthedocs.io/en/stable/generated/scanpy.external.tl.palantir.html#scanpy.external.tl.palantir
# (the data comes with the palantir repo)
import scanpy.external as sce
import scanpy as sc
adata = sc.read_csv(filename="Palantir/data/marrow_sample_scseq_counts.csv.gz")
sc.pp.filter_cells(adata, min_counts=1000)
sc.pp.filter_genes(adata, min_counts=10)
sc.pp.normalize_per_cell(adata)
sc.pp.log1p(adata)
sc.tl.pca(adata, n_comps=300)
sc.pp.neighbors(adata, knn=30)
sce.tl.palantir(adata, n_components=5, knn=30) # error occurs here

Error output

RuntimeError                              Traceback (most recent call last)
RuntimeError: module compiled against API version 0xf but this version of numpy is 0xe
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
/tmp/ipykernel_5717/3469234522.py in <cell line: 7>()
      5 sc.tl.pca(adata, n_comps=300)
      6 sc.pp.neighbors(adata, knn=30)
----> 7 sce.tl.palantir(adata, n_components=5, knn=30)

/p/project/hai_microbio/sb/miniconda3/envs/cellrank2/lib/python3.9/site-packages/scanpy/external/tl/_palantir.py in palantir(adata, n_components, knn, alpha, use_adjacency_matrix, distances_key, n_eigs, impute_data, n_steps, copy)
    207 
    208     # Diffusion maps
--> 209     dm_res = run_diffusion_maps(
    210         data_df=df,
    211         n_components=n_components,

TypeError: run_diffusion_maps() got an unexpected keyword argument 'data_df'

Versions

-----
anndata     0.9.2
scanpy      1.9.3
-----
PIL                 10.0.0
cffi                1.15.1
colorama            0.4.6
cycler              0.10.0
cython_runtime      NA
dateutil            2.8.2
gmpy2               2.1.2
h5py                3.9.0
igraph              0.10.6
importlib_resources NA
joblib              1.3.2
kiwisolver          1.4.4
leidenalg           0.10.1
llvmlite            0.40.1
matplotlib          3.7.2
mpl_toolkits        NA
mpmath              1.3.0
natsort             8.4.0
numba               0.57.1
numexpr             2.8.5
numpy               1.24.4
opt_einsum          v3.3.0
packaging           23.1
pandas              1.5.3
psutil              5.9.5
pyparsing           3.0.9
pytz                2023.3
scipy               1.11.1
session_info        1.0.0
six                 1.16.0
sklearn             1.3.0
sympy               1.12
texttable           1.6.7
threadpoolctl       3.2.0
torch               2.0.0
tqdm                4.65.2
typing_extensions   NA
wcwidth             0.2.6
yaml                6.0
zipp                NA
zoneinfo            NA
-----
Python 3.9.16 | packaged by conda-forge | (main, Feb  1 2023, 21:39:03) [GCC 11.3.0]
Linux-4.18.0-477.15.1.el8_8.x86_64-x86_64-with-glibc2.28
-----
Session information updated at 2023-08-09 17:08
@soerenab
Copy link
Author

soerenab commented Aug 9, 2023

After fixing the above error locally and continuing I ran into a similar error in the next step:
sc.external.tl.palantir_results(...) internally calls run_palantir(ms_data=ms_data, ...) with keyword ms_data which seems to have changed to just data in the recent version of palantir.

@Zethson
Copy link
Member

Zethson commented Aug 10, 2023

Would you be willing to file a PR?
In any case, we're deprecating external. Please use Palantir directly.

@katosh
Copy link
Contributor

katosh commented Sep 14, 2023

Palantir can now take anndata directly and the argument names have changed to a more general data. How is the status on this @soerenab? I would gladly provide a PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants