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:
parent
c1c70f3b41
commit
04000d920c
|
|
@ -39,9 +39,11 @@ import net.sf.samtools.SAMRecord;
|
||||||
public class BadCigarFilter extends ReadFilter {
|
public class BadCigarFilter extends ReadFilter {
|
||||||
|
|
||||||
public boolean filterOut(final SAMRecord rec) {
|
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;
|
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
|
if (lastOp == CigarOperator.D) // filter out reads starting with deletion
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue