Skip to content

fix: handle scalar string groups in ranked-gene plots - #4330

Open
yingluosanqian wants to merge 1 commit into
scverse:mainfrom
yingluosanqian:ylsq/fix-rank-genes-groups-string
Open

fix: handle scalar string groups in ranked-gene plots#4330
yingluosanqian wants to merge 1 commit into
scverse:mainfrom
yingluosanqian:ylsq/fix-rank-genes-groups-string

Conversation

@yingluosanqian

Copy link
Copy Markdown

Description

groups accepts either a single string or a sequence of strings in the ranked-gene plotting APIs. However, sc.pl.rank_genes_groups and the shared plotting path iterated a scalar string character by character.

For example, passing groups="Dendritic" attempted to look up the group "D" and raised an error instead of plotting "Dendritic".

This PR normalizes scalar string group names to one-element lists before iteration, consistent with the existing behavior in sc.pl.rank_genes_groups_violin and sc.get.rank_genes_groups_df.

  • Closes # — no existing issue
  • Tests included: added regression coverage for both the standalone and shared plotting paths

Tests

  • add related test.

@codecov

codecov Bot commented Aug 31, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.99%. Comparing base (a656a33) to head (34b490b).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4330   +/-   ##
=======================================
  Coverage   81.98%   81.99%           
=======================================
  Files         134      134           
  Lines       13235    13239    +4     
=======================================
+ Hits        10851    10855    +4     
  Misses       2384     2384           
Flag Coverage Δ
hatch-test.low-vers 79.07% <100.00%> (+<0.01%) ⬆️
hatch-test.pre 81.86% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/scanpy/plotting/legacy/_tools/__init__.py 76.17% <100.00%> (+0.25%) ⬆️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant