scverse / scverse/scanpy

Add support for passing boolean columns in .obs when plotting clustermap or dendrogram.

Open
#2,249 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
2.6k
Forks
779
Avg merge
1d 4h
Merged PRs (30d)
27

Description

  • Additional function parameters / changed functionality / changed defaults?
  • New analysis tool: A simple analysis tool you have been using and are missing in sc.tools?
  • New plotting function: A kind of plot you would like to seein sc.pl?
  • External tools: Do you know an existing package that should go into sc.external.*?
  • Other?

Hey,
currently, when trying to use plotting functions that require categorical obs columns (for example sc.pl.clustermap obs_keys parameter), but one passes a boolean column key in .obs, scanpy will raise an error (or pandas does but the origin is in scanpy's codebase): AttributeError: Can only use .cat accessor with a 'category' dtype.

Would it be possible to let the passed key be from a column of dtype bool as well? Are there any downsides? Happy to provide more detail if needed.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing how sc.pl.clustermap and dendrogram process obs_keys and categorical columns. Reproduce the AttributeError with a boolean .obs column, then identify the existing plotting tests or entry points that cover categorical inputs. Done means boolean columns are accepted for these plotting paths without breaking categorical handling.

Written by the indexing model from the issue text.

Assessment

Tech stack
pandas, python
Domain
data-visualization
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.