-
Notifications
You must be signed in to change notification settings - Fork 60
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
Implement grid bookmark widget #2080
Conversation
Codecov Report
@@ Coverage Diff @@
## main #2080 +/- ##
==========================================
+ Coverage 62.02% 62.18% +0.16%
==========================================
Files 476 482 +6
Lines 22789 22913 +124
Branches 5350 5363 +13
==========================================
+ Hits 14134 14249 +115
- Misses 8374 8383 +9
Partials 281 281
Continue to review full report at Codecov.
|
I just want to make sure it's what we want, how it fits in core vision, or whether even some of the features here could be implemented by an external plugin. It looks like, for example, this plugin "needed to" dig deep and extend the session model, etc so it would be difficult to implement in an external manner. That is sort of interesting in it's own right, and makes me wonder if we need to add more hooks. Also there is I think at least interesting similarity to SV inspector. SV inspector for example already has file import so it is an interesting point of comparison. |
Other implementation note: I think that embedded and desktop don't currently implement this and may crash as a result. It might want to check that the "host session" supports it e.g. ran into this creating a bookmark on LGV "TypeError: session.addBookmark is not a function" |
Something that came up in our meeting with Havana users while discussing apollo: Bookmark feature came up, they wanted to highlight regions that they could navigate easily too and we talked a little about this bookmarking as a good solution. They thought it would be sufficient for their uses but also suggested keyboard shortcuts, such as one for creating a bookmark and one for navigating back and forth between bookmarks (like ctrl + to go forward, ctrl - to go back) |
@cmdcolin do you have suggestions for how to move forward in terms of your questions/comments about being external vs core, and the similarity to SV inspector? My preference would be to keep it in core, since I think it adds a pretty tangible additional feature to the LGV that has been proposed for a while. |
This is definitely a pretty cool idea and something I'll look into 👍 (More generally, thinking about adding more shortcuts to JB2 could be good) |
@cmdcolin thoughts on this? I'd probably add the bookmark methods to the session model factories for desktop and embedded to fix the error you mentioned, but I want to know what the status of this PR before doing more work on it. |
Here is sort of my vision for bookmarks
Extras which may not be essential
|
Other software-side extras
|
Could be a good driver for #2032 if implemented externally |
Random idea: having refname,start,end and locstring is sort of duplicate information. Perhaps having just locstring is sufficient, which could leave room perhaps for an arbitrary or even editable note field. I know I'm putting a lot of requests here but it seemed like a fun idea |
Was going to bring this up in our pairing tomorrow AM! We should take a look at it. |
I updated the PR description addressing most of the other points, but I do think it still is probably a reasonable default for the embedded. You can definitely roll your own table of regions (like one of the demo apps for JBrowseR), but I feel like it is still a pretty nice feature to have, and be able export regions from the embedded browser. |
thanks. I think the compact design with the locstring only is really nice. I would still be interested...even though it is a core plugin, to see it implemented in such a way that it doesn't explicitly modify code on all the session models. It would be very cool IMO if it would use the #2032 concept but given that does not exist, we could consider including it in it's current form |
@cmdcolin @garrettjstevens definitely a good point. One part I'm wondering about: does the #2032 pertain to just extending menu items, or would it also be applicable to extending the session model? It seems like if that idea was implemented, it would help address the way I had to add new menu items directly to the LGV plugin, but still wouldn't offer a solution for where to store the array of bookmarks. |
I don't think this is the case. When a widget is closed, its model is still in the session, it's just not an "active" widget. I think you could store the bookmarks in the widget model and not have to touch the session. I'd also really like to see if this plugin could not alter the LGV plugin at all. To me, this seems like a fairly simple plugin that in principle should be able to be an external plugin (meaning it shouldn't depend on changes to core plugins, not that it should actually be external). If there are reasons that this is not able to be an external plugin, I'd rather solve those first since to me that shows that there is missing functionality in our plugin system. |
Really? I wonder what I'm doing wrong then. I remember you pointing this out when I was initially starting on this, and tried it initially. When I closed the widget, the bookmarks where lost each time when I kept them in the widget's model. I could revisit this.
This is a good point. @rbuels and I were just working on an implementation of extension points during pairing. It would require that PR (and adding the evaluation an extension point in the menu for LGV) in order for this PR to not need to alter that code. We'd need to evaluate extension points in the LGV at:
Fundamentally, it seems like this revolves around extension points (#2032 ). Without them, there isn't a way to make a plugin like this without updating a core plugin like in this PR. |
You would need to check for an existing bookmark widget before adding a new one when activating, maybe something like this: diff --git a/plugins/linear-genome-view/src/LinearGenomeView/index.tsx b/plugins/linear-genome-view/src/LinearGenomeView/index.tsx
--- a/plugins/linear-genome-view/src/LinearGenomeView/index.tsx
+++ b/plugins/linear-genome-view/src/LinearGenomeView/index.tsx
@@ -677,13 +677,16 @@ export function stateModelFactory(pluginManager: PluginManager) {
activateBookmarkWidget() {
const session = getSession(self)
if (isSessionModelWithWidgets(session)) {
- const selector = session.addWidget(
- 'GridBookmarkWidget',
- 'GridBookmark',
- { view: self },
- )
- session.showWidget(selector)
- return selector
+ let bookmarkWidget = session.widgets.get('GridBookmark')
+ if (!bookmarkWidget) {
+ bookmarkWidget = session.addWidget(
+ 'GridBookmarkWidget',
+ 'GridBookmark',
+ { view: self },
+ )
+ }
+ session.showWidget(bookmarkWidget)
+ return bookmarkWidget
}
throw new Error('Could not open bookmark widget') |
Closed in favor of #2140 |
This PR implements a bookmark widget for the LGV using the MUI Data Grid component. Closes #157
Feature Overview
The main idea is to have a widget that can be used to store interesting regions in a view (this PR adds support for the LGV) that can be returned to later. The widget stores a table of the regions that have been bookmarked.
Currently what has been implemented:
Demo with the table displaying chrom, start, end, assembly, link (locstring), trash icon to delete
Screenshot of a more compact design with only the bookmark link and trash icon:
This comes with the advantage of not needing to resize the drawer widget 👍
Implementation details
data-management
core plugin. It could potentially be put in its own plugin. (@cmdcolin has suggested the possibility of making that plugin external)Additional features
Here are some other things that haven't been implemented but could be: