You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I use Phylo.jl to generate trees under various custom stochastic branching processes forward in time where the "root lineage" and its length is just as valid as any other internal branch.
Take the simplest tree with all branches of length 1
tree = RootedTree()
root, n1 = createnode!(tree), createnode!(tree)
createbranch!(tree, root, n1, 1.0)
lv1, lv2 = createnode!(tree), createnode!(tree)
createbranch!(tree, n1, lv1, 1.0)
createbranch!(tree, n1, lv2, 1.0)
julia> tree
RootedTree with 2 tips and 1 root. Leaf names are Node 3 and Node 4
4 nodes: [RecursiveNode{OneRoot} 'Node 1', a root node with 1 outbound connection (branch 1), RecursiveNode{OneRoot} 'Node 2', an internal node with 1 inbound and 2 outbound connections (branches 1 and [2, 3]), RecursiveNode{OneRoot} 'Node 3', a leaf with an incoming connection (branch 2) and RecursiveNode{OneRoot} 'Node 4', a leaf with an incoming connection (branch 3)]
3 branches: [RecursiveBranch{OneRoot} 1, from node 'Node 1' to node 'Node 2' (length 1.0), RecursiveBranch{OneRoot} 2, from node 'Node 2' to node 'Node 3' (length 1.0) and RecursiveBranch{OneRoot} 3, from node 'Node 2' to node 'Node 4' (length 1.0)]
Node records: "Node 1" => Dict{String, Any}() ... "Node 4" => Dict{String, Any}()
--<b1>--- lv1
/
root --<b0>-- n1
\
--<b2>--- lv2
After dropping lv2
droptips!(tree, lv2)
julia> tree
RootedTree with 1 tips and 1 root. Leaf names are Node 3
1 nodes: [RecursiveNode{OneRoot} 'Node 3', an isolated node with no connections]
0 branches: []
Node records: Dict{String, Dict{String, Any}}("Node 3" => Dict())
This makes sense when the root has no specific meaning, e.g. in reconstructed phylogenetic trees, but in the context of a "timetree" this is inconsitent. If there's a single remaining lineage (in this case lv1) then it should not be collapsed and simply be given the length b0.length + b1.length.
Would it be possible to add an option, something like droptips!(tree::AbstractTree{OneTree}, tips; preserveroot=true)?
The text was updated successfully, but these errors were encountered:
From a user:
I use Phylo.jl to generate trees under various custom stochastic branching processes forward in time where the "root lineage" and its length is just as valid as any other internal branch.
Take the simplest tree with all branches of length 1
After dropping
lv2
This makes sense when the root has no specific meaning, e.g. in reconstructed phylogenetic trees, but in the context of a "timetree" this is inconsitent. If there's a single remaining lineage (in this case
lv1
) then it should not be collapsed and simply be given the lengthb0.length + b1.length
.Would it be possible to add an option, something like
droptips!(tree::AbstractTree{OneTree}, tips; preserveroot=true)
?The text was updated successfully, but these errors were encountered: