more use of new ReadBackedPileup optimizations

git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@2187 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
ebanks 2009-11-30 20:04:01 +00:00
parent f5fe28cc28
commit add2fa7ab4
2 changed files with 9 additions and 10 deletions

View File

@ -3,6 +3,7 @@ package org.broadinstitute.sting.gatk.walkers.genotyper;
import net.sf.samtools.SAMRecord; import net.sf.samtools.SAMRecord;
import org.broadinstitute.sting.utils.*; import org.broadinstitute.sting.utils.*;
import org.broadinstitute.sting.utils.pileup.ReadBackedPileup; import org.broadinstitute.sting.utils.pileup.ReadBackedPileup;
import org.broadinstitute.sting.utils.pileup.PileupElement;
import org.broadinstitute.sting.utils.genotype.DiploidGenotype; import org.broadinstitute.sting.utils.genotype.DiploidGenotype;
import static java.lang.Math.log10; import static java.lang.Math.log10;
@ -277,20 +278,18 @@ public class GenotypeLikelihoods implements Cloneable {
public int add(ReadBackedPileup pileup, boolean ignoreBadBases) { public int add(ReadBackedPileup pileup, boolean ignoreBadBases) {
int n = 0; int n = 0;
for (int i = 0; i < pileup.getReads().size(); i++) { for ( PileupElement p : pileup ) {
int offset = pileup.getOffsets().get(i); byte base = p.getBase();
// ignore deletions // ignore deletions
if ( offset == -1 ) if ( base == PileupElement.DELETION_BASE )
continue; continue;
SAMRecord read = pileup.getReads().get(i); byte qual = p.getQual();
char base = (char)read.getReadBases()[offset]; if ( ! ignoreBadBases || ! badBase((char)base) ) {
byte qual = read.getBaseQualities()[offset]; n += add((char)base, qual, p.getRead(), p.getOffset());
if ( ! ignoreBadBases || ! badBase(base) ) {
n += add(base, qual, read, offset);
} }
} }
return n; return n;
} }

View File

@ -250,7 +250,7 @@ public class VCFGenotypeCall extends AlleleConstrainedGenotype implements ReadBa
* @return the number of reads we're backed by * @return the number of reads we're backed by
*/ */
public int getReadCount() { public int getReadCount() {
return (mCoverage > 0 ? mCoverage : (mPileup != null ? mPileup.getReads().size() : 0)); return (mCoverage > 0 ? mCoverage : (mPileup != null ? mPileup.size() : 0));
} }
/** /**