qiime2 / q2-vizard

The first choice of wizard lizards for interactive, generalized microbiome data visualization!
BSD 3-Clause "New" or "Revised" License
1 stars 9 forks source link

NEW: refactored FMT heatmap for more generalized use #30

Closed lizgehret closed 2 months ago

lizgehret commented 2 months ago

This is a refactored heatmap from @cherman2's PEDS heatmap in q2-fmt. It accepts three numeric metadata columns as input. It doesn't currently support drop downs to change the numeric fields that are represented, but that can be added as well.

lizgehret commented 2 months ago

Design update after discussing with @cherman2 and @gregcaporaso:

Axes will support either numeric or categorical (categorical will be sorted alphabetically) & gradient will still only accept numeric. Future version may support categorical[ordered] for the gradient.

lizgehret commented 2 months ago

Okay @cherman2 this is ready for you!

xy measures now accept both MD col types, and the heatmap will be sorted alphabetically on both axes (with A -> Z as the smallest -> largest ordering).

Note that in order to accomplish this, the x scale needed ascending order and the y scale needed descending order - vega orients these differently (i think) because the ranges are different (height vs. width).

cherman2 commented 2 months ago

@lizgehret and I talked offline. We think that a white box around each heatmap will make it more obvious what the distinction between boxes. We also disscussed adding back in the x and y slider to help viewing bigger data.

Looks Great Liz!

lizgehret commented 2 months ago

updates discussed with @cherman2 have been implemented!

cherman2 commented 2 months ago

Hi @lizgehret, This looks great and it is doing some really reasonable things with really funky data!

The only thing I noticed is it seems to have an issue with the column name "No." This made me realize that this code isn't checking that I am handing in a valid column name. Should we be doing that or is it up to the user to realize? I am fine either way. Screenshot 2024-09-16 at 3 51 48 PM

However No. is a valid column name so you should probably identify why that is happening if its unexpected!

lizgehret commented 2 months ago

Okay so it looks like vega has a few special characters that can break the viz if they're included in an md col. Characters are as follows:

.
[]
[
]
\
'
"

I think I'm just going to raise an error if any of these characters are found in the md column names - that makes life easier and also is transparent with the user (vs silently removing characters).

cherman2 commented 2 months ago

Makes sense to me!

lizgehret commented 2 months ago

Okay, back in your court @cherman2! You'll notice that in this last commit I've split up the _measure_validation helper into two separate helpers. I've done this because the measures that allow both numeric/categorical don't need _col_type_validation on them, but they still need additional validation (i.e. are they in the metadata and do they contain disallowed chars). Hopefully those changes make sense, but lmk if anything needs clarification!