Skip to content
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

Multiple merger polyploid scaling #2310

Merged

Conversation

jeromekelleher
Copy link
Member

Duplicate of #2309 from @JereKoskela , copying comment here for the record.

Adding tests for polyploid scaling for multiple merger coalescents turned out to be easy, but also sent me down a bit of a rabbit hole. Summary of changes:

  • The extra spaces on various lines in msprime.c which are unrelated to anything I've done (1396, 1899...) were put in by clang. Let me know if you want me to do something about them.
  • For the Dirac coalescent, population growth at rate g should yield a coalescent growth rate of 2g,essentially because the coalescence probability in the Moran model is 1/N^2 rather than 1/N. We had overlooked that, but it is now fixed.
  • Ploidy wasn't being handled quite right in the Dirac coalescent either, but is now fixed. In the process, I got rid of some if (ploidy == 1) {...} else {...} statements which became redundant.
  • For both the Dirac and Beta coalescents, I moved the allocation of the ancestor buckets Q later into the rejection sampler. It is now only done once a multiple merger event is definitely taking place.
  • The Dirac coalescent test in test_ancestry.py started failing after the ploidy fix because the rate of multiple mergers wasn't high enough to guarantee one anymore. I increased it.
  • I also noticed we were disallowing psi = 1 in the Dirac coalescent for no reason. The documented (and sensible) range is 0 < psi <= 1. I tweaked the boundary values and associated tests to make the code consistent with the documentation.

@jeromekelleher
Copy link
Member Author

The extra spaces on various lines in msprime.c which are unrelated to anything I've done (1396, 1899...) were put in by clang. Let me know if you want me to do something about them.

I intended to fix this by running with Clang format version 6 (clang-format is tiresome with version compatibility), and push an updated commit to #2309. But, I made a mess of it, and now can't seem to push to your remote. So, I just made a new PR here with the same commit. You're still the author of the commit @JereKoskela, so it doesn't make any real difference.

@jeromekelleher
Copy link
Member Author

Changes look great, thanks @JereKoskela. I'll package it up in a bugfix release ASAP.

Copy link

codecov bot commented Aug 7, 2024

Codecov Report

Attention: Patch coverage is 83.67347% with 8 lines in your changes missing coverage. Please review.

Project coverage is 90.98%. Comparing base (7492287) to head (309ce94).

Files Patch % Lines
lib/msprime.c 82.97% 5 Missing and 3 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2310      +/-   ##
==========================================
- Coverage   90.99%   90.98%   -0.02%     
==========================================
  Files          20       20              
  Lines       12035    12021      -14     
  Branches     2441     2437       -4     
==========================================
- Hits        10951    10937      -14     
  Misses        599      599              
  Partials      485      485              
Flag Coverage Δ
C 90.98% <83.67%> (-0.02%) ⬇️
python 98.70% <ø> (ø)

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

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@jeromekelleher jeromekelleher merged commit f6627a9 into tskit-dev:main Aug 7, 2024
13 of 14 checks passed
@jeromekelleher jeromekelleher deleted the local-multiple-merger branch August 7, 2024 09:04
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.

2 participants