From 95082201579062be0d49a0f845177e85f6c99d71 Mon Sep 17 00:00:00 2001 From: Mauricio Carneiro Date: Thu, 29 Sep 2011 15:36:49 -0400 Subject: [PATCH 1/2] 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. --- .../broadinstitute/sting/utils/clipreads/ReadClipper.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/public/java/src/org/broadinstitute/sting/utils/clipreads/ReadClipper.java b/public/java/src/org/broadinstitute/sting/utils/clipreads/ReadClipper.java index 5230381c0..11a59de10 100644 --- a/public/java/src/org/broadinstitute/sting/utils/clipreads/ReadClipper.java +++ b/public/java/src/org/broadinstitute/sting/utils/clipreads/ReadClipper.java @@ -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); } From cabacf028d96cd3678d41891e491aedf356473da Mon Sep 17 00:00:00 2001 From: Mauricio Carneiro Date: Thu, 29 Sep 2011 18:45:12 -0400 Subject: [PATCH 2/2] Intermediate commit to fix interval skipping may need additional testing. --- .../java/src/org/broadinstitute/sting/utils/sam/ReadUtils.java | 1 + 1 file changed, 1 insertion(+) diff --git a/public/java/src/org/broadinstitute/sting/utils/sam/ReadUtils.java b/public/java/src/org/broadinstitute/sting/utils/sam/ReadUtils.java index fcb3089cd..3c389fd4c 100755 --- a/public/java/src/org/broadinstitute/sting/utils/sam/ReadUtils.java +++ b/public/java/src/org/broadinstitute/sting/utils/sam/ReadUtils.java @@ -966,4 +966,5 @@ public class ReadUtils { AlignmentStartComparator comp = new AlignmentStartComparator(); return comp.compare(read1, read2); } + }