ismms-himc / clustergrammer2

"Dimensionality-increasing" data visualization tool and interactive WebGL Jupyter widget built for single-cell data.
https://clustergrammer.readthedocs.io/case_studies.html
MIT License
116 stars 20 forks source link

Question: Can I display custom mouse-over gene descriptions? #62

Open matrs opened 4 years ago

matrs commented 4 years ago

Hello, lets say i have a set of genes from a non-model organism, but i do have gene annotations/descriptions. Can I use those? (without resorting to write javascript). I read the documentation and didn't find anything about it, so it seems i can't. I was thinking something like passing this annotation table/df to js and use that instead of retrieving data from the web could be a very useful option.

cornhundred commented 4 years ago

Hi @matrs, thanks for the feature request. I think this feature overlaps with what we have planned here https://github.com/ismms-himc/clustergrammer-gl/issues/25

I think the way we'll implement this for Clustergrammer2 is that we'll have a method for tooltip metadata (e.g. net.tooltip_metadata(axis='row', meta=df_meta)) where a user can input their own metadata (e.g. a Pandas DataFrame with columns like fullname and description). Then this information will be passed to the Clustergrammer-GL front-end and saved as part of the Widget JSON so that it will also work when embedded into a static HTML. Let us know what you think.

matrs commented 4 years ago

Well, it sounds great, specially the part about embedding it so it works with static html files.

matrs commented 4 years ago

Given that annotations potentially can have a lot of text, can be a secondary option to have that annotation as external file (maybe a compressed format) and link it from the html? can js read it from that file the way it "reads" it from the web or that would be too complicated in terms of its implementation? I'm thinking about responsiveness of the widget in cases where you embed a lot of text in the widget but i don't know if that plays a role in it.

cornhundred commented 4 years ago

Hi @matrs, that makes sense to limit the amount of data embedded into the visualization JSON (we're going to be improving our JSON format soon which will make saving the data more efficient). The static HTML will not be able to load information from a file because of web security issues (I believe this falls under CORS requests).

The current mouseover information is being retrieved by the Harmonizome (http://amp.pharm.mssm.edu/Harmonizome/) API which allows CORS requests (e.g. front-end code can make a GET request).

One solution for this type of problem (e.g. hosting data that can be retrieved by front-end code) is to use GitHub to host the text and then load it from there using GET requests. We're doing something like this on this Observable notebook (https://observablehq.com/@ismms-himc/covid-19-sars-cov-2-preprints-from-medrxiv-and-biorxiv) and the repo we're making request from is here https://github.com/ismms-himc/covid-19_sinai_reviews.