PurityAdjuster { public double expectedFrequency(final double normalCopyNumber, final int normalPloidy, final double tumorCopyNumber, final double tumorPloidy) { if (Doubles.lessOrEqual(tumorCopyNumber, 0)) { return 0; } double totalObservations = purity * tumorCopyNumber + normalCopyNumber * (1 - purity); double normalObservations = normalPloidy * (1 - purity); double tumorObservations = tumorPloidy * purity; return (normalObservations + tumorObservations) / totalObservations; } PurityAdjuster(@NotNull final FittedPurity fittedPurity);  PurityAdjuster(final double purity, final double normFactor); static double impliedPloidy(double averageRatio, double purity, double normFactor); static double impliedNormFactor(double averageRatio, double purity, double tumorPloidy); static double impliedAverageRatio(double purity, double normFactor, double tumorPloidy); double purity(); double normFactor(); double germlineCopyNumber(@NotNull String contig); abstract double germlineRatio(@NotNull String contig); double purityAdjustedCopyNumber(final String chromosomeName, final double ratio); double purityAdjustedCopyNumber(final double tumorRatio, final double normalRatio); double purityAdjustedVAF(@NotNull final String chromosome, final double copyNumber, final double observedFrequency); double purityAdjustedBAFSimple(final String chromosome, final double copyNumber, final double observedFrequency); double purityAdjustedPloidy(final double normalCopyNumber, final double normalPloidy, final double tumorCopyNumber,
            final double observedFrequency); double expectedFrequency(final double normalCopyNumber, final int normalPloidy, final double tumorCopyNumber,
            final double tumorPloidy); double purityAdjustedVAFWithHeterozygousNormal(@NotNull final String chromosome, final double copyNumber,
            final double observedFrequency); double purityAdjustedVAFWithHomozygousNormal(@NotNull final String chromosome, final double copyNumber,
            final double observedFrequency);  }
@Test public void testExpectedFrequencyWithNegativeTumorCopyNumber() { final PurityAdjuster victim = new PurityAdjusterTypicalChromosome(Gender.FEMALE, 1, 1d); assertEquals(0, victim.expectedFrequency(2, 1, -0.2, -0.1), EPSILON); }