Merge branch 'master' of ssh://gsa1/humgen/gsa-scr1/gsa-engineering/git/unstable
This commit is contained in:
commit
bb7bf74aa8
|
|
@ -50,19 +50,20 @@ public class MalformedReadFilter extends ReadFilter {
|
||||||
|
|
||||||
public boolean filterOut(SAMRecord read) {
|
public boolean filterOut(SAMRecord read) {
|
||||||
// slowly changing the behavior to blow up first and filtering out if a parameter is explicitly provided
|
// slowly changing the behavior to blow up first and filtering out if a parameter is explicitly provided
|
||||||
if (!checkMismatchingBasesAndQuals(read)) {
|
|
||||||
if (!filterMismatchingBaseAndQuals)
|
|
||||||
throw new UserException.MalformedBAM(read, "BAM file has a read with mismatching number of bases and base qualities. Offender: " + read.getReadName() +" [" + read.getReadLength() + " bases] [" +read.getBaseQualities().length +"] quals");
|
|
||||||
else
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return !checkInvalidAlignmentStart(read) ||
|
return !checkInvalidAlignmentStart(read) ||
|
||||||
!checkInvalidAlignmentEnd(read) ||
|
!checkInvalidAlignmentEnd(read) ||
|
||||||
!checkAlignmentDisagreesWithHeader(this.header,read) ||
|
!checkAlignmentDisagreesWithHeader(this.header,read) ||
|
||||||
|
!checkHasReadGroup(read) ||
|
||||||
|
!checkMismatchingBasesAndQuals(read, filterMismatchingBaseAndQuals) ||
|
||||||
!checkCigarDisagreesWithAlignment(read);
|
!checkCigarDisagreesWithAlignment(read);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static boolean checkHasReadGroup(SAMRecord read) {
|
||||||
|
if ( read.getReadGroup() == null )
|
||||||
|
throw new UserException.ReadMissingReadGroup(read);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check for the case in which the alignment start is inconsistent with the read unmapped flag.
|
* Check for the case in which the alignment start is inconsistent with the read unmapped flag.
|
||||||
* @param read The read to validate.
|
* @param read The read to validate.
|
||||||
|
|
@ -127,7 +128,15 @@ public class MalformedReadFilter extends ReadFilter {
|
||||||
* @param read the read to validate
|
* @param read the read to validate
|
||||||
* @return true if they have the same number. False otherwise.
|
* @return true if they have the same number. False otherwise.
|
||||||
*/
|
*/
|
||||||
private static boolean checkMismatchingBasesAndQuals(SAMRecord read) {
|
private static boolean checkMismatchingBasesAndQuals(SAMRecord read, boolean filterMismatchingBaseAndQuals) {
|
||||||
return (read.getReadLength() == read.getBaseQualities().length);
|
boolean result;
|
||||||
|
if (read.getReadLength() == read.getBaseQualities().length)
|
||||||
|
result = true;
|
||||||
|
else if (filterMismatchingBaseAndQuals)
|
||||||
|
result = false;
|
||||||
|
else
|
||||||
|
throw new UserException.MalformedBAM(read, String.format("BAM file has a read with mismatching number of bases and base qualities. Offender: %s [%d bases] [%d quals]", read.getReadName(), read.getReadLength(), read.getBaseQualities().length));
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue