ReportablePredicate implements Predicate<SomaticVariant> { @Override public boolean test(final SomaticVariant variant) { final DriverGene driverGene = driverGeneMap.get(variant.gene()); if (driverGene == null) { return false; } if (variant.type().equals(VariantType.INDEL) && maxRepeatCount > 0 && variant.repeatCount() > maxRepeatCount) { return false; } if (variant.isHotspot() && driverGene.reportHotspot()) { return true; } DriverImpact impact = DriverImpact.select(variant); switch (impact) { case NONSENSE: case FRAMESHIFT: return driverGene.reportNonsenseAndFrameshift(); case SPLICE: return driverGene.reportSplice(); case MISSENSE: case INFRAME: return driverGene.reportMissenseAndInframe(); default: return false; } } ReportablePredicate(@NotNull final DriverCategory type, @NotNull final DriverGenePanel driverGenePanel); @Override boolean test(final SomaticVariant variant);  }
@Test public void testIgnoreIndelsWithLargeRepeatCount() { final SomaticVariant variant = SomaticVariantTestBuilderFactory.create() .gene("AR") .repeatCount(MAX_ONCO_REPEAT_COUNT) .type(VariantType.INDEL) .canonicalCodingEffect(CodingEffect.MISSENSE) .build(); final SomaticVariant variantLargeRepeatCount = ImmutableSomaticVariantImpl.builder().from(variant).repeatCount(MAX_ONCO_REPEAT_COUNT + 1).build(); ReportablePredicate oncoPredicate = new ReportablePredicate(DriverCategory.ONCO, genePanel); assertTrue(oncoPredicate.test(variant)); assertFalse(oncoPredicate.test(variantLargeRepeatCount)); }