fixed hard clipping both ends inside deletion

If both ends of the interval falls within a deletion in the read then hardClipBothEnds would cut the right tail first including the entire deletion, then fail to cut the left tail because there would not be any bases there anymore. Fixed.
This commit is contained in:
Mauricio Carneiro 2011-09-29 15:36:49 -04:00
parent a5e75cd14c
commit 9508220157
1 changed files with 6 additions and 0 deletions

View File

@ -94,6 +94,12 @@ public class ReadClipper {
if (left == right)
return new SAMRecord(read.getHeader());
SAMRecord leftTailRead = hardClipByReferenceCoordinates(right, -1);
// after clipping one tail, it is possible that the consequent hard clipping of adjacent deletions
// make the left cut index no longer part of the read. In that case, clip the read entirely.
if (left > leftTailRead.getAlignmentEnd())
return new SAMRecord(read.getHeader());
ReadClipper clipper = new ReadClipper(leftTailRead);
return clipper.hardClipByReferenceCoordinatesLeftTail(left);
}