Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

User-defined heatmap value range #1427

Closed
safay opened this issue May 13, 2021 · 9 comments
Closed

User-defined heatmap value range #1427

safay opened this issue May 13, 2021 · 9 comments

Comments

@safay
Copy link

safay commented May 13, 2021

Is your feature request related to a problem? Please describe.

Lab users would like to be able to view differences within a variable range of values within a heatmap. For example, when there are some samples with very high values (e.g., 30,000, see attached plot) but for the samples we are particularly interested in we need to distinguish between values within a range of, say, 1-500, the higher value samples burn out the signal. Even if the user hides the samples with high values, the colors of the heatmap do not change.

Describe the solution you'd like

A brute force solution would be to implement a hard cutoff/limit for the heatmap values, something like the "xmax" config for x/y plots. If this exists today I could not find it.
A heavier lift, more UI-based, solution would be to have something like a slider on the sidebar that could dynamically re-render the heatmap for a given range.

Describe alternatives you've considered

See above about using a config setting for heatmaps analogous to xmax for x/y plots.
I've considered rolling my own solution in matplotlib outside MultiQC, but I'm adding this feature request here because it seems like it might be something others might want.
I could add a new part to the analysis pipeline to separate out low-signal samples and create a separate heatmap for those samples.

Additional context

I'm willing to have a stab at making a PR, especially if I can get some guidance.

image

@ewels
Copy link
Member

ewels commented May 14, 2021

Hi @safay,

I think that the plot does have the option to set a hard cutoff, it's just called max instead of xmax though: https://multiqc.info/docs/#heatmaps

pconfig = {
    'min': None,                   # Minimum value (default: auto)
    'max': None,                   # Maximum value (default: auto)
}

You can overwrite any plot config at run time as follows: https://multiqc.info/docs/#customising-plots

Even if the user hides the samples with high values, the colors of the heatmap do not change.

Looking at the code, this is deliberate behaviour. I seem to remember doing that in the early days as it was quite confusing to have the scale / meaning of the colours change each time you filtered.

A heavier lift, more UI-based, solution would be to have something like a slider on the sidebar that could dynamically re-render the heatmap for a given range.

This sounds great, but would not be trivial to implement.

Phil

ewels added a commit that referenced this issue May 14, 2021
@ewels
Copy link
Member

ewels commented May 14, 2021

ok you made me curious as I agree that the sliders would be a really nice feature. So I started playing and came up with this:

heatmap-sliders

Added in 4abbfe5 - if you could please install the dev version of MultiQC and give it a try that would be fab 👍🏻

Phil

@safay
Copy link
Author

safay commented May 14, 2021

@ewels Thank you! This is great. Also, thanks for pointing me to the right place in the docs to find parameters for plot configs.
Trying it now - will report back!

@safay
Copy link
Author

safay commented May 14, 2021

@ewels This is brilliant. I know beggars can't be choosers, but if it would be trivial to add, a field to enter min/max would be nice.
image

@ewels
Copy link
Member

ewels commented May 15, 2021

Yes I was looking at this again last night before I went to bed and was thinking exactly that - agree that it would be useful (as shown by your screenshot with small useful ranges) and should be easy enough to add. Will have a look 👍🏻

ewels added a commit that referenced this issue May 15, 2021
@ewels
Copy link
Member

ewels commented May 15, 2021

ok, added in 26177e9 - please give that a whirl and see how it looks 👍🏻

May-15-2021 14-01-23

@safay
Copy link
Author

safay commented May 17, 2021

@ewels I tested it today and it's lovely, that works really really well. I am very grateful!

image

image

@safay safay closed this as completed May 17, 2021
@safay
Copy link
Author

safay commented May 17, 2021

New feature implemented in 26177e9

@ewels
Copy link
Member

ewels commented May 17, 2021

Brilliant, thanks for the suggestion and prompt!

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

No branches or pull requests

2 participants