Skip to content

Conversation

@alxvth
Copy link
Contributor

@alxvth alxvth commented Aug 21, 2025

Follow-up to #185

Currently points in the scatterplot can be recolored based on other data if the other data...
a. has the same number of points
b. is derived from a parent that has the same number of points (e.g. for HSNE embeddings)

This PR adds:
c. data which has a fully-covering selection mapping (linked data)

For mapping the colors from the color data to the point data we use in (b) the global indices and in (c) the linked data.

There are several possible mappings handled and checked in this order:

  1. from color (or it's parent) to position
  2. from color to position (or it's parent)
  3. from source of position to color

This new feature is required for the Basal Ganglia project, specifically for recoloring HSNE and UMAP embeddings with means on cluster expression (these are the linked data).
Implementing mappings for opacity and size could be done similarly, but would not be nicely contained like here, since the opacity and size values are extracted in a different way at a different location in code.

@alxvth alxvth requested a review from ThomasKroes August 25, 2025 12:24
Copy link
Contributor

@ThomasKroes ThomasKroes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is a nice addition!

From an architectural point of view, I would argue that we should try to avoid too much bespoke (niche) solution for individual viewers in bread-and-butter plugins. Having said that, doing it here now is logical, as the core does not facilitate more advanced color mapping schemes. There are several other types of viewers that can benefit from mapping schemes with more room to maneuver, so I will put this on the long-term agenda.

@alxvth alxvth merged commit 2dd0ce9 into master Aug 29, 2025
alxvth added a commit that referenced this pull request Aug 29, 2025
@alxvth alxvth deleted the feature/ColorBySelectionMapping branch September 5, 2025 12:41
sree2712 pushed a commit that referenced this pull request Oct 3, 2025
* WIP: color by selection mapping

* Add explanations

* Delay check

* Better be safe

* Add Reverse mapping as well

* Fix false parent

* Move new functions to own file

* Centralize & inline check

* Simpler return types and checks

* Single swap

* WIP: map means to HSNE embedding

* Fix mapping from source of position to color by linked data

* Remove debug prints

* Delay surjection check for faster UI response
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.

3 participants