Mixlen refactoring: Make GHOST compatible with PMSF#174
Merged
Conversation
…lihoodDerv(Generic)SIMD()
Contributor
Author
|
@bqminh, |
Member
|
I'm reviewing this now ... it's touching the kernel, so need be to thorough |
bqminh
approved these changes
Jun 19, 2026
bqminh
left a comment
Member
There was a problem hiding this comment.
looks great. thanks. Suggestion: for future pull requests, better separate into smaller PRs, instead of combining many into one.
Member
|
It's now released in v3.1.3 |
Contributor
Author
@bqminh, thank you! |
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.
This pull request implements the GHOST rate heterogeneity model for the PMSF model, a long-awaited feature requested several times before: iqtree/iqtree2#391 (comment) and iqtree/iqtree2#459.
Implementation details:
PhyloTreeMixlen::computeFuncDerv()function by switching the condition for using the base class-version function fromif (cur_mixture < 0)toif (initializing_mixlen)and by asserting thatcur_mixtureis set. The rationale is that the base class-version function should be called only when the heterotachy model is not used yet, i.e. wheninitializing_mixlenis true. Otherwise, it would, in turn, callPhyloTree::computeLikelihoodDerv(Generic)SIMD()that would run in the mixlen mode, thus returning partial derivatives instead of the single ordinary derivative. Also, the unused code duplicating the one fromphylokernelnew.his now removed from this function.PhyloTree::computeLikelihoodDerv(Generic)SIMD()function, in theif (isMixlen())branch, duplicate theif (SITE_MODEL)block of theelsebranch with the only difference that the length is considered category-specific here. Make the two code branches more similar.->lengthto->getLength(c)throughout thephylokernelnew.hcode, most importantly in theif (SITE_MODEL)blocks, to ensure that all computations are compatible with the mixlen mode.A simple test to check the new likelihood calculations:
Run cmd1:
iqtree3 --seed 123 -nt 1 -s aln.faa -m LG+F+H2 -optlen BFGS --keep-ident -pre test_LG_F_Hand cmd2:
iqtree3 --seed 123 -nt 1 -s aln.faa -m LG+H2 -fs empty.sitefreq -optlen BFGS --keep-ident -pre test_LG_SSF_H,where
empty.sitefreqis literally an empty text file:This two runs should have exactly the same likelihood, tree, and parameter estimates, since
-fs empty.sitefreqactivates a+SSFmodel that uses the+Fstate probability vector for each alignment pattern, which simulates the simpler+Fmodel yet using site-specific computations.