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
[FEAT] microscopium user interface, export selected data #87
Conversation
… Using scale_width in the interim instead
Hey @GenevieveBuckley! Very cool! I just tested it and ended up with a wonderful little csv in my Downloads folder! 😲 👏 👏 👏 Before I do a full review, some broad overview issues:
Have you experienced anything like this in your testing? |
I'm not sure, maybe? There is pandas.to_csv() but you'd need to supply a filepath & if the code is running on a remote server... then we'd need to know more about sockets & server file transfers. The print webpage button would not have a good python alternative (and currently the bokeh save toolbar icons aren't working like they should). How much javascript is too much javascript? Is
Yes, this is happening in the update_table() function, but I'm not sure how to debug this:
|
I think that error also appears first in this list here: https://rollbar.com/blog/top-10-javascript-errors/ Also maybe this will be helpful? https://javascriptweblog.wordpress.com/2010/08/16/understanding-undefined-and-preventing-referenceerrors/ |
And here are some links about sockets (file transfer using python only, no downloading with javascript): |
- Use tabs instead of commas as separators, as it is more robust - Use a function to convert a table to tsv text - Minor other cleanups
@GenevieveBuckley 🎉 Awesome work here. Saving was a pain in the ass to get right but it's such a valuable feature, thanks for pushing it forward!!! And lots of other enhancements that I now take for granted. =) |
Nice work! It is much cleaner now, especially the download feature :) You know, we should update the bokeh export data example to be more like what you've done here. I know you're swamped, if I have spare time in the next few weeks I might try to do that. It'd be good to save some other poor sod all the hassle! |
Turns out we could probably use |
This pull request supersedes PR #86. When this is merged, that can be closed.
I believe this also closes #80, unless you also want to include the 'nearest neighbors' view like Sarah had in the bokeh prototype here (see issue #73, branch https://github.com/birdsarah/microscopium/tree/bokeh_proto).
New features include:
bokeh serve ...
)And a discussion of possible future problems, in order of severity:
Some really weird stuff is happening with the bokeh 'save' toolbar button. I've removed it for now and instead included a button that will print the whole webpage to paper or pdf. Details: It works fine to the PCA plot, but is inconsistent for the selected images plot. If you open the Chrome developer Javascript console, then you can (sometimes) magically make it work. It seems that this magical workaround doesn't work so well if you're not using
bokeh serve
though. I'm also pretty sure it's not entirely related to the next javascript error I'll talk about, because this odd save behaviour still happens when those lines of code are commented out.I get a javascript error related to updating the datatable with the selected data. It doesn't seem like a fatal error, but should still be fixed:
error handling message Message 'PATCH-DOC' (revision 1): DeserializationError("Seq(Any) expected a list or None, got {'0': -0.43731416321298383, '1': -0.4933948783766794}",)
Javascript doesn't support objects like python tuples, so I couldn't work out how to export dataframe columns containing these to csv (like the 'neighbors' column). So I'm excluding those for now, but I bet someone will want this!
It seems that bokeh's datatable doesn't support index values other than the usual 0, 1, 2, ... etc. So even though the pandas dataframe has the index values set to something fancy, we don't see those index values on the webpage or in the csv download of selected data.
I haven't chosen to make the table resize itself when the browser is resized, I think that would probably end up looking silly. Let me know if you think I should reconsider. I do still think it's worthwhile having a table of selected datapoints on display, since it's a good visual clue if you haven't selected anything.