-
Notifications
You must be signed in to change notification settings - Fork 86
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add option to simulate "above" local roots #2157
Comments
What should we call it? |
stop_at_MRCA ? |
Perhaps simulate_above_MRCA would be less ambiguous. Would need to make sure to catch people giving no termination criterion, though. |
How about But, perhaps we need to think about local and global stopping conditions explicitly? |
stop_at_local_mrca is quite clear. |
OK, sounds good to me. Let's call it |
min_overlap = 2
if not self.stop_at_local_mrca:
min_overlap = 0
# Update the number of extant segments.
if self.S[left] == min_overlap:
self.S[left] = 0
right = self.S.succ_key(left)
else:
right = left
while right < r_max and self.S[right] != min_overlap:
self.S[right] -= 1
right = self.S.succ_key(right)
alpha = self.alloc_segment(
left=left,
right=right,
node=u,
population=population_index,
label=label,
) @GertjanBisschop and I had a look at this, and we think something like this snippet in the core Actually ,maybe this is more generally useful. What if we define a parameter I'm not sure how useful the last idea is, but worth thinking about? |
For reference, the current code looks like this: if self.S[left] == 2:
self.S[left] = 0
right = self.S.succ_key(left)
else:
right = left
while right < r_max and self.S[right] != 2:
self.S[right] -= 1
right = self.S.succ_key(right)
alpha = self.alloc_segment(
left=left,
right=right,
node=u,
population=population_index,
label=label,
) |
A natural addition to being able to keep a record of all genomes that we simulate through (i.e. keeping unary #2128 ) is to keep a record of the nodes that we go through after a local root has been reached.
This is simple enough to do, we just stop snipping out sections of the ancestry that have fully coalesced and change the stopping condition of the simulation.
cc @sgravel
The text was updated successfully, but these errors were encountered: