Fix for exception when trying to load reference segment for a read that aligns

to 0 bases.


git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@4485 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
hanna 2010-10-12 23:50:51 +00:00
parent fe9f128631
commit ed39af53cd
1 changed files with 8 additions and 1 deletions

View File

@ -74,8 +74,15 @@ public class ReferenceView implements View {
protected byte[] getReferenceBases( GenomeLoc genomeLoc ) {
SAMSequenceRecord sequenceInfo = reference.getSequenceDictionary().getSequence(genomeLoc.getContig());
long start = genomeLoc.getStart();
long stop = Math.min( genomeLoc.getStop(), sequenceInfo.getSequenceLength() );
ReferenceSequence subsequence = reference.getSubsequenceAt(genomeLoc.getContig(), genomeLoc.getStart(), stop);
// Read with no aligned bases? Return an empty array.
if(stop - start + 1 == 0)
return new byte[0];
ReferenceSequence subsequence = reference.getSubsequenceAt(genomeLoc.getContig(), start, stop);
int overhang = (int)(genomeLoc.getStop() - stop);
if ( overhang > 0 ) {