MomentsLD / moments

MIT License
10 stars 3 forks source link

Mutation rate handling in Demes-SFS #154

Closed apragsdale closed 7 months ago

apragsdale commented 7 months ago

This adds some functionality for specifying mutation rates in the Demes-SFS methods, as brought up in #153.

The function to compute the SFS from a demes-formatted graph is moments.Demes.SFS(g, samples, ...). The Spectrum class function moments.Spectrum.from_demes(g, samples, ...) acts as a wrapper for this function. This PR changes moments.Spectrum.from_demes(...) to take theta as a keyword argument, and it defaults to 1.

More functionality is provided in Demes.SFS(). Now the function moments.Demes.SFS(...) can take theta (the pop-size scaled mutation rate) or u (the "raw" mutation rate), but it can't take both. If u is provided, then theta is determined by finding the ancestral Ne in the root deme. If neither theta nor u are provided, then Ne is again determined by the root deme's initial size, and the SFS is scaled by 4*Ne, so that multiplying after calculating by u (or uL) results in a properly scaled SFS.

apragsdale commented 7 months ago

I'll merge this, and there are some follow-up issues/PRs to get to, and then release moments-1.2.0

Closes #153