Optimization: don't keep scoring an alternate consensus if it's already worse than the best alt seen so far.

git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@2806 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
ebanks 2010-02-07 05:06:32 +00:00
parent ca1917507f
commit 4fe851a83d
2 changed files with 15 additions and 2 deletions

View File

@ -498,15 +498,23 @@ public class IndelRealigner extends ReadWalker<Integer, Integer> {
//logger.debug(consensus.str + " vs. " + toTest.getRead().getReadString() + " => " + myScore + " - " + altAlignment.first);
if ( !toTest.getRead().getDuplicateReadFlag() )
consensus.mismatchSum += myScore;
// optimization: once the mismatch sum is higher than the best consensus, quit since this one can't win
// THIS MUST BE DISABLED IF WE DECIDE TO ALLOW MORE THAN ONE ALTERNATE CONSENSUS!
if ( bestConsensus != null && consensus.mismatchSum > bestConsensus.mismatchSum )
break;
}
//logger.debug(consensus.str + " " + consensus.mismatchSum);
if ( bestConsensus == null || bestConsensus.mismatchSum > consensus.mismatchSum) {
if ( bestConsensus != null ) bestConsensus.readIndexes.clear();
// we do not need this alt consensus, release memory right away!!
if ( bestConsensus != null )
bestConsensus.readIndexes.clear();
bestConsensus = consensus;
//logger.debug(consensus.str + " " + consensus.mismatchSum);
} else {
consensus.readIndexes.clear(); // we do not need this alt consensus, release memory right away!!
// we do not need this alt consensus, release memory right away!!
consensus.readIndexes.clear();
}
}

View File

@ -361,6 +361,11 @@ public class IntervalCleanerWalker extends LocusWindowWalker<Integer, Integer>
//logger.debug(consensus.str + " vs. " + toTest.getRead().getReadString() + " => " + myScore + " - " + altAlignment.first);
if ( !toTest.getRead().getDuplicateReadFlag() )
consensus.mismatchSum += myScore;
// optimization: once the mismatch sum is higher than the best consensus, quit since this one can't win
// THIS MUST BE DISABLED IF WE DECIDE TO ALLOW MORE THAN ONE ALTERNATE CONSENSUS!
if ( bestConsensus != null && consensus.mismatchSum > bestConsensus.mismatchSum )
break;
}
//logger.debug(consensus.str + " " + consensus.mismatchSum);