"scanpy.pl.rank_genes_groups{,_violin}" are inconsistent with gene_names assignment
@flying-sheep is already working on this.
Since Jul 27, 2023.
- Dominant language
- Python
- Stars
- 2.6k
- Forks
- 779
- Avg merge
- 1d 4h
- Merged PRs (30d)
- 27
Description
For reference, sc.pl.rank_genes_groups assigns "_gene_names" as such https://github.com/scverse/scanpy/blob/2e98705347ea484c36caa9ba10de1987b09081bf/scanpy/plotting/_tools/__init__.py#L402-L406
This is causing a situation where I can pass identical parameters to both functions but rank_genes_groups_violin fails where rank_genes_groups succeeds. Basically in the violin plot one, the get_obs_df function is creating a dataframe using the <gene_symbol_key> as the columns but using adata.var_names (stored in adata.uns["rank_genes_groups"]["names"]) as the key to search for. If the <gene_symbol_key> is not the index of adata.var, then this fails with a KeyError.
I am using scanpy==1.8.2 and anndata==0.7.8 but can confirm that this code is still present in the master branch (as shown above)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.