diff --git a/src/main/java/org/broadinstitute/hellbender/tools/walkers/haplotypecaller/ReferenceConfidenceModel.java b/src/main/java/org/broadinstitute/hellbender/tools/walkers/haplotypecaller/ReferenceConfidenceModel.java index 93b3bc84ae1..84c62fe1115 100644 --- a/src/main/java/org/broadinstitute/hellbender/tools/walkers/haplotypecaller/ReferenceConfidenceModel.java +++ b/src/main/java/org/broadinstitute/hellbender/tools/walkers/haplotypecaller/ReferenceConfidenceModel.java @@ -195,18 +195,18 @@ public List calculateRefConfidence(final Haplotype refHaplotype, final String sampleName = readLikelihoods.getSample(0); final int globalRefOffset = refSpan.getStart() - activeRegion.getExtendedSpan().getStart(); - for ( final ReadPileup pileup : refPileups ) { + for (int i = 0, size = refPileups.size(); i < size; i++) { + ReadPileup pileup = refPileups.get(i); final Locatable curPos = pileup.getLocation(); final int offset = curPos.getStart() - refSpan.getStart(); final VariantContext overlappingSite = GATKVariantContextUtils.getOverlappingVariantContext(curPos, variantCalls); final List currentPriors = getMatchingPriors(curPos, overlappingSite, VCpriors); - if ( overlappingSite != null && overlappingSite.getStart() == curPos.getStart() ) { + if (overlappingSite != null && overlappingSite.getStart() == curPos.getStart()) { if (applyPriors) { results.add(PosteriorProbabilitiesUtils.calculatePosteriorProbs(overlappingSite, currentPriors, numRefSamplesForPrior, options)); - } - else { + } else { results.add(overlappingSite); } } else { @@ -422,9 +422,15 @@ protected static boolean isAltAfterAssembly(final PileupElement element, final b * @param priorList priors within the current ActiveRegion * @return prior VCs representing the same variant position as call */ - List getMatchingPriors(final Locatable curPos, final VariantContext call, final List priorList) { + private List getMatchingPriors(final Locatable curPos, final VariantContext call, final List priorList) { final int position = call != null ? call.getStart() : curPos.getStart(); - return priorList.stream().filter(vc -> position == vc.getStart()).collect(Collectors.toList()); + List list = new ArrayList<>(priorList.size()); + for (int i = 0, size = priorList.size(); i < size; i++) { + if (position == priorList.get(i).getStart()) { + list.add(priorList.get(i)); + } + } + return list; } /**