feat: add --only-diploid flag to filter for diploid genotypes only
Introduce a new `--only-diploid` option that restricts analysis to genomes with one or two family members (base or two-base IUPAC codes), treating others as missing data. This complements the existing `--no-ambiguity` behavior by providing a stricter filter for diploid-compatible sites, while ensuring conflict detection between the two flags. - Add `only_diploid` boolean argument to `PhyloArgs` in `src/obikmer/src/cmd/phylo/args.rs`, documenting its effect on pseudo-alignment and its conflict with `--no-ambiguity`. - Propagate `only_diploid` through `SamplingSpec` in `src/obikmer/src/cmd/phylo/mod.rs` and update the `run` function signature to accept the new argument. - Implement masking logic in `src/obikphylo/src/siblings/algorithms/masking.rs`: modify `masked_state` to accept `only_diploid`, add `only_diploid_keeps_up_to_two_members` helper, and update `genome_mask` documentation. - Update `sample_layer` in `src/obikphylo/src/siblings/algorithms/subsample.rs` to use `spec.only_diploid` for masking decisions and update `SamplingSpec` documentation. - Adjust `tally_2genomes` in `src/obikphylo/src/siblings/algorithms/snp_distance.rs` to pass the new `only_diploid` parameter to `masked_state`. - Update `DevDocMD/theory/evolutionary_distances.md` to describe the new `--only-diploid` option, the `masked_state` rule (`count_ones() > 2`), and clarify toy index behavior. - Update `UserDocMD/usage/phylo.md` to document `--only-diploid`, `--quartet`, and `--pair-balance` behaviors, clarifying that diploid choice is a convention and explaining how three/four-allele genomes are treated as missing.
This commit is contained in:
1 parent
b132f0847f
commit
b55123a376
7 files changed
+49
-7
No files matched your search
@@ -2920,7 +2920,17 @@ diploid, single base `X` -> `X/X`, two-base code -> `X/Y`, `-` -> `*/*`, and
|
||||
three/four-base codes or `?` -> `./.`. `REF` is the majority allele counting
|
||||
each copy once (so a het contributes 1+1, a homozygote 2). Counting copies
|
||||
for a real dosage (polyploids) would need k-mer counts (`--with-counts`),
|
||||
not used by the pseudo-alignment scan today. Toy index: default mode 187
|
||||
not used by the pseudo-alignment scan today. `--only-diploid` (selection option, `conflicts_with --no-ambiguity`) adds a
|
||||
third `masked_state` rule: `count_ones() > 2` -> missing. It lives in
|
||||
`SamplingSpec`/`masked_state`, i.e. the post-hoc masking and
|
||||
`survives_masking`, so FASTA, Sankoff and `snp-*` see it too. The persisted
|
||||
entropy/quartet/pair-weight/overlap annexes are keyed by the `no_ambiguity`
|
||||
bool (two variants on disk); a third variant was not added: they are read
|
||||
under `no_ambiguity = false`, which for the quartet pre-filter is a superset
|
||||
of what survives the stricter masking (reasoned, not tested) and for the
|
||||
entropy/pair-weight draw weights only changes the weighting. Unit-tested
|
||||
(`masked_state`); the toy index has no 3/4-member cells, so the end-to-end
|
||||
run is identical to the default mode. Toy index: default mode 187
|
||||
lines, no `ALT = .`; `--no-ambiguity` 93 lines (the sites whose polymorphism
|
||||
was only ambiguity codes disappear, since those cells became `?`).
|
||||
|
||||
|
||||
Reference in new issue
Block a user