def test_candidates_to_windows_min_window_distance(self, distance):
     candidates = [
         # We one candidate at position 100 with a 5 count.
         100,
         # We have another candidate at outside of our distance with a 5 count,
         # so it should produce a candidate but not be joined with our our
         # candidate at 100.
         100 - 2 * distance - 1,
         # Finally, we have another variant that is exactly distance away from
         # 100. It should be joined with the candidate at 100 to produce a single
         # larger window.
         100 + distance
     ]
     expected = [
         # Our first window is for the 100 - 2 * distance one.
         ranges.make_range('ref', 100 - 3 * distance - 1,
                           100 - distance - 1),
         # Our second window starts at 100 (- distance for the window size) and
         # ends at 100 + distance + distance (again for window size).
         ranges.make_range('ref', 100 - distance, 100 + 2 * distance),
     ]
     self.config.min_windows_distance = distance
     self.assertEqual(
         window_selector._candidates_to_windows(self.config, candidates,
                                                'ref'), expected)
 def test_candidates_to_windows_window_size(self, size):
     # We have a single candidate at position 100 with a 5 count.
     candidates = [100]
     # We expect the created window to be +/- size from 100.
     expected = ranges.make_range('ref', 100 - size, 100 + size)
     self.config.min_windows_distance = size
     self.assertEqual(
         window_selector._candidates_to_windows(self.config, candidates,
                                                'ref'), [expected])
 def test_candidates_to_windows_merged_close_candidates(self, distance):
     # Create five candidates separated by exactly distance from each other:
     # 100, 101, 102, 103, 104 for distance == 1
     # 100, 102, 104, 106, 108 for distance == 2
     candidates = [100 + i * distance for i in range(5)]
     # Which should all be merged together into one giant window.
     expected = [
         ranges.make_range('ref', 100 - distance,
                           max(candidates) + distance),
     ]
     self.config.min_windows_distance = distance
     self.assertEqual(
         window_selector._candidates_to_windows(self.config, candidates,
                                                'ref'), expected)
 def test_candidates_to_windows(self, candidates, expected_ranges):
     self.assertEqual(
         window_selector._candidates_to_windows(self.config, candidates,
                                                'ref'), expected_ranges)