"Interactive" Dotplot version: check for available var_names
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 2.6k
- Forks
- 779
- Avg merge
- 1d 4h
- Merged PRs (30d)
- 27
Description
What kind of feature would you like to request?
Additional function parameters / changed functionality / changed defaults?
Please describe your wishes
Feature
Change dotplot to a more interactive version such that var_names that are not in the AnnData object will be ignored. The returned dotplot should only include the var_names (e.i. genes) that are present.
This could be useful for a more interactive way of plotting in the Jupyter notebook because often canonical marker genes lists are run on different Anndata objects but not all have the same gene panels (especially also for spatial transcriptomics data).
Plan
Check for available vars in the AnnData before plotting:
available_vars = adata.var_names
missing_vars = [name for name in var_names if name not in available_vars]
if missing_vars:
logg.warning(
f"The following variables were not found in the dataset and will be ignored: {', '.join(missing_vars)}"
)
var_names = [name for name in var_names if name in available_vars]
if len(var_names) == 0:
raise ValueError("No valid variable names found in the dataset")
I am unsure whether this should be called specifically related to the DotPlot class before calling the BasePlot function or whether this is transferable to other plots and can be added to the BasePlot class before preparing the dataframe. @flying-sheep what is you take on this?
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
Read the dotplot entry point in src/scanpy/plotting/_dotplot.py around the DotPlot class and compare it with src/scanpy/plotting/_baseplot_class.py around dataframe preparation. Determine whether filtering belongs in the dotplot or shared base class; done means missing var_names are warned about and ignored, while an entirely invalid list raises the specified ValueError.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- data-visualization
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100