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
@@ -309,6 +309,13 @@ pub struct PhyloArgs {
|
||||
#[arg(long)]
|
||||
pub no_ambiguity: bool,
|
||||
|
||||
/// In `--pseudo-alignment`, keep only the genomes carrying one or two
|
||||
/// members of a family (a base, or a two-base IUPAC code) and treat the
|
||||
/// others (three or four members) as missing data (`?`). Milder than
|
||||
/// `--no-ambiguity`, which it excludes.
|
||||
#[arg(long, conflicts_with = "no_ambiguity")]
|
||||
pub only_diploid: bool,
|
||||
|
||||
/// In `--pseudo-alignment`/`--sankoff`/`snp-*` `--distance`, keep only
|
||||
/// the families that can separate two pairs of genomes from each other
|
||||
/// (a bipartition): at least two distinct called states, each carried
|
||||
|
||||
@@ -254,6 +254,7 @@ pub fn run(args: PhyloArgs) {
|
||||
let sampling = SamplingSpec {
|
||||
free_loss: args.free_loss,
|
||||
no_ambiguity: args.no_ambiguity,
|
||||
only_diploid: args.only_diploid,
|
||||
quartet: args.quartet,
|
||||
pair_balance: args.pair_balance,
|
||||
entropy_bias,
|
||||
|
||||
Reference in new issue
Block a user