-
Notifications
You must be signed in to change notification settings - Fork 64
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
Adds URL query param for highlight on LGV #4234
Conversation
First draft divorced from existing bookmarking functionality -- adds a highlight element to the LGV if provided in the URL params. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #4234 +/- ##
==========================================
- Coverage 62.71% 62.62% -0.09%
==========================================
Files 1084 1086 +2
Lines 31316 31390 +74
Branches 7474 7502 +28
==========================================
+ Hits 19639 19658 +19
- Misses 11503 11557 +54
- Partials 174 175 +1 ☔ View full report in Codecov by Sentry. |
plugins/linear-genome-view/src/LinearGenomeView/components/Highlight.tsx
Outdated
Show resolved
Hide resolved
plugins/linear-genome-view/src/LinearGenomeView/components/Highlight.tsx
Outdated
Show resolved
Hide resolved
there may want to be a system to clear the highlights. in jbrowse 1. in jbrowse 1 there was sort of a 3-state button that helped with this. not sure the best UI for it for jbrowse 2, it is possible it doesn't need to be so "present" on the header bar and could instead be that clicking on the highlight itself could clear it or something like that. just an idea additionally, it may be useful to show the highlight in the overviewscalebar can see example for jbrowse 1 here |
…ded button to dismiss highlight
plugins/linear-genome-view/src/LinearGenomeView/components/Highlight.tsx
Outdated
Show resolved
Hide resolved
plugins/linear-genome-view/src/LinearGenomeView/components/Highlight.tsx
Show resolved
Hide resolved
I added a commit that avoids the highlight not rendering if the coordinate was numeric 0 (explicit checks for undefined) here 9c93a5a would actually be nice if there was a lint rule for this as it can be so easy to miss this type of bug (you can reproduce numeric 0 by highlighting something starting at coord 1 e.g. ctgA:1-100 since it gets changed to 0 on import due to 1 base to 0 base conversion) |
found the lint rule :) #4238 |
plugins/linear-genome-view/src/LinearGenomeView/components/Highlight.tsx
Outdated
Show resolved
Hide resolved
plugins/linear-genome-view/src/LinearGenomeView/components/Highlight.tsx
Outdated
Show resolved
Hide resolved
: undefined | ||
} | ||
|
||
const h = mapCoords(model.highlight as ParsedLocStringA) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i believe this cast is "not valid", as model.highlight.start and model.highlight.end are potentially undefined by definition of ParsedLocString(?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Most recent commit: is making use of Required https://www.typescriptlang.org/docs/handbook/utility-types.html#requiredtype satisfactory?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that is an interesting new feature of typescript, but I might opt for creating a new type (just the simple {assemblyName:string,refName:string,start:number,end:number} instead perhaps, and try to avoid using "as" cast entirely (casts are generally best if avoided as it cancels out any check that typescript would do for you)
*/ | ||
highlight: types.optional( | ||
types.frozen<ParsedLocString>(), | ||
{} as ParsedLocString, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe this cast may not be valid, as refName is required on ParsedLocString. potentially, making it something like {assemblyName:string,refName:string,start:number,end:number}|undefined might be better than parsedlocstring, because then you know you have all required fields, or else it is just undefined
/** | ||
* #action | ||
*/ | ||
setHighlight(highlight: ParsedLocString) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
with above comment, can make it "|undefined" so that undefined clears it
plugins/linear-genome-view/src/LinearGenomeView/components/Highlight.tsx
Outdated
Show resolved
Hide resolved
plugins/linear-genome-view/src/LinearGenomeView/components/Highlight.tsx
Outdated
Show resolved
Hide resolved
…ve overviewhighlight to its own file
should be good for now, can see how it goes:) |
can you add a note to urlparams.md mentioning it? also might mention that it must be combined with &loc and &assembly because otherwise the app does not realize it is doing the "simple lgv launcher mode" |
This works great and thank you all, Jbrowse is amazing. I am now usign the highlight feature extensively and a need to highlight several regions somehow appeared. Do you think it would be possible to implement something like it? (or should I also have a look and perhaps can help?) I was thinking something in this direction:
This would highlight two regions on ref. 1 and 2, coordinates 100-200 and 250-300. Any help appreciated, Thanks, Gregor |
@grexor I just created a new issue for this here ! |
Responds to comments on #2316 and #599 requesting a highlight feature similar to what existed in JB1.
Allows a user to specify a highlight region in the URL with the pattern &highlight=REF:START..END