From 08ae6c0c61fd3f6216e2f4273cdbb72f6f40c520 Mon Sep 17 00:00:00 2001 From: Mauricio Carneiro Date: Fri, 2 Sep 2011 11:32:30 -0400 Subject: [PATCH] ReadClipper is now handling unmapped reads --- .../org/broadinstitute/sting/utils/clipreads/ClippingOp.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/public/java/src/org/broadinstitute/sting/utils/clipreads/ClippingOp.java b/public/java/src/org/broadinstitute/sting/utils/clipreads/ClippingOp.java index faa3cf34e..bc200372f 100644 --- a/public/java/src/org/broadinstitute/sting/utils/clipreads/ClippingOp.java +++ b/public/java/src/org/broadinstitute/sting/utils/clipreads/ClippingOp.java @@ -252,7 +252,8 @@ public class ClippingOp { if (start == 0 && stop == read.getReadLength() -1) return new SAMRecord(read.getHeader()); - CigarShift cigarShift = hardClipCigar(read.getCigar(), start, stop); + // If the read is unmapped there is no Cigar string and neither should we create a new cigar string + CigarShift cigarShift = (read.getReadUnmappedFlag()) ? new CigarShift(new Cigar(), 0, 0) : hardClipCigar(read.getCigar(), start, stop); // the cigar may force a shift left or right (or both) in case we are left with insertions // starting or ending the read after applying the hard clip on start/stop.