ReadClipper is now handling unmapped reads

This commit is contained in:
Mauricio Carneiro 2011-09-02 11:32:30 -04:00
parent d241f0e903
commit 08ae6c0c61
1 changed files with 2 additions and 1 deletions

View File

@ -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.