iqtree / iqtree2

NEW location of IQ-TREE software for efficient phylogenomic software by maximum likelihood http://www.iqtree.org
GNU General Public License v2.0
229 stars 55 forks source link

Crash due to assertion failure in `PhyloSuperTreePlen::computeFuncDerv` #270

Open davidcerny opened 1 month ago

davidcerny commented 1 month ago

Bug description

I'm trying to run a partitioned analysis of morphological data (with separate partitions for binary, unordered multistate, and ordered multistate characters, and with proportional branch lengths) as follows:

~/iqtree-2.3.5-macOS/bin/iqtree2 -p partitions.nex -B 1000 --runs 100 -T AUTO -safe --prefix unconstrained

Some of the runs will be completed just fine, but sooner or later the analysis will crash with the following error message, which seems to be getting triggered by a negative branch length appearing in the tree:

WARNING: Too high (saturated) partition rates for proportional partition model!
lambda = -0.146
NEGATIVE BRANCH len = -0.012
 rate = 1.000
ERROR: phylosupertreeplen.cpp:397: virtual void PhyloSuperTreePlen::computeFuncDerv(double, double &, double &): Assertion `0' failed.
ERROR: STACK TRACE FOR DEBUGGING:
ERROR: 2   _sigtramp()
ERROR: 6   PhyloSuperTreePlen::computeFuncDerv(double, double&, double&)
ERROR: 7   Optimization::minimizeNewton(double, double, double, double, double&, int)
ERROR: 8   PhyloTree::optimizeOneBranch(PhyloNode*, PhyloNode*, bool, int)
ERROR: 9   PhyloSuperTreePlen::optimizeOneBranch(PhyloNode*, PhyloNode*, bool, int)
ERROR: 10   PhyloTree::optimizeAllBranches(int, double, int)
ERROR: 11   PartitionModelPlen::optimizeParameters(int, bool, double, double)
ERROR: 12   IQTree::optimizeModelParameters(bool, double)
ERROR: 13   IQTree::ensureModelParametersAreSet(double)
ERROR: 14   runTreeReconstruction(Params&, IQTree*&)
ERROR: 15   runMultipleTreeReconstruction(Params&, Alignment*, IQTree*)
ERROR: 16   runPhyloAnalysis(Params&, Checkpoint*, IQTree*&, Alignment*&)
ERROR: 17   runPhyloAnalysis(Params&, Checkpoint*)
ERROR: 
ERROR: *** IQ-TREE CRASHES WITH SIGNAL ABORTED
ERROR: *** For bug report please send to developers:
ERROR: ***    Log file: unconstrained.log
ERROR: ***    Alignment files (if possible)
zsh: abort

To reproduce

The alignment files, partition file, and log file are all available from this zipped directory.

Expected behavior

No negative branch lengths, and no crash.

Computer info

macOS 14.5 (Sonoma), ARM64 architecture, IQ-TREE v2.3.5 (latest stable release).

thomaskf commented 1 month ago

Thanks, David.

I will look at the issue the coming week.

Thanks, Thomas

From: David Černý @.> Date: Sunday, 14 July 2024 at 3:18 AM To: iqtree/iqtree2 @.> Cc: Thomas Wong @.>, Mention @.> Subject: Re: [iqtree/iqtree2] Crash due to assertion failure in PhyloSuperTreePlen::computeFuncDerv (Issue #270)

Hmm, so to the best of my understanding, the branch length becomes negative because lambda is negative:

nei1_part->length += lambda*part_info[part].part_rate;

and lambda ultimately comes from BioNJ (it's a distance scaling factor used in a variance reduction formula; see Gascuel 1997). So this problem can be circumvented by not using BioNJ in the starting tree mix (I've tried -t PARS, and it runs fine). Still, though, according to Gascuel lambda should never be outside [0, 1], so this does look like a real problem, though not necessarily one with IQ-TREE. Let me know if you'd like me to close this issue or keep it open, @bqminhhttps://github.com/bqminh @thomaskfhttps://github.com/thomaskf.

— Reply to this email directly, view it on GitHubhttps://github.com/iqtree/iqtree2/issues/270#issuecomment-2227000729, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AENQCRTNO2I6QGOHPZT3YSLZMFONJAVCNFSM6AAAAABKRTXES6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMRXGAYDANZSHE. You are receiving this because you were mentioned.Message ID: @.***>

davidcerny commented 1 month ago

Thank you @thomaskf! Just to clarify, I have deleted my previous comment because it was incorrect. Removing the BioNJ tree from the starting tree mix with -t PARS is not sufficient to get rid of the issue. Then again, IQ-TREE printed out a .bionj file for me anyway, so I'm not quite sure what happened there.

davidcerny commented 1 month ago

So the issue is architecture-specific: I ran into it when I downloaded the precompiled macOS executable for ARM from here, but now that I've compiled IQ-TREE from source for x86_64 (i.e., under emulation), it's no longer occurring.