GMOD / jbrowse

JBrowse 1, a full-featured genome browser built with JavaScript and HTML5. For JBrowse 2, see https://github.com/GMOD/jbrowse-components.
http://jbrowse.org
Other
460 stars 199 forks source link

regex search plugin bug #833

Open nathandunn opened 7 years ago

nathandunn commented 7 years ago

related to https://github.com/GMOD/Apollo/issues/267

I get good results for forward-strand AA and DNA and reverse-strand DNA. For some bizarre reason, reverse-strand AA fails and drops strand info as well depending on the zoom level.

Top strand is protein search strand and bottom strand is dna search strand:

screen shot 2016-12-01 at 11 24 14 am

When I zoom in the strand is dropped and its in the wrong place. No console errors.

screen shot 2016-12-01 at 11 24 24 am

cmdcolin commented 7 years ago

It's likely because the search string crosses block boundaries, and block boundaries change depending on zoom level so that's the weird behavior.

There are probably a lot of corner cases that are not really possible to address if you keep the block based boundaries limitation for this plugin. You can just imagine constructing a regex that crosses a boundary and therefore doesn't match. Or just plugin a really long dna string into the search box, it won't match because it crosses a block boundary and therefore is not found since regex is evaluated within each block.

One workaround is to instruct jbrowse to load the sequence for the visible region into a string (in contrast to calculating on the blocks, you are loading the sequence for entire visible region in a string).....and then you can run the regex over that. This allows consistent evaluation of the regex within the region. Downside is that you might need to add a button or something to update the view when the user scrolls, since it'd be resource intensive to automatically do that every time user scrolls.

rbuels commented 6 years ago

It might be possible to have the plugin look at some sequence past each block boundary to reduce the impact of this.