Reducing memory footprint: if alt consensus does not beat the best alt observed so far, destroy its data immediately, instead of keeping them around. If new alt is better than the old best, then destroy the old best right away instead.

git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@2793 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
asivache 2010-02-05 17:58:54 +00:00
parent be33d1852c
commit 9f44018b7d
1 changed files with 4 additions and 0 deletions

View File

@ -346,6 +346,7 @@ public class IntervalCleanerWalker extends LocusWindowWalker<Integer, Integer>
for ( int j = 0; j < altReads.size(); j++ ) {
AlignedRead toTest = altReads.get(j);
// returned pair={alignment_offset on consensus, alignment score (mismtach sum)}:
Pair<Integer, Integer> altAlignment = findBestOffset(consensus.str, toTest);
// the mismatch score is the min of its alignment vs. the reference and vs. the alternate
@ -364,8 +365,11 @@ public class IntervalCleanerWalker extends LocusWindowWalker<Integer, Integer>
//logger.debug(consensus.str + " " + consensus.mismatchSum);
if ( bestConsensus == null || bestConsensus.mismatchSum > consensus.mismatchSum) {
if ( bestConsensus != null ) bestConsensus.readIndexes.clear(); // forget the old best consensus data, do not waste memory
bestConsensus = consensus;
//logger.debug(consensus.str + " " + consensus.mismatchSum);
} else {
consensus.readIndexes.clear(); // we do not need this alt consensus, release memory right away!!
}
}