ClusterFactory { @NotNull public ListMultimap<Chromosome, Cluster> cluster(@NotNull final List<StructuralVariant> variants, @NotNull final Multimap<Chromosome, PCFPosition> pcfPositions, @NotNull ListMultimap<Chromosome, CobaltRatio> ratios) { final Multimap<Chromosome, SVSegment> positions = Multimaps.fromPositions(SVSegmentFactory.create(variants)); return cluster(positions, pcfPositions, ratios); } ClusterFactory(final int windowSize); @NotNull ListMultimap<Chromosome, Cluster> cluster(@NotNull final List<StructuralVariant> variants,
            @NotNull final Multimap<Chromosome, PCFPosition> pcfPositions, @NotNull ListMultimap<Chromosome, CobaltRatio> ratios);  }
@Test public void testBoundaries() { final List<SVSegment> sv = variants(37383599, 37387153); final List<PCFPosition> ratios = createRatioBreaks(36965001, 37381001, 37382001, 37384001, 37387001, 37389001); final List<CobaltRatio> cobalt = cobalt(37380001, true, false, true, true, true, true, true); final List<Cluster> clusters = victim.cluster(sv, ratios, cobalt); assertEquals(4, clusters.size()); assertRatioInCluster(clusters.get(0), 36964002, 36965001); assertRatioInCluster(clusters.get(1), 37380002, 37381001, 37382001); assertCluster(clusters.get(2), 37382002L, 37383599L, 37383599L, 37384001L, 37384001L); assertCluster(clusters.get(3), 37386002L, 37387153L, 37387153L, 37387001L, 37389001L); }
@Test public void testDefaultClusterBounds() { final SVSegment sv = createSVPosition(15532); final List<Cluster> clusters = victim.cluster(Lists.newArrayList(sv), Collections.emptyList(), Collections.emptyList()); assertEquals(1, clusters.size()); assertVariantInCluster(clusters.get(0), 14002, 15532); }
@Test public void testClusterBoundsWithRatios() { final List<SVSegment> sv = variants(15532); final List<CobaltRatio> ratios = createRatios(); final List<Cluster> clusters = victim.cluster(sv, Collections.emptyList(), ratios); assertEquals(1, clusters.size()); assertVariantInCluster(clusters.get(0), 12002, 15532); }
@Test public void testTwoSVInsideCluster() { final List<SVSegment> sv = variants(15532, 16771); final List<Cluster> clusters = victim.cluster(sv, Collections.emptyList(), Collections.emptyList()); assertEquals(1, clusters.size()); assertVariantsInCluster(clusters.get(0), 14002, 15532, 16771); }
@Test public void testTwoSVOutsideCluster() { final List<SVSegment> sv = variants(15532, 17881); final List<Cluster> clusters = victim.cluster(sv, Collections.emptyList(), Collections.emptyList()); assertEquals(2, clusters.size()); assertVariantInCluster(clusters.get(0), 14002, 15532); assertVariantInCluster(clusters.get(1), 16002, 17881); }
@Test public void testTwoSVInsideClusterWithRatio() { final List<SVSegment> sv = variants(15532, 18881); final List<CobaltRatio> ratios = createRatios(); final List<Cluster> clusters = victim.cluster(sv, Collections.emptyList(), ratios); assertEquals(1, clusters.size()); assertVariantsInCluster(clusters.get(0), 12002, 15532, 18881); }