From 9f44018b7d5e096a52f9b449dfefb44ce48c5fc7 Mon Sep 17 00:00:00 2001 From: asivache Date: Fri, 5 Feb 2010 17:58:54 +0000 Subject: [PATCH] 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 --- .../sting/gatk/walkers/indels/IntervalCleanerWalker.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/indels/IntervalCleanerWalker.java b/java/src/org/broadinstitute/sting/gatk/walkers/indels/IntervalCleanerWalker.java index 52c87fde2..051e7e4c7 100755 --- a/java/src/org/broadinstitute/sting/gatk/walkers/indels/IntervalCleanerWalker.java +++ b/java/src/org/broadinstitute/sting/gatk/walkers/indels/IntervalCleanerWalker.java @@ -346,6 +346,7 @@ public class IntervalCleanerWalker extends LocusWindowWalker for ( int j = 0; j < altReads.size(); j++ ) { AlignedRead toTest = altReads.get(j); + // returned pair={alignment_offset on consensus, alignment score (mismtach sum)}: Pair 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 //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!! } }