Skip to content

Commit b232615

Browse files
petrelharpjeromekelleher
authored andcommitted
make sure no sites are skipped
1 parent dc90ef5 commit b232615

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

c/tskit/tables.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4566,8 +4566,7 @@ tsk_table_sorter_run(tsk_table_sorter_t *self, tsk_bookmark_t *start)
45664566
if (start->sites == self->tables->sites.num_rows
45674567
&& start->mutations == self->tables->mutations.num_rows) {
45684568
skip_sites = true;
4569-
} else if (start->sites != 0
4570-
|| start->mutations != 0) {
4569+
} else if (start->sites != 0 || start->mutations != 0) {
45714570
ret = TSK_ERR_SORT_OFFSET_NOT_SUPPORTED;
45724571
goto out;
45734572
}

python/tests/test_topology.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3277,7 +3277,6 @@ def test_map_mutations_with_and_without_roots(self):
32773277
sites_after=sites,
32783278
mutations_after=mutations_after,
32793279
keep_input_roots=False,
3280-
debug=True
32813280
)
32823281
self.verify_simplify(
32833282
samples=[0],
@@ -3290,7 +3289,6 @@ def test_map_mutations_with_and_without_roots(self):
32903289
sites_after=sites,
32913290
mutations_after=mutations_after_keep,
32923291
keep_input_roots=True,
3293-
debug=True
32943292
)
32953293

32963294
def test_overlapping_edges(self):
@@ -5745,11 +5743,18 @@ def verify_keep_input_roots(self, ts, samples):
57455743
while u != tskit.NULL:
57465744
root_path.append(u)
57475745
u = input_tree.parent(u)
5748-
input_sites = {site.position: site for site in input_tree.sites()}
5746+
input_sites = {
5747+
site.position: site
5748+
for site in input_tree.sites()
5749+
if site.position >= left and site.position < right
5750+
}
57495751
new_sites = {
5750-
site.position: site for site in tree_with_roots.sites()
5752+
site.position: site
5753+
for site in tree_with_roots.sites()
5754+
if site.position >= left and site.position < right
57515755
}
5752-
positions = set(input_sites.keys()) & set(new_sites.keys())
5756+
self.assertEqual(set(input_sites.keys()), set(new_sites.keys()))
5757+
positions = input_sites.keys()
57535758
for position in positions:
57545759
self.assertTrue(left <= position < right)
57555760
new_site = new_sites[position]

0 commit comments

Comments
 (0)