private VariantCallContext estimateReferenceConfidence(
      VariantContext vc,
      Map<String, AlignmentContext> contexts,
      double theta,
      boolean ignoreCoveredSamples,
      double initialPofRef) {
    if (contexts == null) return null;

    double P_of_ref = initialPofRef;

    // for each sample that we haven't examined yet
    for (String sample : samples) {
      boolean isCovered = contexts.containsKey(sample);
      if (ignoreCoveredSamples && isCovered) continue;

      int depth = 0;

      if (isCovered) {
        depth = contexts.get(sample).getBasePileup().depthOfCoverage();
      }

      P_of_ref *= 1.0 - (theta / 2.0) * getRefBinomialProb(depth);
    }

    return new VariantCallContext(
        vc,
        QualityUtils.phredScaleErrorRate(1.0 - P_of_ref) >= UAC.STANDARD_CONFIDENCE_FOR_CALLING,
        false);
  }
 @Test(dataProvider = "PhredScaleDoubleOps")
 public void testPhredScaleDoubleOps(final double errorRate, final double expectedPhredScaled) {
   final double actualError = QualityUtils.phredScaleErrorRate(errorRate);
   Assert.assertEquals(actualError, expectedPhredScaled, TOLERANCE);
   final double trueRate = 1 - errorRate;
   final double actualTrue = QualityUtils.phredScaleCorrectRate(trueRate);
   if (trueRate == 1.0) {
     Assert.assertEquals(actualTrue, QualityUtils.MIN_PHRED_SCALED_QUAL);
   } else {
     final double tol = errorRate < 1e-10 ? 10.0 : 1e-3;
     Assert.assertEquals(actualTrue, expectedPhredScaled, tol);
   }
 }
 protected boolean confidentlyCalled(double conf, double PofF) {
   return conf >= UAC.STANDARD_CONFIDENCE_FOR_CALLING
       || (UAC.GenotypingMode
               == GenotypeLikelihoodsCalculationModel.GENOTYPING_MODE.GENOTYPE_GIVEN_ALLELES
           && QualityUtils.phredScaleErrorRate(PofF) >= UAC.STANDARD_CONFIDENCE_FOR_CALLING);
 }