Skip to content

Commit

Permalink
Fix for 2bit reference crash when reading the end of the reference (#…
Browse files Browse the repository at this point in the history
…1586)

* Clip requests for sequence to not go over the length of the chromosome.
* fixes #1583
  • Loading branch information
lbergelson authored Sep 25, 2024
1 parent 9170e30 commit 907726c
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/main/java/org/broad/igv/ucsc/twobit/TwoBitSequence.java
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,9 @@ public byte[] readSequence(String seqName, int regionStart, int regionEnd) {
throw new RuntimeException("regionStart cannot be less than 0");
}

//don't run off the end of the genome
regionEnd = Math.min(record.getDnaSize(), regionEnd);

Queue<Block> nBlocks = _getOverlappingBlocks(regionStart, regionEnd, record.nBlocks);
Queue<Block> maskBlocks = _getOverlappingBlocks(regionStart, regionEnd, record.maskBlocks);

Expand Down

0 comments on commit 907726c

Please sign in to comment.