From f603d4c48c3448c57793ccfc51eeec721a5fb7ec Mon Sep 17 00:00:00 2001 From: Mauricio Carneiro Date: Fri, 6 Jul 2012 11:48:04 -0400 Subject: [PATCH] Fixing PairHMMIndelErrorModel boundary issue When checking the limits of a read to clip, it wasn't considering reads that may already been clipped before. --- .../walkers/indels/PairHMMIndelErrorModel.java | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/public/java/src/org/broadinstitute/sting/gatk/walkers/indels/PairHMMIndelErrorModel.java b/public/java/src/org/broadinstitute/sting/gatk/walkers/indels/PairHMMIndelErrorModel.java index 3ac09d2a7..f49e78469 100755 --- a/public/java/src/org/broadinstitute/sting/gatk/walkers/indels/PairHMMIndelErrorModel.java +++ b/public/java/src/org/broadinstitute/sting/gatk/walkers/indels/PairHMMIndelErrorModel.java @@ -198,21 +198,19 @@ public class PairHMMIndelErrorModel { } } else { + final int refWindowStart = ref.getWindow().getStart(); + final int refWindowStop = ref.getWindow().getStop(); + if (DEBUG) { System.out.format("Read Name:%s, aln start:%d aln stop:%d orig cigar:%s\n",p.getRead().getReadName(), p.getRead().getAlignmentStart(), p.getRead().getAlignmentEnd(), p.getRead().getCigarString()); } + GATKSAMRecord read = ReadClipper.hardClipAdaptorSequence(p.getRead()); - if (read.isEmpty()) - continue; - - if (read.getSoftEnd() > ref.getWindow().getStop()) + if (!read.isEmpty() && (read.getSoftEnd() > refWindowStop && read.getSoftStart() < refWindowStop)) read = ReadClipper.hardClipByReferenceCoordinatesRightTail(read, ref.getWindow().getStop()); - if (read.isEmpty()) - continue; - - if (read.getSoftStart() < ref.getWindow().getStart()) + if (!read.isEmpty() && (read.getSoftStart() < refWindowStart && read.getSoftEnd() > refWindowStart)) read = ReadClipper.hardClipByReferenceCoordinatesLeftTail (read, ref.getWindow().getStart()); if (read.isEmpty())