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.

Error with scanpy.api.pl.highest_expr_genes()

See original GitHub issue

I have an error when trying this function for my data:

sc.pl.highest_expr_genes(adata)

results in

filtered out 14139 cells that have less than 1 counts
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-11-1f5b130b9d4e> in <module>()
----> 1 sc.pl.highest_expr_genes(adata)

/usr/local/lib/python3.6/site-packages/scanpy-1.2.2+90.g47c579f-py3.6.egg/scanpy/plotting/qc.py in highest_expr_genes(adata, n_top, save, show, ax, **kwargs)
     41 
     42     # identify the genes with the highest mean
---> 43     dat.var['mean_percent'] = dat.X.mean(axis=0).A1
     44 
     45     top = dat.var.sort_values('mean_percent', ascending=False).index[:n_top]

AttributeError: 'numpy.ndarray' object has no attribute 'A1'

It is not critical, but I wonder why this error happens. I have the most recent version from github. Maybe I’m not transforming my data to a certain format properly? Didn’t find this documented anyway. However, a lot of other analysis that I do via Scanpy works for me, so generally the data is read and processed correctly.

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
falexwolfcommented, Jul 30, 2018

Thank you, @LuckyMD!

0reactions
pritykincommented, Aug 2, 2018

Works for me now, thank you!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error with scanpy.api.pl.highest_expr_genes() · Issue #220
I have an error when trying this function for my data: sc.pl.highest_expr_genes(adata) results in filtered out 14139 cells that have less ...
Read more >
API — Scanpy 1.9.1 documentation
Basic Preprocessing . For visual quality control, see highest_expr_genes() and filter_genes_dispersion() in scanpy.pl .
Read more >
Release notes — Scanpy 1.9.1 documentation - Read the Docs
Fixed bug in scanpy.pl.embedding() functions where an error could be raised when there were missing values and large numbers of categories PR 2187...
Read more >
scanpy.pl.highest_expr_genes - Read the Docs
Computes, for each gene, the fraction of counts assigned to that gene within a cell. The n_top genes with the highest mean fraction...
Read more >
Scanpy – Single-Cell Analysis in Python — Scanpy 1.9.1 ...
Fixed bug in scanpy.pl.embedding() functions where an error could be raised when there were missing values and large numbers of categories PR 2187...
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