ExtendLongArm { @NotNull static List<CombinedRegion> extendLongArm(@NotNull final List<CombinedRegion> regions) { final int centromereIndex = findCentromere(regions); if (centromereIndex > 0) { final double copyNumber = regions.get(centromereIndex).tumorCopyNumber(); extendLeft(copyNumber, centromereIndex - 1, regions); } return regions; }    }
@Test public void testCentromereToTelomere() { final CombinedRegion first = createCombinedRegion(1, 5000, 3, 0.3, SegmentSupport.NONE); final CombinedRegion centromere = createCombinedRegion(5001, 20000, 2, 0.5, SegmentSupport.CENTROMERE); final List<CombinedRegion> result = ExtendLongArm.extendLongArm(Lists.newArrayList(first, centromere)); assertEquals(2, result.size()); assertCombinedRegion(1, 5000, 2, CopyNumberMethod.LONG_ARM, result.get(0)); assertCombinedRegion(5001, 20000, 2, CopyNumberMethod.UNKNOWN, result.get(1)); }
@Test public void testIneligibleChromosome() { final CombinedRegion first = createCombinedRegion("1", 1, 5000, 3, 0.3, SegmentSupport.NONE); final CombinedRegion centromere = createCombinedRegion("1", 5001, 20000, 2, 0.5, SegmentSupport.CENTROMERE); final List<CombinedRegion> result = ExtendLongArm.extendLongArm(Lists.newArrayList(first, centromere)); assertEquals(2, result.size()); assertCombinedRegion(1, 5000, 3, CopyNumberMethod.UNKNOWN, result.get(0)); assertCombinedRegion(5001, 20000, 2, CopyNumberMethod.UNKNOWN, result.get(1)); }
@Test public void testExtendThroughStructuralVariantButKeepBreakIntact() { final CombinedRegion first = createCombinedRegion(1, 1000, 3, 0.3, SegmentSupport.NONE); final CombinedRegion second = createCombinedRegion(1001, 2000, 3, 0.3, SegmentSupport.NONE); final CombinedRegion third = createCombinedRegion(2001, 5000, 3, 0.3, SegmentSupport.BND); final CombinedRegion centromere = createCombinedRegion(5001, 20000, 2, 0.5, SegmentSupport.CENTROMERE); final List<CombinedRegion> result = ExtendLongArm.extendLongArm(Lists.newArrayList(first, second, third, centromere)); assertEquals(3, result.size()); assertCombinedRegion(1, 2000, 2, CopyNumberMethod.LONG_ARM, result.get(0)); assertCombinedRegion(2001, 5000, 2, CopyNumberMethod.LONG_ARM, result.get(1)); assertCombinedRegion(5001, 20000, 2, CopyNumberMethod.UNKNOWN, result.get(2)); }
@Test public void testDoesNotExtendRight() { final CombinedRegion centromere = createCombinedRegion(10001, 20000, 2, 0.5, SegmentSupport.CENTROMERE); final CombinedRegion unprocessedRight = createCombinedRegion(20001, 30000, 3, 0.3, SegmentSupport.NONE); final List<CombinedRegion> result = ExtendLongArm.extendLongArm(Lists.newArrayList(centromere, unprocessedRight)); assertEquals(2, result.size()); assertCombinedRegion(10001, 20000, 2, CopyNumberMethod.UNKNOWN, result.get(0)); assertCombinedRegion(20001, 30000, 3, CopyNumberMethod.UNKNOWN, result.get(1)); }
@Test public void extendsToStart() { final CombinedRegion first = createCombinedRegion(1, 5000, 3, 0.3, SegmentSupport.NONE); final CombinedRegion second = createCombinedRegion(5001, 10000, 3, 0.3, SegmentSupport.NONE); final CombinedRegion centromere = createCombinedRegion(10001, 20000, 2, 0.5, SegmentSupport.CENTROMERE); final List<CombinedRegion> result = ExtendLongArm.extendLongArm(Lists.newArrayList(first, second, centromere)); assertEquals(2, result.size()); assertCombinedRegion(1, 10000, 2, CopyNumberMethod.LONG_ARM, result.get(0)); assertCombinedRegion(10001, 20000, 2, CopyNumberMethod.UNKNOWN, result.get(1)); }
@Test public void extendsThroughUnprocessed() { final CombinedRegion first = createCombinedRegion(1, 5000, 3, 0.3, SegmentSupport.NONE); final CombinedRegion second = createCombinedRegion(5001, 10000, 3, 0.3, SegmentSupport.NONE); final CombinedRegion centromere = createCombinedRegion(10001, 20000, 2, 0.5, SegmentSupport.CENTROMERE); first.setTumorCopyNumber(CopyNumberMethod.STRUCTURAL_VARIANT, 3); final List<CombinedRegion> result = ExtendLongArm.extendLongArm(Lists.newArrayList(first, second, centromere)); assertEquals(3, result.size()); assertCombinedRegion(1, 5000, 3, CopyNumberMethod.STRUCTURAL_VARIANT, result.get(0)); assertCombinedRegion(5001, 10000, 2, CopyNumberMethod.LONG_ARM, result.get(1)); assertCombinedRegion(10001, 20000, 2, CopyNumberMethod.UNKNOWN, result.get(2)); }
@Test public void extendsStopsAtProcessed() { final CombinedRegion first = createCombinedRegion(1, 5000, 3, 0.3, SegmentSupport.NONE); final CombinedRegion second = createCombinedRegion(5001, 10000, 3, 0.3, SegmentSupport.NONE); final CombinedRegion centromere = createCombinedRegion(10001, 20000, 2, 0.5, SegmentSupport.CENTROMERE); second.setTumorCopyNumber(CopyNumberMethod.STRUCTURAL_VARIANT, 3); final List<CombinedRegion> result = ExtendLongArm.extendLongArm(Lists.newArrayList(first, second, centromere)); assertEquals(3, result.size()); assertCombinedRegion(1, 5000, 3, CopyNumberMethod.UNKNOWN, result.get(0)); assertCombinedRegion(5001, 10000, 3, CopyNumberMethod.STRUCTURAL_VARIANT, result.get(1)); assertCombinedRegion(10001, 20000, 2, CopyNumberMethod.UNKNOWN, result.get(2)); }
@Test public void extendsThroughProcessedOnChromosome21() { final CombinedRegion first = createCombinedRegion("21", 1, 5000, 3, 0.3, SegmentSupport.NONE); final CombinedRegion second = createCombinedRegion("21", 5001, 10000, 3, 0.3, SegmentSupport.NONE); final CombinedRegion centromere = createCombinedRegion("21", 10001, 20000, 2, 0.5, SegmentSupport.CENTROMERE); first.setTumorCopyNumber(CopyNumberMethod.STRUCTURAL_VARIANT, 3); final List<CombinedRegion> result = ExtendLongArm.extendLongArm(Lists.newArrayList(first, second, centromere)); assertEquals(2, result.size()); assertCombinedRegion(1, 10000, 2, CopyNumberMethod.LONG_ARM, result.get(0)); assertCombinedRegion(10001, 20000, 2, CopyNumberMethod.UNKNOWN, result.get(1)); }