ExtendDiploidBAF { @VisibleForTesting boolean isSimpleDupSurroundedByLOH(@NotNull final InferRegion inferRegion, @NotNull final List<CombinedRegion> regions) { boolean isValidIndexes = inferRegion.leftTargetIndex == inferRegion.rightTargetIndex && inferRegion.leftSourceIndex != -1 && inferRegion.rightSourceIndex != -1; if (!isValidIndexes) { return false; } FittedRegion target = regions.get(inferRegion.leftTargetIndex).region(); FittedRegion right = regions.get(inferRegion.rightSourceIndex).region(); boolean isStartAndEndDup = target.support() == SegmentSupport.DUP && right.support() == SegmentSupport.DUP; if (!isStartAndEndDup) { return false; } boolean isTheSameDup = simpleDupMap.containsKey(target.start()) && simpleDupMap.get(target.start()) == right.start(); if (!isTheSameDup) { return false; } FittedRegion left = regions.get(inferRegion.leftSourceIndex).region(); return Doubles.lessThan(left.minorAlleleCopyNumber(), 0.5) && Doubles.lessThan(right.minorAlleleCopyNumber(), 0.5); } ExtendDiploidBAF(@NotNull final List<StructuralVariant> simpleVariants); @VisibleForTesting  ExtendDiploidBAF(@NotNull final Map<Long, Long> simpleDupMap);   }
@Test public void testDUPWithLOH() { final Map<Long, Long> dupMap = Maps.newHashMap(); dupMap.put(1001L, 2001L); final ExtendDiploidBAF victim = new ExtendDiploidBAF(dupMap); CombinedRegion leftWithLOH = create(1, 1000, SegmentSupport.TELOMERE, 10, 1, 2); CombinedRegion dup = create(1001, 2000, SegmentSupport.DUP, 0, 1, 4); CombinedRegion del = create(1001, 2000, SegmentSupport.DEL, 0, 1, 4); CombinedRegion rightWithLOH = create(2001, 3000, SegmentSupport.DUP, 1, 1, 2); CombinedRegion rightWithoutLOH = create(2001, 3000, SegmentSupport.DUP, 1, 0.5, 2); ExtendDiploidBAF.InferRegion inferRegion = new ExtendDiploidBAF.InferRegion(0, 1, 1, 2); assertTrue(victim.isSimpleDupSurroundedByLOH(inferRegion, Lists.newArrayList(leftWithLOH, dup, rightWithLOH))); assertFalse(victim.isSimpleDupSurroundedByLOH(inferRegion, Lists.newArrayList(leftWithLOH, dup, rightWithoutLOH))); assertFalse(victim.isSimpleDupSurroundedByLOH(inferRegion, Lists.newArrayList(leftWithLOH, del, rightWithLOH))); }