Silly me, I forgot to check for the contig boundaries. Thank goodness for performance tests!

git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@4061 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
ebanks 2010-08-19 18:40:26 +00:00
parent f16bb1e830
commit 4b94f8c21b
1 changed files with 3 additions and 1 deletions

View File

@ -1318,7 +1318,9 @@ public class IndelRealigner extends ReadWalker<Integer, Integer> {
// set up the reference if we haven't done so yet
if ( reference == null ) {
// first, pad the reference to handle deletions in narrow windows (e.g. those with only 1 read)
loc = GenomeLocParser.createGenomeLoc(loc.getContigIndex(), loc.getStart()-REFERENCE_PADDING, loc.getStop()+REFERENCE_PADDING);
long padLeft = Math.max(loc.getStart()-REFERENCE_PADDING, 1);
long padRight = Math.min(loc.getStop()+REFERENCE_PADDING, referenceReader.getSequenceDictionary().getSequence(loc.getContig()).getSequenceLength());
loc = GenomeLocParser.createGenomeLoc(loc.getContigIndex(), padLeft, padRight);
reference = referenceReader.getSubsequenceAt(loc.getContig(), loc.getStart(), loc.getStop()).getBases();
}