Commit bce885c
Fix --scfl gap detection for models with rate heterogeneity
The gap detection filter in computeSubtreeAncestralState() used a
fixed threshold (sum > 1.0) that broke for models with multiple rate
categories (ncat_mix > 1) and for deep subtrees with scaled partial
likelihoods. This caused --scfl to incorrectly filter nearly all
sites as gaps, producing wrong sCF values for any model using +G, +R,
+I+G, +I+R, or mixture models.
The fix uses scale_num to distinguish real data from gaps at internal
nodes: scaled sites (scale_num > 0) are always real data, while
all-gap subtrees are detected by sum > ncat_mix with no scaling.
Leaf nodes retain the original threshold. Both normal and
SAFE_NUMERIC scale_num layouts are handled.
Fixes #137
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>1 parent 26b610e commit bce885c
1 file changed
Lines changed: 23 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
421 | 421 | | |
422 | 422 | | |
423 | 423 | | |
424 | | - | |
425 | | - | |
426 | | - | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
427 | 447 | | |
428 | 448 | | |
429 | 449 | | |
| |||
0 commit comments