StructuralVariantLegsFactory { @NotNull static List<StructuralVariantLegs> create(@NotNull final StructuralVariant variants) { final List<ModifiableStructuralVariantLegs> legs = createLegs(true, Collections.singletonList(variants)); return legs.stream().map(x -> (StructuralVariantLegs) x).collect(Collectors.toList()); }    }
@Test public void testIgnoreInserts() { final StructuralVariant first = sv(100, 200, StructuralVariantType.INS, 0.25, 0.25); final StructuralVariant second = sv(300, 400, StructuralVariantType.INS, 0.25, 0.25); final List<StructuralVariant> variants = Lists.newArrayList(first, second); final List<StructuralVariantLegs> legs = StructuralVariantLegsFactory.create(variants); assertEquals(0, legs.size()); }
@Test public void testDuplicateLeg() { final StructuralVariant first = sv(100, 100, StructuralVariantType.INV, 0.25, 0.25); final List<StructuralVariantLegs> legs = StructuralVariantLegsFactory.create(Lists.newArrayList(first)); assertEquals(1, legs.size()); assertTrue(legs.get(0).start().isPresent()); assertFalse(legs.get(0).end().isPresent()); }
@Test public void testSameVAF() { final StructuralVariant first = sv(100, 200, StructuralVariantType.INV, 0.25, 0.25); final StructuralVariant second = sv(200, 300, StructuralVariantType.BND, 0.25, 0.25); final List<StructuralVariant> variants = Lists.newArrayList(first, second); final List<StructuralVariantLegs> legs = StructuralVariantLegsFactory.create(variants); assertEquals(2, legs.size()); assertTrue(legs.get(0).start().isPresent()); assertTrue(legs.get(0).end().isPresent()); assertFalse(legs.get(1).start().isPresent()); assertTrue(legs.get(1).end().isPresent()); assertLeg(1, 0.25, legs.get(0).start().get()); assertLeg(1, 0.25, legs.get(0).end().get()); assertLeg(1, 0.25, legs.get(1).end().get()); }
@Test public void testMaxPositive() { final StructuralVariant first = sv(100, 200, StructuralVariantType.INV, 0.25, 0.25); final StructuralVariant second = sv(200, 300, StructuralVariantType.BND, 0.4, 0.25); final List<StructuralVariant> variants = Lists.newArrayList(first, second); final List<StructuralVariantLegs> legs = StructuralVariantLegsFactory.create(variants); assertEquals(2, legs.size()); assertTrue(legs.get(0).start().isPresent()); assertLeg(1, 0.25, legs.get(0).start().get()); assertFalse(legs.get(0).end().isPresent()); assertTrue(legs.get(1).start().isPresent()); assertLeg(1, 0.4, legs.get(1).start().get()); assertTrue(legs.get(1).end().isPresent()); assertLeg(1, 0.25, legs.get(1).end().get()); }
@Test public void testOpposingSign() { final StructuralVariant first = sv(100, 200, StructuralVariantType.DEL, 0.25, 0.4); final StructuralVariant second = sv(199, 300, StructuralVariantType.BND, 0.25, 0.25); final List<StructuralVariant> variants = Lists.newArrayList(first, second); final List<StructuralVariantLegs> legs = StructuralVariantLegsFactory.create(variants); assertEquals(3, legs.size()); assertTrue(legs.get(0).start().isPresent()); assertLeg(1, 0.25, legs.get(0).start().get()); assertFalse(legs.get(0).end().isPresent()); assertFalse(legs.get(1).start().isPresent()); assertTrue(legs.get(1).end().isPresent()); assertLeg(1, 0.25, legs.get(1).end().get()); assertTrue(legs.get(2).start().isPresent()); assertLeg(-1, 0.15, legs.get(2).start().get()); assertFalse(legs.get(2).end().isPresent()); }
@Test public void testSingleBreakend() { final StructuralVariant first = breakend(100, 0.25); final List<StructuralVariantLegs> legs = StructuralVariantLegsFactory.create(Lists.newArrayList(first)); assertEquals(1, legs.size()); assertTrue(legs.get(0).start().isPresent()); assertFalse(legs.get(0).end().isPresent()); }