Skip to content

Conversation

@GertjanBisschop
Copy link
Member

@GertjanBisschop GertjanBisschop commented Jun 2, 2022

First step towards adding num_children array for Trees. #2274

@codecov
Copy link

codecov bot commented Jun 2, 2022

Codecov Report

Merging #2316 (688b875) into main (6086531) will increase coverage by 5.61%.
The diff coverage is n/a.

❗ Current head 688b875 differs from pull request most recent head 33ccde2. Consider uploading reports for the commit 33ccde2 to get more accurate results

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #2316      +/-   ##
==========================================
+ Coverage   93.28%   98.89%   +5.61%     
==========================================
  Files          28       17      -11     
  Lines       26451     5994   -20457     
  Branches     1202     1188      -14     
==========================================
- Hits        24675     5928   -18747     
+ Misses       1744       36    -1708     
+ Partials       32       30       -2     
Flag Coverage Δ
c-tests ?
lwt-tests ?
python-c-tests ?
python-tests 98.89% <ø> (+0.03%) ⬆️

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

Impacted Files Coverage Δ
python/tskit/trees.py 98.14% <0.00%> (-0.03%) ⬇️
c/tskit/trees.c
python/_tskitmodule.c
c/tskit/core.h
c/tskit/tables.c
c/tskit/stats.c
python/lwt_interface/example_c_module.c
c/tskit/genotypes.c
python/lwt_interface/tskit_lwt_interface.h
c/tskit/haplotype_matching.c
... and 3 more

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 6086531...33ccde2. Read the comment docs.

@GertjanBisschop
Copy link
Member Author

C level:

  • I have currently mainly added assert statements to existing tests.
  • As mentioned by @jeromekelleher, num_children can be used to query the number of roots. I have not yet touched/simplified any of this code.

Python level:
There is currently no other code testing the QuintuplyLinkedTree class, so I was a bit unsure as to how to proceed with that before tackling the actual lowlevel/highlevel tests. I have added only a simple test.

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!

The num_roots stuff should be easy now, it's just tree.num_children[tree.virtual_root]

c/tskit/trees.c Outdated
parent[c] = TSK_NULL;
left_sib[c] = TSK_NULL;
right_sib[c] = TSK_NULL;
self->num_children[p]--;
Copy link
Member

Choose a reason for hiding this comment

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

We should follow the same pattern above and declare a local restrict pointer for num_children. This is to help the compiler optimise the code, avoiding some pointer chasing. (Probably doesn't make much difference in practice, but no point in not doing it here.)

Similarly below.

ret = tsk_tree_first(&t);
CU_ASSERT_EQUAL(t.num_children[2], 1);
CU_ASSERT_EQUAL(t.num_children[4], 2);
CU_ASSERT_EQUAL(t.num_children[5], tsk_tree_get_num_roots(&t));
Copy link
Member

Choose a reason for hiding this comment

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

This will be a circular test once it's implemented - better to put the actual value in here. Likewise below.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yep. Will change that. Thanks for the comments. Will address them and the Lint error.

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 % JK comments

@jeromekelleher
Copy link
Member

Looks like this much is basically ready to merge. How should we stage the rest of the update @benjeffery? I guess we could hold this off until after 0.5.0 to try and get it shipped and then do the Python updates then? Or should we just push on with the changes now?

@benjeffery
Copy link
Member

The python side of this should be relatively straightforward right? I'm keen to get 0.5.0 out ASAP, but this is a really nice addition to the release. I think we include this and the edge-diffs then draw a hard line under the release.

@jeromekelleher
Copy link
Member

Okey dokey - would you mind creating the follow up issues we'd need after this for Python so?

@GertjanBisschop
Copy link
Member Author

Cool. I should be able to finish the follow up by the end of the week.
Shall I squash both commits?

@jeromekelleher
Copy link
Member

Yep, squash and rebase would be good.

@benjeffery
Copy link
Member

Okey dokey - would you mind creating the follow up issues we'd need after this for Python so?

Done

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!

@benjeffery benjeffery force-pushed the add_num_children_c branch from a504674 to e8db04a Compare June 8, 2022 11:07
@benjeffery
Copy link
Member

I've added a changelog. Will merge.

@jeromekelleher
Copy link
Member

Looks like you missed updating tsk_tree_free @GertjanBisschop - this is essential! (Valgrind spotted it though, good ole valgrind)

@GertjanBisschop
Copy link
Member Author

I did indeed. Will fix it. Thank you valgrind.

@benjeffery
Copy link
Member

@jeromekelleher Did you mean to merge this? Github says you removed the merge label.

@jeromekelleher
Copy link
Member

I was trying to get mergify to merge - I thought "turning it off and on again" might trigger things.

@benjeffery
Copy link
Member

@Mergifyio refresh

@mergify
Copy link
Contributor

mergify bot commented Jun 9, 2022

refresh

✅ Pull request refreshed

@benjeffery
Copy link
Member

Circle CI is missing! Will try re triggering.

@benjeffery
Copy link
Member

@Mergifyio rebase

@mergify
Copy link
Contributor

mergify bot commented Jun 9, 2022

rebase

✅ Branch has been successfully rebased

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.

3 participants