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.

sc.queries.enrich throws AssertionError with floats

See original GitHub issue

I’m trying to run an enrichment analysis after filtering out certain genes via sc.tl.filter_rank_genes_groups, so I use key='rank_genes_groups_filtered' as an argument for sc.queries.enrich. Since the filtered values are replaced with nan I hoped they’d by ignored in the enrichment analysis, but it actually leads to an uninformative AssertionError.

My suggestion here is simply to filter nan values from the gene list around here and 2 lines later: https://github.com/theislab/scanpy/blob/249fc572471683357b86b8bbf41d3284118bc8f8/scanpy/queries/_queries.py#L296

I can make a little PR if we agree with this simple fix

Note you can reproduce this very simply without an adata object (but of course the likely use case is with an adata object as outlined above):

sc.queries.enrich([float('nan')])

Output:

AssertionError: query failed with error 500

Versions:

scanpy==1.4.5.post2 anndata==0.6.22.post1 umap==0.3.10 numpy==1.18.1 scipy==1.2.1 pandas==1.0.1 scikit-learn==0.22.1 statsmodels==0.11.0 python-igraph==0.8.0

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
ivirshupcommented, Feb 16, 2020

@chris-rands, that should be fixed now with #1054

0reactions
chris-randscommented, Feb 16, 2020

Thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

sc.queries.enrich throws AssertionError with floats #1043
I'm trying to run an enrichment analysis after filtering out certain genes via ... sc.queries.enrich throws AssertionError with floats #1043.
Read more >
scanpy.queries.enrich - Read the Docs
Contains list of genes you'd like to search. If container is a dict all enrichment queries are made at once. ... Using sc.queries.enrich...
Read more >
Python Scientific lecture notes
Tip: Python offers a large panel of functions to modify lists, or query them. ... 'An integer: 1; a float: 0.100000; another string:...
Read more >
Windows Analysis Report Payment copy.ppa
Potential document exploit detected (performs DNS queries). IP address seen in connection with other malware. Document misses a certain OLE stream usually ...
Read more >
Programming in Scala
Scala's assert method checks the passed Boolean and if it is false, throws. AssertionError. If the passed Boolean is true, assert just returns...
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