From eb899741e10a31ecf9f0badbd429f0cd77c18a17 Mon Sep 17 00:00:00 2001 From: asivache Date: Wed, 6 Jan 2010 18:59:37 +0000 Subject: [PATCH] reverting last changes. no cacheing git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@2526 348d0f76-0448-11de-a6fe-93d51630548a --- .../sting/utils/pileup/ReadBackedPileup.java | 20 +++++++------------ 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/java/src/org/broadinstitute/sting/utils/pileup/ReadBackedPileup.java b/java/src/org/broadinstitute/sting/utils/pileup/ReadBackedPileup.java index 9f293a93b..c8b2688c1 100755 --- a/java/src/org/broadinstitute/sting/utils/pileup/ReadBackedPileup.java +++ b/java/src/org/broadinstitute/sting/utils/pileup/ReadBackedPileup.java @@ -20,9 +20,7 @@ import net.sf.samtools.SAMRecord; public class ReadBackedPileup implements Iterable { private GenomeLoc loc = null; private ArrayList pileup = null; - byte [] bases = null; // will be used to cache pileup bases after first call to getBases - byte [] mapquals = null; // will be used to cache pileup mapping quals after first call to getMappingQuals - + private int size = 0; // cached value of the size of the pileup private int nDeletions = 0; // cached value of the number of deletions private int nMQ0Reads = 0; // cached value of the number of MQ0 reads @@ -397,11 +395,9 @@ public class ReadBackedPileup implements Iterable { * @return */ public byte[] getBases() { - if ( bases == null ) { - bases = new byte[size()]; - for ( ExtendedPileupElement pile : this.extendedForeachIterator() ) { bases[pile.getPileupOffset()] = pile.getBase(); } - } - return bases; + byte[] v = new byte[size()]; + for ( ExtendedPileupElement pile : this.extendedForeachIterator() ) { v[pile.getPileupOffset()] = pile.getBase(); } + return v; } /** @@ -429,11 +425,9 @@ public class ReadBackedPileup implements Iterable { * @return */ public byte[] getMappingQuals() { - if ( mapquals == null ) { - mapquals = new byte[size()]; - for ( ExtendedPileupElement pile : this.extendedForeachIterator() ) { mapquals[pile.getPileupOffset()] = (byte)pile.getRead().getMappingQuality(); } - } - return mapquals; + byte[] v = new byte[size()]; + for ( ExtendedPileupElement pile : this.extendedForeachIterator() ) { v[pile.getPileupOffset()] = (byte)pile.getRead().getMappingQuality(); } + return v; }