Skip to content
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

Add feature threshold indicator to zoom widget #1196

Merged
merged 4 commits into from
Jan 21, 2023
Merged

Conversation

lbergelson
Copy link
Contributor

@jrobinso
This is a minor feature that I have wanted in the past so I figured I would try implementing it. Good learning project to play with some of the stuff I haven't touched yet.

  • implementing getVisibilityWindow() on coverage and alignment tracks
  • Adding an indicator to the Zoom control to show which zoom levels will display reads / features

This is what it looks like when there are 2 different thresholds set (variants AND reads) notice the two shades to indicate the separate thresholds.

Screen Shot 2022-08-16 at 3 33 45 PM

I implemented it in a kind of hacky way so I'd really like to hear feedback about better ways to get the threshold from the tracks into the widget without poling through them each time you redraw. It's probably not that expensive so it may not be worth doing anything smarter.

Also happy to change the look of it.

@jrobinso
Copy link
Contributor

This is a neat feature, however we can have many tracks loaded each with a unique visibility window. Think of 10 or 20, a combination of VCF, bigBed, and indexed annotations. This is not uncommon as you might think.

@lbergelson
Copy link
Contributor Author

@jrobinso If they all implement getVisibilityWindow() then it should pick up all the thresholds and display them all, although the color will probably saturate and be hard to see if you have too many.


transGraphics.setColor(TRANSPARENT_BLUE);
Rectangle maxZoom = zoomLevelRects[zoomLevelRects.length - 1];
for (Integer window : visibilityThresholds) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a bug here somewhere, array index can be negative. I'll drop more details in the "conversation" widget

@jrobinso
Copy link
Contributor

@lbergelson Looks good overall, but there is a bug. I'm not sure how I got in this state, but here are the previous steps

(1) load the session test/sessions/base_mods/HiFi_basemodfications.xml from the repository (File > Load Session...)
(2) From "Load from server" loaded Common Snps 1.4.2 from "Annotations - Variations and Repeats", and "Gencode v4.0" from "Annotations - Genes".
(3) Set the visibility window of the Snps track to 1, visibility window of Gencode track to -1.
(4) Tried to remove the alignment & coverage tracks to see effect on zoom bar, at this point I noticed it was frozen and stack trace. I'm not sure when the stack trace was created, it could have been prior to (4)

SEVERE [Jan 10,2023 09:53] [DefaultExceptionHandler] java.lang.ArrayIndexOutOfBoundsException: Index -3 out of bounds for length 22
	at org.broad.igv.ui.panel.ZoomSliderPanel.paintVisibilityThresholds(ZoomSliderPanel.java:222)
	at org.broad.igv.ui.panel.ZoomSliderPanel.paintHorizontal(ZoomSliderPanel.java:204)
	at org.broad.igv.ui.panel.ZoomSliderPanel.paintComponent(ZoomSliderPanel.java:122)

@lbergelson
Copy link
Contributor Author

@jrobinso Good catch. I'll look into that.

@lbergelson lbergelson self-assigned this Jan 11, 2023
lbergelson and others added 4 commits January 20, 2023 11:05
* Add an indicator to show which zoom level will start dispalying features/reads
* closes #1192
* extracted a log2 function instead of using a wierd static log2 constant everywhere
@lbergelson
Copy link
Contributor Author

@jrobinso I believe I have fixed the issue. It seemed to occur when the feature window was larger than the current chromosome length causing it to produce a negative log value. I capped the window length when calculating the zoom now so there shouldn't be anymore negative numbers there.

@jrobinso jrobinso merged commit 0e41fbf into master Jan 21, 2023
@jrobinso
Copy link
Contributor

Looks good now

@jrobinso jrobinso deleted the lb_add_zoom_indicator branch January 21, 2023 05:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants