TransvarInterpreter { @NotNull @VisibleForTesting static VariantHotspot reduceComplexityForComplexInsDel(@NotNull VariantHotspot complexInsDel) { assert complexInsDel.ref().length() > 1 && complexInsDel.alt().length() > 1; String simplifiedRef = complexInsDel.ref(); String simplifiedAlt = complexInsDel.alt(); while (simplifiedRef.length() > 1 && simplifiedAlt.length() > 1 && simplifiedRef.charAt(simplifiedRef.length() - 1) == simplifiedAlt .charAt(simplifiedAlt.length() - 1)) { simplifiedRef = simplifiedRef.substring(0, simplifiedRef.length() - 1); simplifiedAlt = simplifiedAlt.substring(0, simplifiedAlt.length() - 1); } long adjustedPos = complexInsDel.position(); while (simplifiedRef.length() > 2 && simplifiedAlt.length() > 2 && simplifiedRef.subSequence(0, 1) .equals(simplifiedAlt.substring(0, 1))) { adjustedPos++; simplifiedRef = simplifiedRef.substring(1); simplifiedAlt = simplifiedAlt.substring(1); } return ImmutableVariantHotspotImpl.builder() .chromosome(complexInsDel.chromosome()) .position(adjustedPos) .ref(simplifiedRef) .alt(simplifiedAlt) .build(); } private  TransvarInterpreter(@NotNull IndexedFastaSequenceFile refGenome);   }
@Test public void canReduceComplexityOnComplexDelInsHotspots() { VariantHotspot hotspot = ImmutableVariantHotspotImpl.builder().chromosome("1").position(10).ref("ATGTTA").alt("ATCCTA").build(); VariantHotspot simplifiedHotspot = TransvarInterpreter.reduceComplexityForComplexInsDel(hotspot); assertEquals(12, simplifiedHotspot.position()); assertEquals("GT", simplifiedHotspot.ref()); assertEquals("CC", simplifiedHotspot.alt()); }