Removes a very inefficient way to iterate in ReferenceConfidenceModel.isReadInformativeAboutIndelsOfSize(...)

Addresses performance issue #1048.
This commit is contained in:
vruano 2015-07-15 17:58:51 -04:00
parent 45a1d82305
commit 7f74303f2b
1 changed files with 6 additions and 14 deletions

View File

@ -491,20 +491,12 @@ public class ReferenceConfidenceModel {
// consider each indel size up to max in term, checking if an indel that deletes either the ref bases (deletion // consider each indel size up to max in term, checking if an indel that deletes either the ref bases (deletion
// or read bases (insertion) would fit as well as the origin baseline sum of mismatching quality scores // or read bases (insertion) would fit as well as the origin baseline sum of mismatching quality scores
for ( int indelSize = 1; indelSize <= maxIndelSize; indelSize++ ) { for ( int indelSize = 1; indelSize <= maxIndelSize; indelSize++ ) {
for ( final boolean checkInsertion : Arrays.asList(true, false) ) { // check insertions:
final int readI, refI; if (sumMismatchingQualities(readBases, readQuals, readStart + indelSize, refBases, refStart, baselineMMSum) <= baselineMMSum)
if ( checkInsertion ) { return false;
readI = readStart + indelSize; // check deletions:
refI = refStart; if (sumMismatchingQualities(readBases, readQuals, readStart, refBases, refStart + indelSize, baselineMMSum) <= baselineMMSum)
} else { return false;
readI = readStart;
refI = refStart + indelSize;
}
final int score = sumMismatchingQualities(readBases, readQuals, readI, refBases, refI, baselineMMSum);
if ( score <= baselineMMSum )
return false;
}
} }
return true; return true;