theislab/scvelo

TypeError: Neighbors.compute_neighbors() got an unexpected keyword argument 'write_knn_indices'.

cnwokolo24 opened this issue · 4 comments

TypeError: Neighbors.compute_neighbors() got an unexpected keyword argument 'write_knn_indices' when I try to run scv.pp.moments or scv.pp.neighbors on adata.

I'm a beginner with RNA velocity analysis, so please advise in detail.
Many thanks in advance

...

import scanpy as sc #import scanpy
import pandas as pd #pandas
import scvelo as scv

adata = scv.read(path/to/file.loom, cache=True)
scv.pl.proportions(adata)
scv.pp.filter_genes(adata, min_shared_counts=20)
scv.pp.normalize_per_cell(adata)
scv.pp.filter_genes_dispersion(adata, n_top_genes=2000)
scv.pp.log1p(adata)
scv.pp.filter_and_normalize(adata, min_shared_counts=20, n_top_genes=2000)
scv.pp.pca(adata)
scv.pp.moments(adata,n_pcs=30, n_neighbors=30 )
Error output
# paste the error output here, if applicable
computing neighbors
/usr/local/lib/python3.10/dist-packages/ipykernel/ipkernel.py:283: DeprecationWarning: `should_run_async` will not call `transform_cell` automatically in the future. Please pass the result to `transformed_cell` argument and any exception that happen during thetransform in `preprocessing_exc_tuple` in IPython 7.17 and above.
  and should_run_async(code)
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
[<ipython-input-20-280ab52e45bd>](https://localhost:8080/#) in <cell line: 1>()
----> 1 scv.pp.moments(adata,n_pcs=30, n_neighbors=30 )

2 frames
[/usr/local/lib/python3.10/dist-packages/scvelo/preprocessing/neighbors.py](https://localhost:8080/#) in _get_scanpy_neighbors(adata, **kwargs)
     38         warnings.simplefilter("ignore")
     39         neighbors = Neighbors(adata)
---> 40         neighbors.compute_neighbors(write_knn_indices=True, **kwargs)
     41     logg.switch_verbosity("on", module="scanpy")
     42 

TypeError: Neighbors.compute_neighbors() got an unexpected keyword argument 'write_knn_indices'
Versions
# paste the ouput of scv.logging.print_versions() here
scvelo==0.3.2  scanpy==1.10.1  anndata==0.10.7  loompy==3.0.7  numpy==1.25.2  scipy==1.11.4  matplotlib==3.7.1  sklearn==1.2.2  pandas==2.0.3  
[ ]
scv.pp.moments(adata, )
[Colab paid products ](https://colab.research.google.com/signup?utm_source=footer&utm_medium=link&utm_campaign=footer_links)- [Cancel contracts here](https://colab.research.google.com/cancel-subscription)
19202122232425262728293031323334353637383940414243444546474849505152

Duplicate of #1212; please check existing issues before opening a new one.

Duplicate of #1212; please check existing issues before opening a new one.

I am facing the same issue. #1212; is not working.

Duplicate of #1212; please check existing issues before opening a new one.

I am facing the same issue. #1212; is not working.

I didn't notice at first but #1212, switches from using scv to scanpy for pp.moments & pp.neighbor. Did you try that?

Duplicate of #1212; please check existing issues before opening a new one.

I am facing the same issue. #1212; is not working.

I didn't notice at first but #1212, switches from using scv to scanpy for pp.moments & pp.neighbor. Did you try that?

yes, I have finally resolved by "#449".

thanks