scverse / scverse/scanpy

cluster cells within groups when plotting with scanpy.pl.heatmap()

Open
#3,129 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Area - Plotting 🌺
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

I find the function scanpy.pl.heatmap() useful to see how a gene is expressed in single cells within each group specified. I think the clustering of groups is helpful as well. However, I find this function lacking one crucial functionality which is additional clustering of cells within a group.

In case of grouping per cell types it might not be that important, but imagine one was to group by samples and plot some pathway gene expression. Then it would be very helpful to be able to see clusters of cells within each group (e.g. sample) expressing some pathways and not expressing the others. Right now seeing patterns is much harder since the cells are not clustered by their expression signatures.

I suppose this would require running dendrogram twice -- one time for groups and one time for cells within each group. Not sure how to implement a way around this with the current function implementation without rewriting the internal code for _reorder_categories_after_dendrogram().

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 with scanpy.pl.heatmap() and inspect how group clustering is currently handled. Review _reorder_categories_after_dendrogram() and determine how a second dendrogram could cluster cells within each group. Done means heatmaps can show clustered cells within each group while preserving the existing group ordering behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data-visualization
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.