scverse / scverse/scanpy

Neighbors.compute_transitions() with error 'AnnData' object has no attribute '_connectivities'

Open
#2,109 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Area – API Question
Dominant language
Python
Stars
2.6k
Forks
779
Avg merge
1d 4h
Merged PRs (30d)
27

Description

  • 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.

Hello,

I would like to derive the transition matrix with the following input:

sc.Neighbors.compute_transitions(adata)

The error below was produced. The anndata object was fine with sc.pp.neighbors(adata) and sc.tl.umap(adata) for UMAP plotting. Thanks

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/root/miniconda3/envs/scVI/lib/python3.8/site-packages/scanpy/neighbors/__init__.py", line 911, in compute_transitions
    W = self._connectivities
AttributeError: 'AnnData' object has no attribute '_connectivities'
Versions

[Paste the output of scanpy.logging.print_versions() leaving a blank line after the details tag]

WARNING: If you miss a compact list, please try print_header!

anndata 0.7.5
scanpy 1.8.2
sinfo 0.3.1

PIL 8.0.1
absl NA
anndata 0.7.5
attr 20.3.0
cffi 1.14.4
colorama 0.4.4
cycler 0.10.0
cython_runtime NA
dateutil 2.8.1
deprecate 0.3.0
docrep 0.3.2
fsspec 2022.01.0
google NA
h5py 3.1.0
igraph 0.9.1
joblib 0.17.0
kiwisolver 1.3.1
leidenalg 0.8.3
llvmlite 0.37.0
matplotlib 3.3.3
mkl 2.3.0
mpl_toolkits NA
natsort 7.1.0
numba 0.54.1
numexpr 2.7.1
numpy 1.19.2
opt_einsum v3.3.0
packaging 20.7
pandas 1.1.5
pkg_resources NA
pycparser 2.20
pygments 2.7.3
pynndescent 0.5.5
pyparsing 2.4.7
pyro 1.8.0+0ec1e87
pytorch_lightning 1.3.8
pytz 2020.4
rich NA
scanpy 1.8.2
scipy 1.5.2
scvi 0.14.5
setuptools 49.6.0.post20201009
setuptools_scm NA
sinfo 0.3.1
six 1.15.0
sklearn 1.0.1
sphinxcontrib NA
tables 3.6.1
tensorboard 2.7.0
texttable 1.6.3
threadpoolctl 2.1.0
torch 1.9.0
torchmetrics 0.6.2
tqdm 4.62.3
typing_extensions NA
umap 0.5.2
wcwidth 0.2.5
yaml 5.4.1

Python 3.8.6 | packaged by conda-forge | (default, Nov 27 2020, 19:31:52) [GCC 9.3.0]
Linux-5.4.72-microsoft-standard-WSL2-x86_64-with-glibc2.10
24 logical CPU cores, x86_64

Session information updated at 2022-01-14 13:58

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with scanpy/neighbors/init.py and inspect Neighbors.compute_transitions alongside the reported call sc.Neighbors.compute_transitions(adata). Reproduce with sc.pp.neighbors(adata) and the listed Scanpy 1.8.2 environment, then verify the method works with the resulting AnnData object without the reported AttributeError.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
bioinformatics
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.