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

Prior calculation performance for 1000+ mutations #71

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

dlivitz
Copy link

@dlivitz dlivitz commented May 2, 2024

Had some issues with this for large samples, but since we first wrote the software there's been a new approximation for logstirling coefficients developed:

Swaine L Chen, Nico M Temme, A Faster and More Accurate Algorithm for Calculating Population Genetics Statistics Requiring Sums of Stirling Numbers of the First Kind, G3 Genes|Genomes|Genetics, Volume 10, Issue 11, 1 November 2020, Pages 3959–3967, https://doi.org/10.1534/g3.120.401575

I have adapted this to the prior calculation, and fixed the docker build file to test.

For ~1000 mutations, takes the prior calculation from nearly a minute to almost instant, with minor error:

Old: {'a': 1.2355127299648985, 'b': 3.285775232976865, 'KL_divergence': 1.0388836127098066e-05}
New: {'a': 1.2360983922422462, 'b': 3.2871978856161417, 'KL_divergence': 1.0392287138662582e-05}

For 10,000 mutations, the old calculation took 20 minutes, and now it takes seconds.

Old: {'a': 1.2716390989170585,  'b': 4.230418159369041, 'KL_divergence': 1.3294329165569607e-05}
New: {'a': 1.2718892362810572, 'b': 4.230767762902994, 'KL_divergence': 1.329728110259154e-05}

There is no difference in clustering results between the versions.

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.

1 participant