Repository navigation
Ibd result all pairs - #1660
Ibd result all pairs#1660
Conversation
8389775 to
0e40244
Compare
|
This is working pretty well: import resource
import tskit
import time
# ts = tskit.load("benchmark-n1M-m100M.trees")
ts = tskit.load("benchmark-n100k-m1M.trees")
print(ts)
before = time.perf_counter()
result = ts.find_ibd(max_time=100)
duration = time.perf_counter() - before
info = resource.getrusage(resource.RUSAGE_SELF)
# Result is in KiB
gb = info.ru_maxrss / (1024**2)
print(result)
print("time = ", duration)
print("mem = ", gb)Gives So, we 're finding the IBD segments for a tree sequence with 100K samples in 26 seconds and ~6G of RAM. There's a lot more work to be done, but I think we're definitely on the right track. There's 46 million pairs that are IBD by 100 generations ago. |
|
Here's the perf report: So - basically all the time is spent in the AVL tree (which is fine) |
5c27116 to
2e742a5
Compare
|
Awesome. This looks like a huge step up. Pair-lookup was also taking most of the time beforehand, so it's not surprising that the AVL tree is where most of the time is spent here. |
60b1a78 to
9b6b531
Compare
Codecov Report
@@ Coverage Diff @@
## main #1660 +/- ##
==========================================
+ Coverage 93.68% 93.79% +0.10%
==========================================
Files 27 27
Lines 23483 23578 +95
Branches 1084 1085 +1
==========================================
+ Hits 22000 22114 +114
+ Misses 1449 1429 -20
- Partials 34 35 +1
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
| tsk_ibd_result_t result; | ||
| double true_left[2][2] = { { 0.0, 0.7 }, { 0.7, 0.0 } }; | ||
| double true_right[2][2] = { { 0.7, 1.0 }, { 1.0, 0.7 } }; | ||
| double true_left[2][2] = { { 0.0, 0.75 }, { 0.75, 0.0 } }; |
There was a problem hiding this comment.
In case anyone is wondering, this is for 32 bit tests. 0.7 isn't a round number, and it's troublesome for comparing equality on some hardware.
a3dbf31 to
9adfce7
Compare
|
This is ready for review now I think. I've filed a bunch of issues to follow up on, so there's still stuff to be cleaned up. It'd be good to get this much in though. |
|
Just getting on to this now; hope to be done by tonight! |
| ret = tsk_ibd_result_get_items(result, pairs2, lists); | ||
| CU_ASSERT_EQUAL_FATAL(ret, 0); | ||
| for (j = 0; j < num_pairs; j++) { | ||
| CU_ASSERT_EQUAL_FATAL(pairs[2 * j], pairs2[2 * j]); | ||
| CU_ASSERT_EQUAL_FATAL(pairs[2 * j + 1], pairs2[2 * j + 1]); | ||
| verify_ibd_segment_list(lists[j], result->num_nodes); | ||
| total_segments += lists[j]->num_segments; | ||
| } | ||
| CU_ASSERT_EQUAL_FATAL(result->total_segments, total_segments); |
There was a problem hiding this comment.
I'm a bit unclear on what this is testing for. Is this some way of checking that there are only keys for pairs with non-empty sets of IBD segments or something?
There was a problem hiding this comment.
It's mainly check that the "keys" we return are correct. Just making sure that the two different ways we have of getting the same thing (they pairs) are the same.
|
|
||
| typedef struct { | ||
| tsk_size_t num_segments; | ||
| double total_span; |
There was a problem hiding this comment.
The sum of the right - left values in the segments. I figured this was a handy summary which would be useful when we optionally skip storing the segments.
gtsambos
left a comment
There was a problem hiding this comment.
Nice one @jeromekelleher --you've been so busy 🤯 👍 only really minor questions on this. I didn't comment in great detail on the AVL tree stuff as I only have a general idea of what they are needed for here.
Change the IBD result object to allow us find IBD among all pairs.
Stacked on #1659, #1655, #1637
Closes #1639