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 mutation rate in time units example #344

Merged
merged 1 commit into from
Jun 10, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/time_units.md
Original file line number Diff line number Diff line change
Expand Up @@ -231,13 +231,13 @@ multiplied by the expected number of mutations per unit time.
(We get the mean branch length using the {meth}`ts.diversity <tskit.TreeSequence.diversity>` method with ``mode="branch"``;
see the [tskit documentation](tskit:sec_stats) for details.)
This involves the generation time because "mutations per unit time" is equal to
"mutations per generation" (here, the mutation rate per bp, {math}`10^{-8}`)
"mutations per generation" (here, the mutation rate per bp, {math}`2 \times 10^{-8}`)
divided by "time per generation" (i.e., mean generation time).


```{code-cell}
slim_diversity = gts.diversity(mode = 'site')
ts_diversity = gts.diversity(mode='branch') * 1e-8 / np.mean(gentimes)
ts_diversity = gts.diversity(mode='branch') * 2e-8 / np.mean(gentimes)

print(f"slim diversity: {slim_diversity}\n"
f"scaled tree sequence diversity: {ts_diversity}\n"
Expand Down
Loading