Bug fix in BadCigar read filter for index out of bounds exception when used with a bam file that contains unmapped reads.

This commit is contained in:
Ryan Poplin 2012-05-21 16:46:59 -04:00
parent c1c70f3b41
commit 04000d920c
1 changed files with 4 additions and 2 deletions

View File

@ -39,9 +39,11 @@ import net.sf.samtools.SAMRecord;
public class BadCigarFilter extends ReadFilter {
public boolean filterOut(final SAMRecord rec) {
Cigar c = rec.getCigar();
final Cigar c = rec.getCigar();
if( c.isEmpty() ) { return false; } // if there is no Cigar then it can't be bad
boolean previousElementWasIndel = false;
CigarOperator lastOp = c.getCigarElement(0).getOperator();
CigarOperator lastOp = c.getCigarElement(0).getOperator();
if (lastOp == CigarOperator.D) // filter out reads starting with deletion
return true;