Sometimes restriction enzyme recognition/cut site display crashes SeqViz
Related to #270
Describe the bug
For circular sequences, SeqViz crashes when an enzyme's combined recognition site and cut site sequence span straddles the last SeqBlock and first SeqBlock.
This bug was reported within the context of a related but possibly different issue:
...when the cut sites fall off the edge of a sequence, it causes the component to crash.
Expected behavior
If an enzyme's recognition sequence is detected near the end of the final SeqBlock and some-or-all the associated cut site is offset from it such that it extends off the end of the final SeqBlock, then the cut site should be displayed on the first SeqBlock, at the top of the sequence viewer display.
Additional context The reported error occurs at line 178 in elementsToRows.ts
I'm not able to reproduce the crash. See the image, BsaI is twice, at the end I highlighted it because seqviz is not rendering. The problem is still valid, Seqviz should render it by drawing the cutsite in the first line. But is not crashing seqviz, so I'm wondering if the crash is related to something else.
Screenshot of the error provided by Kevin:
Thanks a ton for checking into this; let me see if I can narrow down my repro steps!
Okay, I've spent a couple hours attempting to recreate this crash and have yet to succeed. Even trying to reverse engineer the failure based on the source - it's really tough to see how that particular line could fail in that particular way as the guards seem ... inescapable. Happy for you all to close this for now and I can ping / reopen if I ever manage to figure out how I was consistently getting that ^ error. Apologies for the noise!
Thanks for trying to reproduce @jpsorensen-asimov! I went down the same path with no luck either, there are too many variables involved in the creation of the variables inside the crashing for loop, it's hard to narrow it down.
I'll modify the title of the bug to be a bit more generic (I'm not sure that is the cut site going off the end of the sequence that is causing the issue) and leave it open for a while in case someone is able to reproduce. I'll also create separate issue for Seqviz to support rendering cut sites that cross the zero index
Closing since we are not able to reproduce the issue.