Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] No valid initial state w/ backbone constraints for nonclock trees unless initial tree is specified #384

Open
davidcerny opened this issue Oct 3, 2023 · 1 comment

Comments

@davidcerny
Copy link
Contributor

Describe the bug
When using the dnConstrainedTopology distribution with nonclock trees (i.e., when the treeDistribution argument if of type Distribution__BranchLengthTree), a backbone constraint can only be employed when an initial tree is specified as well. If the initialTree argument is omitted, passing a constraint tree to the backbone argument will cause a segfault. For clock trees (i.e., when treeDistribution is of type Distribution__TimeTree), this doesn't happen – the analysis might fail to find a suitable initial state, but there will be no segfault.

I tried to investigate further using the backtrace functionality in GDB, but unfortunately, I'm not able to parse the output beyond seeing that the problem has to do with TopologyNode:

Thread 2 received signal SIGSEGV, Segmentation fault.
0x000000010436c9bc in std::__1::__tree<RevBayesCore::TopologyNode const*, std::__1::less<RevBayesCore::TopologyNode const*>, std::__1::allocator<RevBayesCore::TopologyNode const*> >::size (this=0x70) at /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk/usr/include/c++/v1/__tree:1071
1071	    const size_type& size() const _NOEXCEPT {return __pair3_.first();}
(gdb) backtrace
#0  0x000000010436c9bc in std::__1::__tree<RevBayesCore::TopologyNode const*, std::__1::less<RevBayesCore::TopologyNode const*>, std::__1::allocator<RevBayesCore::TopologyNode const*> >::size (this=0x70) at /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk/usr/include/c++/v1/__tree:1071
#1  0x00007ff7bfef8940 in ?? ()
#2  0x000000010436e0f9 in std::__1::__compressed_pair<std::__1::__tree_node<std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, RevBayesCore::TopologyNode*>, void*>*, std::__1::__tree_node_destructor<std::__1::allocator<std::__1::__tree_node<std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, RevBayesCore::TopologyNode*>, void*> > > >::__compressed_pair<std::__1::__tree_node<std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, RevBayesCore::TopologyNode*>, void*>*&, std::__1::__tree_node_destructor<std::__1::allocator<std::__1::__tree_node<std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, RevBayesCore::TopologyNode*>, void*> > > > (this=0x70, __t1=@0x104fe7e70: 0x7ff84a646448, __t2=...)
    at /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk/usr/include/c++/v1/__memory/compressed_pair.h:136
#3  0x0000000100005570 in ?? () at /usr/local/include/boost/program_options/options_description.hpp:191
#4  0x0000000000000000 in ?? ()

To Reproduce
This zipped directory contains (1) an example dataset, (2) a single backbone tree (which can be read in either as a nonclock tree or as a clock tree), (3) initial trees for both nonclock and clock analyses, and (4) Rev scripts for both nonclock and clock analyses. One absolute path has to be changed in the scripts.

Expected behavior
It should be possibly to apply a backbone constraint to a nonclock analysis with or without also specifying an initial tree. Failure to supply an initial tree might prevent RevBayes from finding a suitable initial state on its own, but it should not cause a segfault.

Computer info
macOS 12.6.9, RevBayes 1.2.2, latest version of the development branch (rapture-2254-g0b59a0).

@davidcerny
Copy link
Contributor Author

Hmm, so the segfault no longer happens on development, which is good. However, without a starting tree, the nonclock analysis won't find a viable initial state (all likelihoods are either -inf or nan) if the backbone tree has more than 4 tips, which is still a pretty substantial problem.

@bjoelle bjoelle changed the title [BUG] Segfault w/ backbone constraints for nonclock trees unless initial tree is specified [BUG] No valid initial state w/ backbone constraints for nonclock trees unless initial tree is specified Apr 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant