Mixlen refactoring: Make GHOST compatible with PMSF#174
Conversation
…lihoodDerv(Generic)SIMD()
|
@bqminh, |
|
I'm reviewing this now ... it's touching the kernel, so need be to thorough |
bqminh
left a comment
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.
|
It's now released in v3.1.3 |
@bqminh, thank you! |
|
Hi @bqminh, The v3.1.3 precompiled binaries exactly reproduce the behaviour of the v3.1.2 binaries when run with the PMSF+GHOST model: print out the wrong initial likelihood and immediately crash (thanks to @kr3118 for pointing this out to me). Could you recompile and update the binaries if it is possible? Thanks! Best, |
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.