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

fix: don't count mutations at masked sites towards branch length #1779

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

rneher
Copy link
Member

@rneher rneher commented Mar 21, 2025

augur refine has the mode --divergence-units mutations in which case branch length are given as number of mutations in an ancestral reconstruction. We ignore gaps and ambiguous sites in this calculation as we should, but in the edge case when there is no information at all (site is N everywhere), we count a large number of spurious mutations. This happens when the root state is picked by from the probability distribution at random, and other states are set to the most likely state. @corneliusroemer discovered this in the case of mpox where about 10k sites are masked. The probability distribution for these 10k states in [0.2, 0.2, 0.2, 0.2, 0.2]. The root was picked at random, other states via np.argmax([0.2, 0.2, 0.2, 0.2, 0.2]). If these differed, this generated 10k unwanted mutations.

This PR excludes those sites from the branch length calculation. A list of all these sites is anyway available within treetime.

Copy link

codecov bot commented Mar 21, 2025

Codecov Report

Attention: Patch coverage is 57.14286% with 3 lines in your changes missing coverage. Please review.

Project coverage is 73.19%. Comparing base (bbadca3) to head (9e9d98a).

Files with missing lines Patch % Lines
augur/refine.py 57.14% 2 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1779      +/-   ##
==========================================
- Coverage   73.21%   73.19%   -0.02%     
==========================================
  Files          79       79              
  Lines        8395     8402       +7     
  Branches     1713     1715       +2     
==========================================
+ Hits         6146     6150       +4     
- Misses       1960     1962       +2     
- Partials      289      290       +1     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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