def test_regions_to_process_fails_with_bad_shard_args(self, task, num_shards): with self.assertRaises(ValueError): make_examples.regions_to_process( contigs=_make_contigs([('z', 100), ('a', 100), ('n', 100)]), partition_size=10, task_id=task, num_shards=num_shards)
def test_regions_to_process_fails_with_bad_shard_args(self, task, num_shards): with self.assertRaises(ValueError): make_examples.regions_to_process( contigs=_make_contigs([('z', 100), ('a', 100), ('n', 100)]), partition_size=10, task_id=task, num_shards=num_shards)
def test_regions_to_process_partition(self, max_size, calling_regions, expected): contigs = _make_contigs([('1', 100), ('2', 76), ('3', 121)]) self.assertCountEqual( _from_literals_list(expected), make_examples.regions_to_process( contigs, max_size, calling_regions=_from_literals(calling_regions)))
def get_regions(task_id, num_shards): return make_examples.regions_to_process(contigs=_make_contigs([ ('z', 100), ('a', 100), ('n', 100) ]), partition_size=5, task_id=task_id, num_shards=num_shards)
def test_regions_to_process(self, calling_regions, expected): contigs = _make_contigs([('1', 100), ('2', 200)]) self.assertCountEqual( _from_literals_list(expected), make_examples.regions_to_process( contigs, 1000, calling_regions=_from_literals(calling_regions)))
def test_regions_to_process_partition(self, max_size, calling_regions, expected): contigs = _make_contigs([('1', 100), ('2', 76), ('3', 121)]) self.assertCountEqual( _from_literals_list(expected), make_examples.regions_to_process( contigs, max_size, calling_regions=_from_literals(calling_regions)))
def test_regions_to_process_sorted_contigs(self): # These contig names are out of order lexicographically. contigs = _make_contigs([('z', 100), ('a', 100), ('n', 100)]) in_regions = _from_literals(['a:10', 'n:1', 'z:20', 'z:5']) sorted_regions = _from_literals_list(['z:5', 'z:20', 'a:10', 'n:1']) actual_regions = list( make_examples.regions_to_process( contigs, 100, calling_regions=in_regions)) # The assertEqual here is checking the order is exactly what we expect. self.assertEqual(sorted_regions, actual_regions)
def test_regions_to_process_sorted_contigs(self): # These contig names are out of order lexicographically. contigs = _make_contigs([('z', 100), ('a', 100), ('n', 100)]) in_regions = _from_literals(['a:10', 'n:1', 'z:20', 'z:5']) sorted_regions = _from_literals_list(['z:5', 'z:20', 'a:10', 'n:1']) actual_regions = list( make_examples.regions_to_process( contigs, 100, calling_regions=in_regions)) # The assertEqual here is checking the order is exactly what we expect. self.assertEqual(sorted_regions, actual_regions)
def test_regions_to_process_sorted_within_contig(self): # These regions are out of order but within a single contig. contigs = _make_contigs([('z', 100)]) in_regions = _from_literals(['z:15', 'z:20', 'z:6', 'z:25-30', 'z:3-4']) sorted_regions = _from_literals_list( ['z:3-4', 'z:6', 'z:15', 'z:20', 'z:25-30']) actual_regions = list( make_examples.regions_to_process( contigs, 100, calling_regions=in_regions)) # The assertEqual here is checking the order is exactly what we expect. self.assertEqual(sorted_regions, actual_regions)
def test_regions_to_process_sorted_within_contig(self): # These regions are out of order but within a single contig. contigs = _make_contigs([('z', 100)]) in_regions = _from_literals(['z:15', 'z:20', 'z:6', 'z:25-30', 'z:3-4']) sorted_regions = _from_literals_list( ['z:3-4', 'z:6', 'z:15', 'z:20', 'z:25-30']) actual_regions = list( make_examples.regions_to_process( contigs, 100, calling_regions=in_regions)) # The assertEqual here is checking the order is exactly what we expect. self.assertEqual(sorted_regions, actual_regions)
def get_regions(task_id, num_shards): return make_examples.regions_to_process( contigs=_make_contigs([('z', 100), ('a', 100), ('n', 100)]), partition_size=5, task_id=task_id, num_shards=num_shards)
def test_regions_to_process(self, calling_regions, expected): contigs = _make_contigs([('1', 100), ('2', 200)]) self.assertCountEqual( _from_literals_list(expected), make_examples.regions_to_process( contigs, 1000, calling_regions=_from_literals(calling_regions)))