FittedPurityFactory { @NotNull static List<Double> ploidyRange(double minPloidy, double maxPloidy) { List<Double> results = Lists.newArrayList(); results.addAll(sequence(Math.max(0, minPloidy), Math.min(3, maxPloidy), 0.02)); results.addAll(sequence(Math.max(3, minPloidy), Math.min(5, maxPloidy), 0.05)); results.addAll(sequence(Math.max(5, minPloidy), maxPloidy, 0.1)); results.add(maxPloidy); return results; } FittedPurityFactory(final ExecutorService executorService, final CobaltChromosomes cobaltChromosomes, final double minPurity,
            final double maxPurity, final double purityIncrements, final double minPloidy, final double maxPloidy,
            final double somaticPenaltyWeight, @NotNull final FittedRegionFactory fittedRegionFactory,
            @NotNull final Collection<ObservedRegion> observedRegions, @NotNull final Collection<SomaticVariant> variants); List<FittedPurity> all();  }
@Test public void testPloidyRange() { final List<Double> oneToThree = FittedPurityFactory.ploidyRange(1, 3); assertEquals(101, oneToThree.size()); assertEquals(1d, oneToThree.get(0), EPSILON); assertEquals(3d, oneToThree.get(100), EPSILON); final List<Double> threeToFive = FittedPurityFactory.ploidyRange(3, 5); assertEquals(41, threeToFive.size()); assertEquals(3d, threeToFive.get(0), EPSILON); assertEquals(5d, threeToFive.get(40), EPSILON); final List<Double> fiveOnwards = FittedPurityFactory.ploidyRange(5, 8); assertEquals(31, fiveOnwards.size()); assertEquals(5d, fiveOnwards.get(0), EPSILON); assertEquals(8d, fiveOnwards.get(30), EPSILON); final List<Double> all = FittedPurityFactory.ploidyRange(1, 8); assertEquals(171, all.size()); assertEquals(1d, all.get(0), EPSILON); assertEquals(3d, all.get(100), EPSILON); assertEquals(5d, all.get(140), EPSILON); assertEquals(8d, all.get(170), EPSILON); }
@Test public void testFixedPloidyRange() { double fixedPloidy = 0.3456; final List<Double> fixed = FittedPurityFactory.ploidyRange(fixedPloidy, fixedPloidy); assertEquals(1, fixed.size()); assertEquals(fixedPloidy, fixed.get(0), EPSILON); }