Skip to content

Conversation

@hyanwong
Copy link
Member

@hyanwong hyanwong commented Sep 5, 2022

Fixes #2487, see extra discussion in #2473

PR Checklist:

  • Tests that fully cover new/changed functionality.
  • Documentation including tutorial content if appropriate.
  • Changelogs, if there are API changes.

@hyanwong
Copy link
Member Author

hyanwong commented Sep 5, 2022

@petrelharp: I seem to have opened up a can of worms. This is failing on edge ordering when comparing the tsutil python version of subset() (here) to the new one, even though I added a tables.sort() to both versions. Can you figure out why?

@hyanwong hyanwong force-pushed the fix-subset-sort branch 2 times, most recently from 8082a3e to 09db06f Compare September 22, 2022 08:25
@hyanwong
Copy link
Member Author

hyanwong commented Sep 22, 2022

@petrelharp: I seem to have opened up a can of worms. This is failing on edge ordering when comparing the tsutil python version of subset() (here) to the new one, even though I added a tables.sort() to both versions. Can you figure out why?

OK - fixed now. In verify_subset we now can't test that the edges are identical and in the same order as a subset of the full table, because sorting might change the edge order. So we have to make a set and test that instead. Here I test each element against the set of expected edges, but it might be nicer to make another set from subset.edges and simply test set equality.

Ready for review.

@codecov
Copy link

codecov bot commented Sep 22, 2022

Codecov Report

Merging #2489 (5ddba5f) into main (1d8bc7e) will decrease coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #2489      +/-   ##
==========================================
- Coverage   93.91%   93.90%   -0.01%     
==========================================
  Files          28       27       -1     
  Lines       27216    27191      -25     
  Branches     1263     1263              
==========================================
- Hits        25559    25535      -24     
+ Misses       1623     1622       -1     
  Partials       34       34              
Flag Coverage Δ
c-tests 92.24% <ø> (ø)
lwt-tests 89.05% <ø> (ø)
python-c-tests 73.19% <100.00%> (+1.49%) ⬆️
python-tests 98.95% <100.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
python/tskit/trees.py 98.74% <ø> (-0.01%) ⬇️
python/tskit/tables.py 98.95% <100.00%> (+<0.01%) ⬆️
python/tskit/__init__.py
python/_tskitmodule.c 92.91% <0.00%> (+0.01%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1d8bc7e...5ddba5f. Read the comment docs.

@hyanwong hyanwong requested a review from benjeffery September 24, 2022 12:03
Copy link
Member

@benjeffery benjeffery left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, one small paranoia point about the testing.

@hyanwong
Copy link
Member Author

Thanks @benjeffery - changed

Copy link
Member

@jeromekelleher jeromekelleher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, but I think we need to make it clear that there'll be some extra sorting in the tables.subset case, as this could potentially break some code.

@mergify mergify bot merged commit e966add into tskit-dev:main Sep 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Change sort in subset to tables implementation?

3 participants