Repository navigation
Conversation
…g pi on multiallelic ones A multiallelic (3+-allele) site is now dropped from FrequencySpectrum, with a BiallelicOnlyWarning giving the count, the same way patterson_d and the GenotypeMatrix loaders already handle multiallelic sites, rather than being folded into the spectrum and approximated. On the sites it keeps -- including a reference-absent two-allele site, where allele 0 itself does not appear in the sample -- every estimator now matches the scalar functions exactly; pi and watterson used to double-count such a site's two present alleles as if both were derived relative to a reference that was not there. Docs are edited to make the restriction clear.
… count Both used sfs_by_n, the uncollapsed per-allele histogram, which counts a reference-absent two-allele site twice (once per nonzero allele column). suggest_projection_n divided that inflated cumulative by n_segregating, which is collapsed-based, so it could reach retain_fraction too early and suggest a target_n that drops more real data than asked for. project()'s dropped count (used only in its warning message) had the same mismatch against its own collapsed-based n_segregating. Both now read _sfs_by_n_collapsed.
nspope
force-pushed
the
fix/372-fs-reference-absent-biallelic-2
branch
from
November 20, 2026 18:30
c329139 to
7aefefb
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #372
A multiallelic (3+ extant allele) site is now dropped from
FrequencySpectrum, with aBiallelicOnlyWarninggiving the count, the same waypatterson_dand theGenotypeMatrixloaders already handle multiallelic sites, rather than being folded into the spectrum and approximated. On the sites it keeps -- including a reference-absent two-allele site, where allele 0 itself does not appear in the sample -- every estimator now matches the scalar functions exactly;piandwattersonused to double-count such a site's two present alleles as if both were derived relative to a reference that was not there.The rationale is that Achaz's variance framework, for which
FrequencySpectrumis the vehicle, assumes infinite sites and thus biallelic data. Docs are edited to make the restriction clear.