sc.pl.stacked_violin: issue using imported adata
Open
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 2.6k
- Forks
- 779
- Avg merge
- 1d 4h
- Merged PRs (30d)
- 27
Description
Hi,
I am testing sc.pl.stacked_violin and I had an issue with running it on an AnnData variable that is imported from a h5ad file. I explain.
If I run:
>>> import scanpy.api as sc
>>> adata = sc.datasets.krumsiek11()
>>> sc.pl.stacked_violin(adata, adata.var_names, 'cell_type', use_raw=False, color='blue', show=False)
No problem, but if I run:
>>> import scanpy.api as sc
>>> adata = sc.datasets.krumsiek11()
>>> adata.write('anndata.h5ad')
>>> adata = sc.read_h5ad('anndata.h5ad')
>>> sc.pl.stacked_violin(adata, adata.var_names, 'cell_type', use_raw=False, color='blue', show=False)
then I got the error:
Traceback (most recent call last):
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/miniconda3/envs/scanpy/lib/python3.6/site-packages/scanpy/plotting/anndata.py", line 896, in stacked_violin
orient='vertical', scale=scale, ax=ax, **kwds)
File "/miniconda3/envs/scanpy/lib/python3.6/site-packages/seaborn/categorical.py", line 2387, in violinplot
color, palette, saturation)
File "/miniconda3/envs/scanpy/lib/python3.6/site-packages/seaborn/categorical.py", line 562, in __init__
self.establish_variables(x, y, hue, data, orient, order, hue_order)
File "/miniconda3/envs/scanpy/lib/python3.6/site-packages/seaborn/categorical.py", line 155, in establish_variables
raise ValueError(err)
ValueError: Could not interpret input 'variable'
I tested it with versions 1.3.1 and 1.3.2, installed with bioconda.
Any idea?
Bérénice
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.
Research direction
Reproduce the two examples, especially the h5ad round-trip, then inspect scanpy/plotting/anndata.py around stacked_violin and line 896 where seaborn receives its data. Done means the imported AnnData case completes without the “Could not interpret input 'variable'” error while the in-memory example still works.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- data-visualization
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 32/100