diff --git a/public/java/src/org/broadinstitute/sting/gatk/contexts/AlignmentContext.java b/public/java/src/org/broadinstitute/sting/gatk/contexts/AlignmentContext.java index 17e4a0743..0161c3ab2 100755 --- a/public/java/src/org/broadinstitute/sting/gatk/contexts/AlignmentContext.java +++ b/public/java/src/org/broadinstitute/sting/gatk/contexts/AlignmentContext.java @@ -138,7 +138,7 @@ public class AlignmentContext implements HasGenomeLocation { * @return */ public boolean hasReads() { - return basePileup != null && basePileup.size() > 0 ; + return basePileup != null && basePileup.getNumberOfElements() > 0 ; } /** @@ -146,7 +146,7 @@ public class AlignmentContext implements HasGenomeLocation { * @return */ public int size() { - return basePileup.size(); + return basePileup.getNumberOfElements(); } /** diff --git a/public/java/src/org/broadinstitute/sting/gatk/contexts/AlignmentContextUtils.java b/public/java/src/org/broadinstitute/sting/gatk/contexts/AlignmentContextUtils.java index c9506ec4c..4e75f3ddb 100755 --- a/public/java/src/org/broadinstitute/sting/gatk/contexts/AlignmentContextUtils.java +++ b/public/java/src/org/broadinstitute/sting/gatk/contexts/AlignmentContextUtils.java @@ -92,7 +92,7 @@ public class AlignmentContextUtils { ReadBackedPileup pileupBySample = context.getPileup().getPileupForSample(sample); // Don't add empty pileups to the split context. - if(pileupBySample.size() == 0) + if(pileupBySample.getNumberOfElements() == 0) continue; if(sample != null) diff --git a/public/java/src/org/broadinstitute/sting/gatk/walkers/annotator/AlleleBalance.java b/public/java/src/org/broadinstitute/sting/gatk/walkers/annotator/AlleleBalance.java index e501258c5..e5f75f06d 100755 --- a/public/java/src/org/broadinstitute/sting/gatk/walkers/annotator/AlleleBalance.java +++ b/public/java/src/org/broadinstitute/sting/gatk/walkers/annotator/AlleleBalance.java @@ -92,7 +92,7 @@ public class AlleleBalance extends InfoFieldAnnotation { continue; } // todo -- actually care about indel length from the pileup (agnostic at the moment) - int refCount = indelPileup.size(); + int refCount = indelPileup.getNumberOfElements(); int altCount = vc.isSimpleInsertion() ? indelPileup.getNumberOfInsertions() : indelPileup.getNumberOfDeletions(); if ( refCount + altCount == 0 ) { diff --git a/public/java/src/org/broadinstitute/sting/gatk/walkers/annotator/AnnotationByDepth.java b/public/java/src/org/broadinstitute/sting/gatk/walkers/annotator/AnnotationByDepth.java deleted file mode 100755 index 353fd1c2c..000000000 --- a/public/java/src/org/broadinstitute/sting/gatk/walkers/annotator/AnnotationByDepth.java +++ /dev/null @@ -1,32 +0,0 @@ -package org.broadinstitute.sting.gatk.walkers.annotator; - -import org.broadinstitute.sting.gatk.contexts.AlignmentContext; -import org.broadinstitute.sting.gatk.walkers.annotator.interfaces.InfoFieldAnnotation; -import org.broadinstitute.sting.utils.variantcontext.Genotype; - -import java.util.Map; - -/** - * Abstract base class for all annotations that are normalized by depth - */ -public abstract class AnnotationByDepth extends InfoFieldAnnotation { - - - protected int annotationByVariantDepth(final Map genotypes, Map stratifiedContexts) { - int depth = 0; - for ( Map.Entry genotype : genotypes.entrySet() ) { - - // we care only about variant calls - if ( genotype.getValue().isHomRef() ) - continue; - - AlignmentContext context = stratifiedContexts.get(genotype.getKey()); - if ( context != null ) - depth += context.size(); - } - - return depth; - } - - -} \ No newline at end of file diff --git a/public/java/src/org/broadinstitute/sting/gatk/walkers/annotator/DepthOfCoverage.java b/public/java/src/org/broadinstitute/sting/gatk/walkers/annotator/DepthOfCoverage.java index 864be55b7..ea28a28e4 100755 --- a/public/java/src/org/broadinstitute/sting/gatk/walkers/annotator/DepthOfCoverage.java +++ b/public/java/src/org/broadinstitute/sting/gatk/walkers/annotator/DepthOfCoverage.java @@ -41,7 +41,7 @@ public class DepthOfCoverage extends InfoFieldAnnotation implements StandardAnno int depth = 0; for ( Map.Entry sample : stratifiedContexts.entrySet() ) - depth += sample.getValue().size(); + depth += sample.getValue().getBasePileup().depthOfCoverage(); Map map = new HashMap(); map.put(getKeyNames().get(0), String.format("%d", depth)); return map; diff --git a/public/java/src/org/broadinstitute/sting/gatk/walkers/annotator/QualByDepth.java b/public/java/src/org/broadinstitute/sting/gatk/walkers/annotator/QualByDepth.java index 552289309..7fcb56b1a 100755 --- a/public/java/src/org/broadinstitute/sting/gatk/walkers/annotator/QualByDepth.java +++ b/public/java/src/org/broadinstitute/sting/gatk/walkers/annotator/QualByDepth.java @@ -1,10 +1,10 @@ package org.broadinstitute.sting.gatk.walkers.annotator; -import org.broadinstitute.sting.commandline.Hidden; import org.broadinstitute.sting.gatk.contexts.AlignmentContext; import org.broadinstitute.sting.gatk.contexts.ReferenceContext; import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker; import org.broadinstitute.sting.gatk.walkers.annotator.interfaces.AnnotatorCompatibleWalker; +import org.broadinstitute.sting.gatk.walkers.annotator.interfaces.InfoFieldAnnotation; import org.broadinstitute.sting.gatk.walkers.annotator.interfaces.StandardAnnotation; import org.broadinstitute.sting.utils.codecs.vcf.VCFHeaderLineType; import org.broadinstitute.sting.utils.codecs.vcf.VCFInfoHeaderLine; @@ -21,7 +21,7 @@ import java.util.Map; * * Low scores are indicative of false positive calls and artifacts. */ -public class QualByDepth extends AnnotationByDepth implements StandardAnnotation { +public class QualByDepth extends InfoFieldAnnotation implements StandardAnnotation { public Map annotate(RefMetaDataTracker tracker, AnnotatorCompatibleWalker walker, ReferenceContext ref, Map stratifiedContexts, VariantContext vc) { if ( stratifiedContexts.size() == 0 ) @@ -43,14 +43,13 @@ public class QualByDepth extends AnnotationByDepth implements StandardAnnotation if ( context == null ) continue; - depth += context.size(); + depth += context.getBasePileup().depthOfCoverage(); } if ( depth == 0 ) return null; - int qDepth = annotationByVariantDepth(genotypes, stratifiedContexts); - double QD = 10.0 * vc.getNegLog10PError() / (double)qDepth; + double QD = 10.0 * vc.getNegLog10PError() / (double)depth; Map map = new HashMap(); map.put(getKeyNames().get(0), String.format("%.2f", QD)); diff --git a/public/java/src/org/broadinstitute/sting/gatk/walkers/annotator/ReadDepthAndAllelicFractionBySample.java b/public/java/src/org/broadinstitute/sting/gatk/walkers/annotator/ReadDepthAndAllelicFractionBySample.java index 772541eb6..168fbdc49 100644 --- a/public/java/src/org/broadinstitute/sting/gatk/walkers/annotator/ReadDepthAndAllelicFractionBySample.java +++ b/public/java/src/org/broadinstitute/sting/gatk/walkers/annotator/ReadDepthAndAllelicFractionBySample.java @@ -79,7 +79,7 @@ public class ReadDepthAndAllelicFractionBySample extends GenotypeAnnotation { alleleCounts.put(allele.getBases()[0], 0); ReadBackedPileup pileup = stratifiedContext.getBasePileup(); - int totalDepth = pileup.size(); + int totalDepth = pileup.getNumberOfElements(); Map map = new HashMap(); map.put(getKeyNames().get(0), totalDepth); // put total depth in right away @@ -119,7 +119,7 @@ public class ReadDepthAndAllelicFractionBySample extends GenotypeAnnotation { ReadBackedExtendedEventPileup pileup = stratifiedContext.getExtendedEventPileup(); if ( pileup == null ) return null; - int totalDepth = pileup.size(); + int totalDepth = pileup.getNumberOfElements(); Map map = new HashMap(); map.put(getKeyNames().get(0), totalDepth); // put total depth in right away diff --git a/public/java/src/org/broadinstitute/sting/gatk/walkers/annotator/SBByDepth.java b/public/java/src/org/broadinstitute/sting/gatk/walkers/annotator/SBByDepth.java deleted file mode 100755 index 131b87794..000000000 --- a/public/java/src/org/broadinstitute/sting/gatk/walkers/annotator/SBByDepth.java +++ /dev/null @@ -1,59 +0,0 @@ -package org.broadinstitute.sting.gatk.walkers.annotator; - -import org.broadinstitute.sting.gatk.contexts.AlignmentContext; -import org.broadinstitute.sting.gatk.contexts.ReferenceContext; -import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker; -import org.broadinstitute.sting.gatk.walkers.annotator.interfaces.AnnotatorCompatibleWalker; -import org.broadinstitute.sting.utils.codecs.vcf.VCFConstants; -import org.broadinstitute.sting.utils.codecs.vcf.VCFHeaderLineType; -import org.broadinstitute.sting.utils.codecs.vcf.VCFInfoHeaderLine; -import org.broadinstitute.sting.utils.variantcontext.Genotype; -import org.broadinstitute.sting.utils.variantcontext.VariantContext; - -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -/** - * SB annotation value by depth of alt containing samples - */ -public class SBByDepth extends AnnotationByDepth { - - public Map annotate(RefMetaDataTracker tracker, AnnotatorCompatibleWalker walker, ReferenceContext ref, Map stratifiedContexts, VariantContext vc) { - if ( stratifiedContexts.size() == 0 ) - return null; - - if (!vc.hasAttribute(VCFConstants.STRAND_BIAS_KEY)) - return null; - - double sBias = vc.getAttributeAsDouble(VCFConstants.STRAND_BIAS_KEY, -1); - - final Map genotypes = vc.getGenotypes(); - if ( genotypes == null || genotypes.size() == 0 ) - return null; - - int sDepth = annotationByVariantDepth(genotypes, stratifiedContexts); - if ( sDepth == 0 ) - return null; - - - - double SbyD = (-sBias / (double)sDepth); - if (SbyD > 0) - SbyD = Math.log10(SbyD); - else - SbyD = -1000; - - Map map = new HashMap(); - map.put(getKeyNames().get(0), String.format("%.2f", SbyD)); - return map; - } - - public List getKeyNames() { return Arrays.asList("SBD"); } - - public List getDescriptions() { return Arrays.asList(new VCFInfoHeaderLine(getKeyNames().get(0), 1, VCFHeaderLineType.Float, "Strand Bias by Depth")); } - - - -} \ No newline at end of file diff --git a/public/java/src/org/broadinstitute/sting/gatk/walkers/annotator/SpanningDeletions.java b/public/java/src/org/broadinstitute/sting/gatk/walkers/annotator/SpanningDeletions.java index f747fbc2e..66d2ad318 100755 --- a/public/java/src/org/broadinstitute/sting/gatk/walkers/annotator/SpanningDeletions.java +++ b/public/java/src/org/broadinstitute/sting/gatk/walkers/annotator/SpanningDeletions.java @@ -43,7 +43,7 @@ public class SpanningDeletions extends InfoFieldAnnotation implements StandardAn if (pileup != null) { deletions += pileup.getNumberOfDeletions(); - depth += pileup.size(); + depth += pileup.getNumberOfElements(); } } Map map = new HashMap(); diff --git a/public/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/DiploidSNPGenotypeLikelihoods.java b/public/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/DiploidSNPGenotypeLikelihoods.java index 525be9cb0..666fe88a3 100755 --- a/public/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/DiploidSNPGenotypeLikelihoods.java +++ b/public/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/DiploidSNPGenotypeLikelihoods.java @@ -278,10 +278,10 @@ public class DiploidSNPGenotypeLikelihoods implements Cloneable { if ( elt.isReducedRead() ) { // reduced read representation - byte qual = elt.getReducedQual(); + byte qual = elt.getQual(); if ( BaseUtils.isRegularBase( elt.getBase() )) { - add(obsBase, qual, (byte)0, (byte)0, elt.getReducedCount()); // fast calculation of n identical likelihoods - return elt.getReducedCount(); // we added nObs bases here + add(obsBase, qual, (byte)0, (byte)0, elt.getRepresentativeCount()); // fast calculation of n identical likelihoods + return elt.getRepresentativeCount(); // we added nObs bases here } else // odd bases or deletions => don't use them return 0; } else { diff --git a/public/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/UnifiedGenotyperEngine.java b/public/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/UnifiedGenotyperEngine.java index 9f0585d13..e99b6af60 100755 --- a/public/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/UnifiedGenotyperEngine.java +++ b/public/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/UnifiedGenotyperEngine.java @@ -569,7 +569,7 @@ public class UnifiedGenotyperEngine { ReadBackedPileup pileup = rawContext.getBasePileup() .getMappingFilteredPileup(UAC.MIN_MAPPING_QUALTY_SCORE); // don't call when there is no coverage - if ( pileup.size() == 0 && UAC.OutputMode != OUTPUT_MODE.EMIT_ALL_SITES ) + if ( pileup.getNumberOfElements() == 0 && UAC.OutputMode != OUTPUT_MODE.EMIT_ALL_SITES ) return null; // stratify the AlignmentContext and cut by sample @@ -586,7 +586,7 @@ public class UnifiedGenotyperEngine { ReadBackedExtendedEventPileup pileup = rawPileup.getMappingFilteredPileup(UAC.MIN_MAPPING_QUALTY_SCORE); // don't call when there is no coverage - if ( pileup.size() == 0 && UAC.OutputMode != OUTPUT_MODE.EMIT_ALL_SITES ) + if ( pileup.getNumberOfElements() == 0 && UAC.OutputMode != OUTPUT_MODE.EMIT_ALL_SITES ) return null; // stratify the AlignmentContext and cut by sample @@ -602,7 +602,7 @@ public class UnifiedGenotyperEngine { for( final PileupElement p : rawContext.getBasePileup() ) { if( p.isDeletion() ) { numDeletions++; } } - if( ((double) numDeletions) / ((double) rawContext.getBasePileup().size()) > UAC.MAX_DELETION_FRACTION ) { + if( ((double) numDeletions) / ((double) rawContext.getBasePileup().getNumberOfElements()) > UAC.MAX_DELETION_FRACTION ) { return null; } } @@ -649,9 +649,9 @@ public class UnifiedGenotyperEngine { if (isCovered) { AlignmentContext context = contexts.get(sample); if (context.hasBasePileup()) - depth = context.getBasePileup().size(); + depth = context.getBasePileup().depthOfCoverage(); else if (context.hasExtendedEventPileup()) - depth = context.getExtendedEventPileup().size(); + depth = context.getExtendedEventPileup().depthOfCoverage(); } P_of_ref *= 1.0 - (theta / 2.0) * getRefBinomialProb(depth); diff --git a/public/java/src/org/broadinstitute/sting/gatk/walkers/indels/PairHMMIndelErrorModel.java b/public/java/src/org/broadinstitute/sting/gatk/walkers/indels/PairHMMIndelErrorModel.java index 0df7b7cbd..11ff99ce3 100755 --- a/public/java/src/org/broadinstitute/sting/gatk/walkers/indels/PairHMMIndelErrorModel.java +++ b/public/java/src/org/broadinstitute/sting/gatk/walkers/indels/PairHMMIndelErrorModel.java @@ -32,17 +32,11 @@ import net.sf.samtools.SAMRecord; import org.broadinstitute.sting.gatk.contexts.ReferenceContext; import org.broadinstitute.sting.utils.Haplotype; import org.broadinstitute.sting.utils.MathUtils; -import org.broadinstitute.sting.utils.exceptions.UserException; import org.broadinstitute.sting.utils.pileup.PileupElement; import org.broadinstitute.sting.utils.pileup.ReadBackedPileup; -import org.broadinstitute.sting.utils.sam.GATKSAMRecord; import org.broadinstitute.sting.utils.sam.ReadUtils; import org.broadinstitute.sting.utils.variantcontext.Allele; -import java.io.File; -import java.io.FileWriter; -import java.io.PrintStream; -import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.LinkedHashMap; @@ -376,8 +370,8 @@ public class PairHMMIndelErrorModel { HashMap> indelLikelihoodMap){ int numHaplotypes = haplotypeMap.size(); - final double readLikelihoods[][] = new double[pileup.size()][numHaplotypes]; - final int readCounts[] = new int[pileup.size()]; + final double readLikelihoods[][] = new double[pileup.getNumberOfElements()][numHaplotypes]; + final int readCounts[] = new int[pileup.getNumberOfElements()]; int readIdx=0; LinkedHashMap gapOpenProbabilityMap = new LinkedHashMap(); @@ -403,8 +397,7 @@ public class PairHMMIndelErrorModel { for (PileupElement p: pileup) { // > 1 when the read is a consensus read representing multiple independent observations - final boolean isReduced = p.isReducedRead(); - readCounts[readIdx] = isReduced ? p.getReducedCount() : 1; + readCounts[readIdx] = p.getRepresentativeCount(); // check if we've already computed likelihoods for this pileup element (i.e. for this read at this location) if (indelLikelihoodMap.containsKey(p)) { @@ -607,7 +600,7 @@ public class PairHMMIndelErrorModel { if (DEBUG) { System.out.println("\nLikelihood summary"); - for (readIdx=0; readIdx < pileup.size(); readIdx++) { + for (readIdx=0; readIdx < pileup.getNumberOfElements(); readIdx++) { System.out.format("Read Index: %d ",readIdx); for (int i=0; i < readLikelihoods[readIdx].length; i++) System.out.format("L%d: %f ",i,readLikelihoods[readIdx][i]); diff --git a/public/java/src/org/broadinstitute/sting/gatk/walkers/indels/RealignerTargetCreator.java b/public/java/src/org/broadinstitute/sting/gatk/walkers/indels/RealignerTargetCreator.java index 56ce60449..424e05c20 100755 --- a/public/java/src/org/broadinstitute/sting/gatk/walkers/indels/RealignerTargetCreator.java +++ b/public/java/src/org/broadinstitute/sting/gatk/walkers/indels/RealignerTargetCreator.java @@ -228,7 +228,7 @@ public class RealignerTargetCreator extends RodWalker 0.0 && mismatchThreshold <= 1.0 && - pileup.size() >= minReadsAtLocus && + pileup.getNumberOfElements() >= minReadsAtLocus && (double)mismatchQualities / (double)totalQualities >= mismatchThreshold ) hasPointEvent = true; } diff --git a/public/java/src/org/broadinstitute/sting/gatk/walkers/phasing/ReadBackedPhasingWalker.java b/public/java/src/org/broadinstitute/sting/gatk/walkers/phasing/ReadBackedPhasingWalker.java index 2c2677d82..68fbe8ce2 100755 --- a/public/java/src/org/broadinstitute/sting/gatk/walkers/phasing/ReadBackedPhasingWalker.java +++ b/public/java/src/org/broadinstitute/sting/gatk/walkers/phasing/ReadBackedPhasingWalker.java @@ -258,10 +258,10 @@ public class ReadBackedPhasingWalker extends RodWalkerOutput *

- * A table delimited file containing the values of the requested fields in the VCF file + * A tab-delimited file containing the values of the requested fields in the VCF file *

* *

Examples

@@ -106,7 +106,7 @@ public class VariantsToTable extends RodWalker { /** * By default this tool only emits values for fields where the FILTER field is either PASS or . (unfiltered). - * Throwing this flag will cause $WalkerName to emit values regardless of the FILTER field value. + * Throwing this flag will cause VariantsToTable to emit values regardless of the FILTER field value. */ @Advanced @Argument(fullName="showFiltered", shortName="raw", doc="If provided, field values from filtered records will be included in the output", required=false) diff --git a/public/java/src/org/broadinstitute/sting/utils/fragments/FragmentUtils.java b/public/java/src/org/broadinstitute/sting/utils/fragments/FragmentUtils.java index 83961021a..723830a91 100644 --- a/public/java/src/org/broadinstitute/sting/utils/fragments/FragmentUtils.java +++ b/public/java/src/org/broadinstitute/sting/utils/fragments/FragmentUtils.java @@ -113,7 +113,7 @@ public class FragmentUtils { } public final static FragmentCollection create(ReadBackedPileup rbp) { - return create(rbp, rbp.size(), PileupElementGetter); + return create(rbp, rbp.getNumberOfElements(), PileupElementGetter); } public final static FragmentCollection create(List reads) { diff --git a/public/java/src/org/broadinstitute/sting/utils/pileup/AbstractReadBackedPileup.java b/public/java/src/org/broadinstitute/sting/utils/pileup/AbstractReadBackedPileup.java index bec27af38..4db2f974f 100644 --- a/public/java/src/org/broadinstitute/sting/utils/pileup/AbstractReadBackedPileup.java +++ b/public/java/src/org/broadinstitute/sting/utils/pileup/AbstractReadBackedPileup.java @@ -45,6 +45,7 @@ public abstract class AbstractReadBackedPileup pileupElementTracker; protected int size = 0; // cached value of the size of the pileup + protected int abstractSize = -1; // cached value of the abstract size of the pileup protected int nDeletions = 0; // cached value of the number of deletions protected int nMQ0Reads = 0; // cached value of the number of MQ0 reads @@ -145,8 +146,16 @@ public abstract class AbstractReadBackedPileup pileup) { - size += pileup.size(); + size += pileup.getNumberOfElements(); + abstractSize += pileup.depthOfCoverage(); nDeletions += pileup.getNumberOfDeletions(); nMQ0Reads += pileup.getNumberOfMappingQualityZeroReads(); } @@ -574,7 +583,7 @@ public abstract class AbstractReadBackedPileup getReads() { - List reads = new ArrayList(size()); + List reads = new ArrayList(getNumberOfElements()); for ( PileupElement pile : this ) { reads.add(pile.getRead()); } return reads; } @@ -817,7 +836,7 @@ public abstract class AbstractReadBackedPileup getOffsets() { - List offsets = new ArrayList(size()); + List offsets = new ArrayList(getNumberOfElements()); for ( PileupElement pile : this ) { offsets.add(pile.getOffset()); } return offsets; } @@ -828,7 +847,7 @@ public abstract class AbstractReadBackedPileup { return ((GATKSAMRecord)read).isReducedRead(); } - public int getReducedCount() { - if ( ! isReducedRead() ) throw new IllegalArgumentException("Cannot get reduced count for non-reduced read " + getRead().getReadName()); - return ((GATKSAMRecord)read).getReducedCount(offset); + public int getRepresentativeCount() { + return isReducedRead() ? ((GATKSAMRecord)read).getReducedCount(offset) : 1; } - public byte getReducedQual() { - if ( ! isReducedRead() ) throw new IllegalArgumentException("Cannot get reduced qual for non-reduced read " + getRead().getReadName()); - return getQual(); - } } \ No newline at end of file diff --git a/public/java/src/org/broadinstitute/sting/utils/pileup/ReadBackedExtendedEventPileup.java b/public/java/src/org/broadinstitute/sting/utils/pileup/ReadBackedExtendedEventPileup.java index e7c0bc18f..4205ff5af 100644 --- a/public/java/src/org/broadinstitute/sting/utils/pileup/ReadBackedExtendedEventPileup.java +++ b/public/java/src/org/broadinstitute/sting/utils/pileup/ReadBackedExtendedEventPileup.java @@ -155,7 +155,7 @@ public interface ReadBackedExtendedEventPileup extends ReadBackedPileup { /** * @return the number of elements in this pileup */ - public int size(); + public int getNumberOfElements(); /** * @return the location of this pileup diff --git a/public/java/src/org/broadinstitute/sting/utils/pileup/ReadBackedExtendedEventPileupImpl.java b/public/java/src/org/broadinstitute/sting/utils/pileup/ReadBackedExtendedEventPileupImpl.java index 21dfee8b8..8910487b8 100644 --- a/public/java/src/org/broadinstitute/sting/utils/pileup/ReadBackedExtendedEventPileupImpl.java +++ b/public/java/src/org/broadinstitute/sting/utils/pileup/ReadBackedExtendedEventPileupImpl.java @@ -133,7 +133,7 @@ public class ReadBackedExtendedEventPileupImpl extends AbstractReadBackedPileup< */ @Override public byte[] getEvents() { - byte[] v = new byte[size()]; + byte[] v = new byte[getNumberOfElements()]; int i = 0; for ( ExtendedEventPileupElement e : this.toExtendedIterable() ) { switch ( e.getType() ) { diff --git a/public/java/src/org/broadinstitute/sting/utils/pileup/ReadBackedPileup.java b/public/java/src/org/broadinstitute/sting/utils/pileup/ReadBackedPileup.java index fd04b455a..9cf62c173 100644 --- a/public/java/src/org/broadinstitute/sting/utils/pileup/ReadBackedPileup.java +++ b/public/java/src/org/broadinstitute/sting/utils/pileup/ReadBackedPileup.java @@ -169,9 +169,14 @@ public interface ReadBackedPileup extends Iterable, HasGenomeLoca public int getNumberOfMappingQualityZeroReads(); /** - * @return the number of elements in this pileup + * @return the number of physical elements in this pileup (a reduced read is counted just once) */ - public int size(); + public int getNumberOfElements(); + + /** + * @return the number of abstract elements in this pileup (reduced reads are expanded to count all reads that they represent) + */ + public int depthOfCoverage(); /** * @return true if there are 0 elements in the pileup, false otherwise diff --git a/public/java/test/org/broadinstitute/sting/gatk/iterators/LocusIteratorByStateUnitTest.java b/public/java/test/org/broadinstitute/sting/gatk/iterators/LocusIteratorByStateUnitTest.java index 297a8501a..97d01bf0a 100644 --- a/public/java/test/org/broadinstitute/sting/gatk/iterators/LocusIteratorByStateUnitTest.java +++ b/public/java/test/org/broadinstitute/sting/gatk/iterators/LocusIteratorByStateUnitTest.java @@ -78,7 +78,7 @@ public class LocusIteratorByStateUnitTest extends BaseTest { ReadBackedExtendedEventPileup pileup = context.getExtendedEventPileup().getBaseFilteredPileup(10); Assert.assertEquals(pileup.getLocation().getStart(), 5, "Extended event pileup at wrong location"); - Assert.assertEquals(pileup.size(), 3, "Pileup size is incorrect"); + Assert.assertEquals(pileup.getNumberOfElements(), 3, "Pileup size is incorrect"); foundExtendedEventPileup = true; } diff --git a/public/java/test/org/broadinstitute/sting/utils/ReadUtilsUnitTest.java b/public/java/test/org/broadinstitute/sting/utils/ReadUtilsUnitTest.java index ed50a6f92..4471202c7 100755 --- a/public/java/test/org/broadinstitute/sting/utils/ReadUtilsUnitTest.java +++ b/public/java/test/org/broadinstitute/sting/utils/ReadUtilsUnitTest.java @@ -65,7 +65,7 @@ public class ReadUtilsUnitTest extends BaseTest { Assert.assertFalse(readp.isReducedRead()); Assert.assertTrue(reducedreadp.isReducedRead()); - Assert.assertEquals(reducedreadp.getReducedCount(), REDUCED_READ_COUNTS[0]); - Assert.assertEquals(reducedreadp.getReducedQual(), readp.getQual()); + Assert.assertEquals(reducedreadp.getRepresentativeCount(), REDUCED_READ_COUNTS[0]); + Assert.assertEquals(reducedreadp.getQual(), readp.getQual()); } } diff --git a/public/java/test/org/broadinstitute/sting/utils/pileup/ReadBackedPileupUnitTest.java b/public/java/test/org/broadinstitute/sting/utils/pileup/ReadBackedPileupUnitTest.java index b07da7cc8..564c987e5 100644 --- a/public/java/test/org/broadinstitute/sting/utils/pileup/ReadBackedPileupUnitTest.java +++ b/public/java/test/org/broadinstitute/sting/utils/pileup/ReadBackedPileupUnitTest.java @@ -102,7 +102,7 @@ public class ReadBackedPileupUnitTest { ReadBackedPileup nullRgPileup = pileup.getPileupForReadGroup(null); List nullRgReads = nullRgPileup.getReads(); - Assert.assertEquals(nullRgPileup.size(), 3, "Wrong number of reads in null read group"); + Assert.assertEquals(nullRgPileup.getNumberOfElements(), 3, "Wrong number of reads in null read group"); Assert.assertEquals(nullRgReads.get(0), read1, "Read " + read1.getReadName() + " should be in null rg but isn't"); Assert.assertEquals(nullRgReads.get(1), read2, "Read " + read2.getReadName() + " should be in null rg but isn't"); Assert.assertEquals(nullRgReads.get(2), read3, "Read " + read3.getReadName() + " should be in null rg but isn't"); @@ -187,7 +187,7 @@ public class ReadBackedPileupUnitTest { ReadBackedPileup pileup = new ReadBackedPileupImpl(null,sampleToPileupMap); ReadBackedPileup sample2Pileup = pileup.getPileupForSample(sample2); - Assert.assertEquals(sample2Pileup.size(),1,"Sample 2 pileup has wrong number of elements"); + Assert.assertEquals(sample2Pileup.getNumberOfElements(),1,"Sample 2 pileup has wrong number of elements"); Assert.assertEquals(sample2Pileup.getReads().get(0),read2,"Sample 2 pileup has incorrect read"); ReadBackedPileup missingSamplePileup = pileup.getPileupForSample("missing");