Skip to contents

This function captures general tree information, including branching, node positions, and depths. It serves as a core function underlying all algorithms for slicing phylogenies.

Usage

nodes_config(tree)

Arguments

tree

phylo. An ultrametric phylogenetic tree in the "phylo" format.

Value

The function returns a phylogenetic tree in the "phylo" format containing three novel pieces of information (stored within "config", "node_matrix", and "tree_depth").

Details

This function captures node and edge information from an ultrametric phylogenetic tree. The function provides a data frame containing detailed branching information (within the internal "config" object), a node matrix (within "node_matrix"), and the tree age (within "tree_depth").

More specifically, the "config" object returns the following information: NodeBegin: the node at which a given branch begins. NodeEnd: the node at which a given branch ends. NodeLength: the branch length of that nodes interval. YearBegin: the year at which a given node begins. YearEnd: the year at which a given node ends.

See also

Phylogenetic slicing methods: squeeze_tips(),squeeze_root(),squeeze_int().

Author

Matheus Lima de Araujo matheusaraujolima@live.com

Examples

# Generate a random tree
tree <- ape::rcoal(20)

# Capture tree information
tree <- nodes_config(tree)

# Accessing these informations
tree$config # Nodes configurations
#>    NodeBegin NodeEnd  NodeLength YearBegin  YearEnd
#> 35        21      35 2.503496442  0.000000 2.503496
#> 1         35       1 0.060905527  2.503496 2.564402
#> 37        35      37 0.036147256  2.503496 2.539644
#> 2         37       2 0.024758271  2.539644 2.564402
#> 3         37       3 0.024758271  2.539644 2.564402
#> 22        21      22 1.838031229  0.000000 1.838031
#> 23        22      23 0.007406870  1.838031 1.845438
#> 25        23      25 0.296216525  1.845438 2.141655
#> 26        25      26 0.147841978  2.141655 2.289497
#> 4         26       4 0.274905367  2.289497 2.564402
#> 27        26      27 0.073927650  2.289497 2.363424
#> 5         27       5 0.200977717  2.363424 2.564402
#> 31        27      31 0.062010584  2.363424 2.425435
#> 39        31      39 0.137040149  2.425435 2.562475
#> 6         39       6 0.001926984  2.562475 2.564402
#> 7         39       7 0.001926984  2.562475 2.564402
#> 8         31       8 0.138967133  2.425435 2.564402
#> 29        25      29 0.272217236  2.141655 2.413872
#> 30        29      30 0.011234939  2.413872 2.425107
#> 9         30       9 0.139295170  2.425107 2.564402
#> 36        30      36 0.095165857  2.425107 2.520273
#> 10        36      10 0.044129313  2.520273 2.564402
#> 11        36      11 0.044129313  2.520273 2.564402
#> 12        29      12 0.150530109  2.413872 2.564402
#> 34        23      34 0.643689703  1.845438 2.489128
#> 13        34      13 0.075274167  2.489128 2.564402
#> 14        34      14 0.075274167  2.489128 2.564402
#> 24        22      24 0.015138193  1.838031 1.853169
#> 28        24      28 0.537365423  1.853169 2.390535
#> 15        28      15 0.173867124  2.390535 2.564402
#> 32        28      32 0.076823843  2.390535 2.467359
#> 16        32      16 0.097043281  2.467359 2.564402
#> 17        32      17 0.097043281  2.467359 2.564402
#> 33        24      33 0.632292435  1.853169 2.485462
#> 18        33      18 0.078940112  2.485462 2.564402
#> 38        33      38 0.058234518  2.485462 2.543696
#> 19        38      19 0.020705595  2.543696 2.564402
#> 20        38      20 0.020705595  2.543696 2.564402
tree$node_matrix # Node matrix
#>    t8 t11 t7 t19 t10 t14 t15 t2 t3 t18 t20 t6 t5 t17 t12 t16 t9 t1 t4 t13
#> 21  1   1  1   1   1   1   1  1  1   1   1  1  1   1   1   1  1  1  1   1
#> 35  1   1  1   0   0   0   0  0  0   0   0  0  0   0   0   0  0  0  0   0
#> 37  0   1  1   0   0   0   0  0  0   0   0  0  0   0   0   0  0  0  0   0
#> 22  0   0  0   1   1   1   1  1  1   1   1  1  1   1   1   1  1  1  1   1
#> 23  0   0  0   1   1   1   1  1  1   1   1  1  1   1   0   0  0  0  0   0
#> 25  0   0  0   1   1   1   1  1  1   1   1  1  0   0   0   0  0  0  0   0
#> 26  0   0  0   1   1   1   1  1  0   0   0  0  0   0   0   0  0  0  0   0
#> 27  0   0  0   0   1   1   1  1  0   0   0  0  0   0   0   0  0  0  0   0
#> 31  0   0  0   0   0   1   1  1  0   0   0  0  0   0   0   0  0  0  0   0
#> 39  0   0  0   0   0   1   1  0  0   0   0  0  0   0   0   0  0  0  0   0
#> 29  0   0  0   0   0   0   0  0  1   1   1  1  0   0   0   0  0  0  0   0
#> 30  0   0  0   0   0   0   0  0  1   1   1  0  0   0   0   0  0  0  0   0
#> 36  0   0  0   0   0   0   0  0  0   1   1  0  0   0   0   0  0  0  0   0
#> 34  0   0  0   0   0   0   0  0  0   0   0  0  1   1   0   0  0  0  0   0
#> 24  0   0  0   0   0   0   0  0  0   0   0  0  0   0   1   1  1  1  1   1
#> 28  0   0  0   0   0   0   0  0  0   0   0  0  0   0   1   1  1  0  0   0
#> 32  0   0  0   0   0   0   0  0  0   0   0  0  0   0   0   1  1  0  0   0
#> 33  0   0  0   0   0   0   0  0  0   0   0  0  0   0   0   0  0  1  1   1
#> 38  0   0  0   0   0   0   0  0  0   0   0  0  0   0   0   0  0  0  1   1
tree$tree_depth # Tree age
#> [1] 2.564402