def test_two_same_segments(self): a = MagicMock() a.starts = np.array([0, 5], dtype=uint32) a.founder = np.array([1, 2], dtype=uint32) a.end = 10 shared = common_homolog_segments(a, a) self.assertEqual(shared, [(0, 10)])
def test_two_same_segments(self): a = MagicMock() a.starts = np.array([0, 5], dtype = uint32) a.founder = np.array([1, 2], dtype = uint32) a.end = 10 shared = common_homolog_segments(a, a) self.assertEqual(shared, [(0, 10)])
def test_single_element_vs_many_match_in_front(self): a = MagicMock() a.starts = np.array([0], dtype=uint32) a.founder = np.array([0], dtype=uint32) a.end = 10 b = MagicMock() b.starts = np.array([0, 2, 4, 8], dtype=uint32) b.founder = np.array([0, 2, 3, 4], dtype=uint32) b.end = 10 shared = common_homolog_segments(a, b) self.assertEqual(shared, [(0, 2)])
def test_two_segments_different_boundary(self): a = MagicMock() a.starts = np.array([0, 5], dtype=uint32) a.founder = np.array([1, 1], dtype=uint32) a.end = 10 b = MagicMock() b.starts = np.array([0, 6], dtype=uint32) b.founder = np.array([1, 1], dtype=uint32) b.end = 10 shared = common_homolog_segments(a, b) self.assertEqual(shared, [(0, 10)])
def test_multiple_same_segment(self): a = MagicMock() a.starts = np.array([0], dtype=uint32) a.founder = np.array([0], dtype=uint32) a.end = 10 b = MagicMock() b.starts = np.array([0, 5], dtype=uint32) b.founder = np.array([0, 0], dtype=uint32) b.end = 10 shared = common_homolog_segments(a, b) self.assertEqual(shared, [(0, 10)])
def test_single_different_segment(self): a = MagicMock() a.starts = np.array([0], dtype=uint32) a.founder = np.array([0], dtype=uint32) a.end = 10 b = MagicMock() b.starts = np.array([0], dtype=uint32) b.founder = np.array([1], dtype=uint32) b.end = 10 shared = common_homolog_segments(a, b) self.assertEqual(shared, [])
def test_single_element_vs_many_match_in_front(self): a = MagicMock() a.starts = np.array([0], dtype = uint32) a.founder = np.array([0], dtype = uint32) a.end = 10 b = MagicMock() b.starts = np.array([0, 2, 4, 8], dtype = uint32) b.founder = np.array([0, 2, 3, 4], dtype = uint32) b.end = 10 shared = common_homolog_segments(a, b) self.assertEqual(shared, [(0, 2)])
def test_two_segments_different_boundary(self): a = MagicMock() a.starts = np.array([0, 5], dtype = uint32) a.founder = np.array([1, 1], dtype = uint32) a.end = 10 b = MagicMock() b.starts = np.array([0, 6], dtype = uint32) b.founder = np.array([1, 1], dtype = uint32) b.end = 10 shared = common_homolog_segments(a, b) self.assertEqual(shared, [(0, 10)])
def test_multiple_same_segment(self): a = MagicMock() a.starts = np.array([0], dtype = uint32) a.founder = np.array([0], dtype = uint32) a.end = 10 b = MagicMock() b.starts = np.array([0, 5], dtype = uint32) b.founder = np.array([0, 0], dtype = uint32) b.end = 10 shared = common_homolog_segments(a, b) self.assertEqual(shared, [(0, 10)])
def test_single_different_segment(self): a = MagicMock() a.starts = np.array([0], dtype = uint32) a.founder = np.array([0], dtype = uint32) a.end = 10 b = MagicMock() b.starts = np.array([0], dtype = uint32) b.founder = np.array([1], dtype = uint32) b.end = 10 shared = common_homolog_segments(a, b) self.assertEqual(shared, [])