question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

… AttributeError: ‘AnnData’ object has no attribute ‘obs_vector’, when pl.umap, pl.violin

...sc.pl.violin(adata, ['n_genes', 'n_counts', 'percent_mito'],jitter=0.4, multi_panel=True)
...AttributeError                            Traceback (most recent call last)
<ipython-input-41-ed9365d2081e> in <module>
----> 1 sc.pl.violin(adata, ['n_genes', 'n_counts', 'percent_mito'],jitter=0.4, multi_panel=True)

~/anaconda3/envs/myenv/lib/python3.7/site-packages/scanpy/plotting/_anndata.py in violin(adata, keys, groupby, log, use_raw, stripplot, jitter, size, scale, order, multi_panel, show, xlabel, rotation, save, ax, **kwds)
    636         obs_df = get.obs_df(adata, keys=[groupby] + keys, use_raw=use_raw)
    637     else:
--> 638         obs_df = get.obs_df(adata, keys=keys, use_raw=use_raw)
    639     if groupby is None:
    640         obs_tidy = pd.melt(obs_df, value_vars=keys)

~/anaconda3/envs/myenv/lib/python3.7/site-packages/scanpy/get.py in obs_df(adata, keys, obsm_keys, layer, gene_symbols, use_raw)
    160     for k, l in zip(keys, lookup_keys):
    161         if not use_raw or k in adata.obs.columns:
--> 162             df[k] = adata.obs_vector(l, layer=layer)
    163         else:
    164             df[k] = adata.raw.obs_vector(l)

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

Versions:

…scanpy==1.4.3 anndata==0.6.20 umap==0.3.9 numpy==1.17.0 scipy==1.3.0 pandas==0.23.4 scikit-learn==0.21.3 statsmodels==0.9.0 python-igraph==0.7.1 louvain==0.6.1

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
massonixcommented, Jan 23, 2020

That worked, thank you very much for your help!

1reaction
gokceneraslancommented, Jan 23, 2020

@massonix Latest version is available on PyPI, so you can try installing via pip install.

Read more comments on GitHub >

github_iconTop Results From Across the Web

AttributeError: 'AnnData' object has no attribute 'obs_vector ...
It is not available in conda and with 1.4.4.post1 I'm getting the same error. Thanks! conda search -c bioconda scanpy Loading channels: done...
Read more >
AttributeError: 'AnnData' object has no attribute '_X' - scanpy
Subset AnnData object based on categorical value: AttributeError: 'AnnData' object has no attribute '_X' Is it possible to subset a loom object based...
Read more >
Concatenation — anndata 0.9.0.dev35+g6473f20 ...
Concatenation is when we keep all sub elements of each object, and stack these elements in an ordered way. Merging is combining a...
Read more >
Concatenate won't work - Help - Scanpy
Hi everyone. When I marge my 4 own visium samples, I got “AttributeError: 'str' object has no attribute 'shape'”.
Read more >
anndata for R • anndata
A reticulate wrapper for the Python package anndata. Provides a scalable way of keeping track of data and learned annotations. Used to read...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found