census node per lineage, not segment: closes #2540 - #2541
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #2541 +/- ##
=======================================
Coverage 93.81% 93.81%
=======================================
Files 20 20
Lines 12216 12216
Branches 2250 2250
=======================================
Hits 11461 11461
Misses 574 574
Partials 181 181
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
|
Verification that (after fixing it) the new test catches the bug without this fix: |
|
What does this affect? So I think it definitely is a bug, in that we're calling things different nodes that aren't really; but this only affects census nodes: it's not going to change anything about the subsequent simulation. So, it's a pretty minor bug. It'd only affect people who wanted to see how many distinct ancestors there were at a given time using a census event I got curious: how big of an effect is this? Here's a jupyter notebook: |
|
(Note: one might naively hope that adding census nodes literally does not change the output of the simulation, seed-by-seed, except for the census nodes, but this turns out not to be true; I'm not actually sure why.) |

I think this was a conceptual error: all segments in a given lineage at a given time point in the simulation are in the same genome (=node=haplosome), and hence in doing a census event we should assign a single node to each lineage, not each segment.
If we agree, this needs an update to the CHANGELOG (and maybe another test? I'm not sure if we've a good way to test this).
Also note the test that triggers #2540 (but this - I think - fixes).