You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix: genetic_relatedness to allow single sample set with self-comparisons
Previously, genetic_relatedness would fail with TSK_ERR_INSUFFICIENT_SAMPLE_SETS
when given a single sample set and indexes referring to that set, e.g.:
ts.genetic_relatedness([[0]], indexes=[(0,0)])
This was because the C API requires at least k=2 sample sets for k-way statistics,
even when indexes only reference a single set for self-comparison.
The fix adds an allow_self_comparisons parameter to __k_way_sample_set_stat,
which is set to True only for genetic_relatedness. When enabled and indexes
only reference existing sample sets, dummy sample sets are added to satisfy
the C API requirement while ensuring they are never accessed during computation.
Tests added for all three modes (site, branch, node) to verify self-comparisons
work correctly with single sample sets.
Fixes#3055
0 commit comments