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

WIP: new more flexible underlying format to allow unrooted trees and better traversal #16

Merged
merged 94 commits into from
Jan 7, 2019

Conversation

richardreeve
Copy link
Member

@richardreeve richardreeve commented Dec 6, 2018

Most of the new interface is working now, but not the iterators yet, and there are definitely some problems with finding routes through the tree - Julia v0.6 hangs and v1.0.2 crashes inconsistently. Linked list issues arise from impossibility of forward references - JuliaLang/julia#269 was well aware of this in 2011 - and so branches (edges) can only hold abstract base classes of nodes (vertices), but nodes can hold branches directly. It's a bit of a fudge, but works for now until v1.x when forward references become a thing...

  • new data structure for branches and nodes is a linked list
  • more general API to allow nodes to directly access branches and vice-versa
  • Random tree generation - WIP
  • Get traversal working
  • Fix tests

More stuff I'm sure...

@richardreeve
Copy link
Member Author

Obviously this is intended to address a lot of what's going wrong in #14.

@richardreeve
Copy link
Member Author

This code works on v0.6.4 but segfaults on v1.0.2 on MacOS:

julia> using Phylo

julia> nu = Nonultrametric(1000);

julia> treen = rand(nu);

julia> n = getnode(treen, "Node 400");

julia> nh = nodehistory(treen, n);
Segmentation fault: 11
Internal error: encountered unexpected error in runtime:
StackOverflowError()
subtype_ccheck at /Users/osx/buildbot/slave/package_osx64/build/src/subtype.c:451
var_lt at /Users/osx/buildbot/slave/package_osx64/build/src/subtype.c:506
exists_subtype at /Users/osx/buildbot/slave/package_osx64/build/src/subtype.c:1079 [inlined]
forall_exists_subtype at /Users/osx/buildbot/slave/package_osx64/build/src/subtype.c:1107
subtype_ccheck at /Users/osx/buildbot/slave/package_osx64/build/src/subtype.c:461
var_lt at /Users/osx/buildbot/slave/package_osx64/build/src/subtype.c:506

... [3MB of repeats] ...

jl_type_infer at /Users/osx/buildbot/slave/package_osx64/build/src/gf.c:275
jl_compile_method_internal at /Users/osx/buildbot/slave/package_osx64/build/src/gf.c:1786
jl_fptr_trampoline at /Users/osx/buildbot/slave/package_osx64/build/src/gf.c:1830
bracketed_paste at /Users/osx/buildbot/slave/package_osx64/build/usr/share/julia/stdlib/v1.0/REPL/src/LineEdit.jl:1920
jl_fptr_trampoline at /Users/osx/buildbot/slave/package_osx64/build/src/gf.c:1831
#55 at /Users/osx/buildbot/slave/package_osx64/build/usr/share/julia/stdlib/v1.0/REPL/src/REPL.jl:901
jl_fptr_trampoline at /Users/osx/buildbot/slave/package_osx64/build/src/gf.c:1831
jl_apply at /Users/osx/buildbot/slave/package_osx64/build/src/./julia.h:1537 [inlined]
jl_f__apply at /Users/osx/buildbot/slave/package_osx64/build/src/builtins.c:556
jl_f__apply_latest at /Users/osx/buildbot/slave/package_osx64/build/src/builtins.c:594
#invokelatest#1 at ./essentials.jl:697 [inlined]
invokelatest at ./essentials.jl:696 [inlined]
#27 at /Users/osx/buildbot/slave/package_osx64/build/usr/share/julia/stdlib/v1.0/REPL/src/LineEdit.jl:1319
prompt! at /Users/osx/buildbot/slave/package_osx64/build/usr/share/julia/stdlib/v1.0/REPL/src/LineEdit.jl:2360
run_interface at /Users/osx/buildbot/slave/package_osx64/build/usr/share/julia/stdlib/v1.0/REPL/src/LineEdit.jl:2263
run_frontend at /Users/osx/buildbot/slave/package_osx64/build/usr/share/julia/stdlib/v1.0/REPL/src/REPL.jl:1034
run_repl at /Users/osx/buildbot/slave/package_osx64/build/usr/share/julia/stdlib/v1.0/REPL/src/REPL.jl:191
#719 at ./logging.jl:309
jfptr_#719_5936.clone_1 at /Users/richardr/Applications/Julia-1.0.app/Contents/Resources/julia/lib/julia/sys.dylib (unknown line)
jl_apply at /Users/osx/buildbot/slave/package_osx64/build/src/./julia.h:1537 [inlined]
jl_f__apply at /Users/osx/buildbot/slave/package_osx64/build/src/builtins.c:556
jl_f__apply_latest at /Users/osx/buildbot/slave/package_osx64/build/src/builtins.c:594
#invokelatest#1 at ./essentials.jl:697 [inlined]
invokelatest at ./essentials.jl:696 [inlined]
macro expansion at ./logging.jl:306 [inlined]
run_main_repl at ./client.jl:334
exec_options at ./client.jl:246
_start at ./client.jl:425
true_main at /Users/richardr/bin/julia-1.0 (unknown line)
main at /Users/richardr/bin/julia-1.0 (unknown line)

now that I check with that. It seems to do it non-deterministically, and I wonder whether it's the garbage collector getting tied up in the recursive data structures, but I have no reason for saying that beyond the fact that it's crashing at different times on different runs...

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

Successfully merging this pull request may close these issues.

2 participants