Bug fix: if we're genotyping a very long indel (>100 bp) fail gracefully instead of with an array out of bounds exception

This commit is contained in:
Guillermo del Angel 2011-07-08 12:48:49 -04:00
parent 06f12eca56
commit 224574424e
1 changed files with 5 additions and 1 deletions

View File

@ -133,8 +133,12 @@ public class Haplotype {
byte[] basesBeforeVariant = Arrays.copyOfRange(refBases,startIdxInReference,startIdxInReference+numPrefBases);
int startAfter = startIdxInReference+numPrefBases+ refAllele.getBases().length;
// protect against long events that overrun available reference context
if (startAfter > refBases.length)
startAfter = refBases.length;
byte[] basesAfterVariant = Arrays.copyOfRange(refBases,
startIdxInReference+numPrefBases+ refAllele.getBases().length, refBases.length);
startAfter, refBases.length);
// Create location for all haplotypes