sc.queries.enrich throws AssertionError with floats
See original GitHub issueI’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:
- Created 4 years ago
- Comments:6 (6 by maintainers)
@chris-rands, that should be fixed now with #1054
Thanks!