LocalPhaseSet extends BufferedPostProcessor { static int adjustedOffset(@NotNull final VariantHotspot left, @NotNull final VariantHotspot right) { long positionOffset = positionOffset(left, right); if (positionOffset == 0) { return 0; } return (int) (positionOffset + Math.max(0, left.ref().length() - left.alt().length()) - Math.max(0, left.alt().length() - left.ref().length())); } LocalPhaseSet(@NotNull final Consumer<SageVariant> consumer);   }
@Test public void testOffsetSNVs() { VariantHotspot left = create(100, "A", "T"); VariantHotspot right = create(102, "C", "T"); assertEquals(-2, LocalPhaseSet.adjustedOffset(left, right)); }
@Test public void testDelToTheRight() { VariantHotspot left = create(100, "A", "T"); VariantHotspot right = create(102, "CAT", "T"); assertEquals(-2, LocalPhaseSet.adjustedOffset(left, right)); }
@Test public void testInsToTheRight() { VariantHotspot left = create(100, "A", "T"); VariantHotspot right = create(102, "C", "TAT"); assertEquals(-2, LocalPhaseSet.adjustedOffset(left, right)); }
@Test public void testDelToTheLeft() { VariantHotspot left = create(100, "AA", "A"); VariantHotspot right = create(102, "G", "T"); assertEquals(-1, LocalPhaseSet.adjustedOffset(left, right)); left = create(100, "AA", "A"); right = create(103, "G", "T"); assertEquals(-2, LocalPhaseSet.adjustedOffset(left, right)); left = create(100, "AAC", "A"); right = create(103, "G", "T"); assertEquals(-1, LocalPhaseSet.adjustedOffset(left, right)); left = create(100, "AAC", "A"); right = create(104, "G", "T"); assertEquals(-2, LocalPhaseSet.adjustedOffset(left, right)); }
@Test public void testInsToTheLeft() { VariantHotspot left = create(100, "A", "AA"); VariantHotspot right = create(101, "G", "T"); assertEquals(-2, LocalPhaseSet.adjustedOffset(left, right)); left = create(100, "A", "AA"); right = create(102, "G", "T"); assertEquals(-3, LocalPhaseSet.adjustedOffset(left, right)); left = create(100, "A", "AAC"); right = create(101, "G", "T"); assertEquals(-3, LocalPhaseSet.adjustedOffset(left, right)); left = create(100, "A", "AAC"); right = create(102, "G", "T"); assertEquals(-4, LocalPhaseSet.adjustedOffset(left, right)); }
@Test public void testTwoInsertsAtSameLocation() { VariantHotspot left = create(100, "A", "AAA"); VariantHotspot right = create(100, "A", "AA"); assertEquals(0, LocalPhaseSet.adjustedOffset(left, right)); assertEquals(0, LocalPhaseSet.adjustedOffset(right, left)); }
@Test public void testTwoDeletesAtSameLocation() { VariantHotspot left = create(100, "AAA", "A"); VariantHotspot right = create(100, "AA", "A"); assertEquals(0, LocalPhaseSet.adjustedOffset(left, right)); assertEquals(0, LocalPhaseSet.adjustedOffset(right, left)); }