PurpleSegmentFactory { @NotNull @VisibleForTesting static List<PurpleSegment> create(@NotNull final GenomePosition centromere, @NotNull final GenomePosition length, @NotNull final Collection<Cluster> clusters) { return addCentromere(centromere, create(length, clusters)); } PurpleSegmentFactory(final int windowSize, final Map<Chromosome, GenomePosition> centromeres,
            final Map<Chromosome, GenomePosition> lengths); List<PurpleSegment> segment(@NotNull final List<StructuralVariant> variants,
            @NotNull final Multimap<Chromosome, PCFPosition> pcfPositions, @NotNull ListMultimap<Chromosome, CobaltRatio> ratios);  }
@Test public void testEmpty() { final List<PurpleSegment> segments = PurpleSegmentFactory.create(CHROMOSOME_CENTROMERE, CHROMOSOME_LENGTH, Collections.emptyList()); assertEquals(2, segments.size()); assertPurpleSegment(segments.get(0), 1, CHROMOSOME_CENTROMERE.position() - 1, true, TELOMERE); assertPurpleSegment(segments.get(1), CHROMOSOME_CENTROMERE.position(), CHROMOSOME_LENGTH.position(), true, CENTROMERE); }
@Test public void testSingleSV() { final List<Cluster> clusters = Lists.newArrayList(cluster(17001, 18881).build()); final List<PurpleSegment> segments = PurpleSegmentFactory.create(CHROMOSOME_CENTROMERE, CHROMOSOME_LENGTH, clusters); assertEquals(3, segments.size()); assertPurpleSegment(segments.get(0), 1, 18880, true, TELOMERE); assertPurpleSegment(segments.get(1), 18881, CHROMOSOME_CENTROMERE.position() - 1, false, BND); assertPurpleSegment(segments.get(2), CHROMOSOME_CENTROMERE.position(), CHROMOSOME_LENGTH.position(), false, CENTROMERE); }
@Test public void testSVAtCentromere() { final List<Cluster> clusters = Lists.newArrayList(cluster(17001, CHROMOSOME_CENTROMERE.position()).build()); final List<PurpleSegment> segments = PurpleSegmentFactory.create(CHROMOSOME_CENTROMERE, CHROMOSOME_LENGTH, clusters); assertEquals(2, segments.size()); assertPurpleSegment(segments.get(0), 1, CHROMOSOME_CENTROMERE.position() - 1, true, TELOMERE); assertPurpleSegment(segments.get(1), CHROMOSOME_CENTROMERE.position(), CHROMOSOME_LENGTH.position(), false, CENTROMERE); }
@Test public void testSingleSVWithRatioSupport() { final Cluster cluster = addRatios(cluster(17002, 18881), 17050, 19000).build(); final List<PurpleSegment> segments = PurpleSegmentFactory.create(CHROMOSOME_CENTROMERE, CHROMOSOME_LENGTH, Lists.newArrayList(cluster)); assertEquals(3, segments.size()); assertPurpleSegment(segments.get(0), 1, 18880, true, TELOMERE); assertPurpleSegment(segments.get(1), 18881, CHROMOSOME_CENTROMERE.position() - 1, true, BND); assertPurpleSegment(segments.get(2), CHROMOSOME_CENTROMERE.position(), CHROMOSOME_LENGTH.position(), true, CENTROMERE); }
@Test public void testMultipleSVAtSamePosition() { final List<Cluster> clusters = Lists.newArrayList(cluster(17001, 18881).addVariants(variant(18881)).build()); final List<PurpleSegment> segments = PurpleSegmentFactory.create(CHROMOSOME_CENTROMERE, CHROMOSOME_LENGTH, clusters); assertEquals(3, segments.size()); assertPurpleSegment(segments.get(0), 1, 18880, true, TELOMERE); assertPurpleSegment(segments.get(1), 18881, CHROMOSOME_CENTROMERE.position() - 1, false, MULTIPLE); assertPurpleSegment(segments.get(2), CHROMOSOME_CENTROMERE.position(), CHROMOSOME_LENGTH.position(), false, CENTROMERE); }
@Test public void testMultipleSVInSameCluster() { final List<Cluster> clusters = Lists.newArrayList(cluster(17001, 18881).addVariants(variant(19991)).build()); final List<PurpleSegment> segments = PurpleSegmentFactory.create(CHROMOSOME_CENTROMERE, CHROMOSOME_LENGTH, clusters); assertEquals(4, segments.size()); assertPurpleSegment(segments.get(0), 1, 18880, true, TELOMERE); assertPurpleSegment(segments.get(1), 18881, 19990, false, BND); assertPurpleSegment(segments.get(2), 19991, CHROMOSOME_CENTROMERE.position() - 1, false, BND); assertPurpleSegment(segments.get(3), CHROMOSOME_CENTROMERE.position(), CHROMOSOME_LENGTH.position(), false, CENTROMERE); }
@Test public void testRatiosOnly() { final Cluster cluster = addRatios(cluster(17002), 18881, 19000).build(); final List<PurpleSegment> segments = PurpleSegmentFactory.create(CHROMOSOME_CENTROMERE, CHROMOSOME_LENGTH, Lists.newArrayList(cluster)); assertEquals(3, segments.size()); assertPurpleSegment(segments.get(0), 1, 18880, true, TELOMERE); assertPurpleSegment(segments.get(1), 18881, CHROMOSOME_CENTROMERE.position() - 1, true, NONE); assertPurpleSegment(segments.get(2), CHROMOSOME_CENTROMERE.position(), CHROMOSOME_LENGTH.position(), true, CENTROMERE); }