Skip to content

Conversation

@benjeffery
Copy link
Member

Fixes #3311
As this method doesn't mutate tables - shouldn't it be on TreeSequence and ImmutableTC?

@codecov
Copy link

codecov bot commented Nov 4, 2025

Codecov Report

❌ Patch coverage is 50.94340% with 26 lines in your changes missing coverage. Please review.
✅ Project coverage is 89.73%. Comparing base (1acc108) to head (74191c0).

Files with missing lines Patch % Lines
python/_tskitmodule.c 36.58% 25 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3312      +/-   ##
==========================================
- Coverage   89.80%   89.73%   -0.07%     
==========================================
  Files          29       29              
  Lines       31026    31079      +53     
  Branches     5679     5686       +7     
==========================================
+ Hits        27863    27890      +27     
- Misses       1777     1802      +25     
- Partials     1386     1387       +1     
Flag Coverage Δ
c-tests 86.85% <ø> (ø)
lwt-tests 80.38% <ø> (ø)
python-c-tests 86.68% <36.58%> (-0.38%) ⬇️
python-tests 98.84% <100.00%> (+<0.01%) ⬆️
python-tests-no-jit 33.59% <25.00%> (-0.02%) ⬇️
python-tests-numpy1 50.14% <25.00%> (-0.04%) ⬇️

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

Files with missing lines Coverage Δ
python/tskit/tables.py 99.77% <100.00%> (+<0.01%) ⬆️
python/tskit/trees.py 98.88% <100.00%> (+<0.01%) ⬆️
python/_tskitmodule.c 86.68% <36.58%> (-0.38%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@petrelharp
Copy link
Contributor

I think the motivation for not making this a TS method earlier was that the API seemed not totally mature. But maybe that ship has sailed.


def map_ancestors(self, *args, **kwargs):
"""
Deprecated alias for :meth:`link_ancestors`.
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe this is our opportunity to remove map_ancestors?

Copy link
Contributor

Choose a reason for hiding this comment

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

although that would doubtless break someone's code somewhere...

Copy link
Member

Choose a reason for hiding this comment

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

Let's not bother - it's not doing any harm and no point in breaking code if we don't have to

Copy link
Contributor

@petrelharp petrelharp left a comment

Choose a reason for hiding this comment

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

LGTM!

@petrelharp
Copy link
Contributor

I meant "looks good except the code coverage"

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. I think we need some test coverage, including some basic tests that just check that it runs and gives a meaningful result on a simple tree sequence (or over the example tree sequences).

Also need test coverage on the low-level meth obvs

assert ancestor_table == lib_result
ts_result = ts.link_ancestors(samples, ancestors)
assert ancestor_table == ts_result
if _tskit.HAS_NUMPY_2:
Copy link
Member

Choose a reason for hiding this comment

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

I don't think the HAS_NUMPY_2 thing is needed, should work either way right?


def map_ancestors(self, *args, **kwargs):
"""
Deprecated alias for :meth:`link_ancestors`.
Copy link
Member

Choose a reason for hiding this comment

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

Let's not bother - it's not doing any harm and no point in breaking code if we don't have to

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.

link_ancestors probably should work on immutable tables, but does not?

3 participants