FittedPurityScoreFactory { public static double polyclonalProportion(@NotNull final Collection<PurpleCopyNumber> regions) { int polyclonalCount = 0; int totalCount = 0; for (final PurpleCopyNumber region : regions) { totalCount += region.bafCount(); if (isPolyclonal(region.averageTumorCopyNumber())) { polyclonalCount += region.bafCount(); } } return totalCount == 0 ? 0 : 1d * polyclonalCount / totalCount; }  @NotNull static FittedPurityScore score(@NotNull final List<FittedPurity> purities); static double polyclonalProportion(@NotNull final Collection<PurpleCopyNumber> regions);  }
@Test public void testPolyclonalProportion() { assertTrue(isPolyclonal(2.749)); assertFalse(isPolyclonal(2.75)); assertFalse(isPolyclonal(2.751)); assertFalse(isPolyclonal(3.0)); assertFalse(isPolyclonal(3.249)); assertFalse(isPolyclonal(3.25)); assertTrue(isPolyclonal(3.251)); }