Given a distance matrix, computes a cladogram with the stats::hclust
function, and returns it as a tibble::tibble
formatted for the tidytree
package.
Examples
makeTidyTree((Halo_PercentDiff/2 + t(Halo_PercentDiff)/2))
#> # A tbl_tree abstraction: 11 × 6
#> # which can be converted to treedata or phylo
#> # via as.treedata or as.phylo
#> parent node branch.length label isTip y
#> <int> <int> <dbl> <chr> <lgl> <dbl>
#> 1 11 1 10.6 Halobacterium_litoreum TRUE 5
#> 2 11 2 10.6 Halobacterium_noricense TRUE 6
#> 3 10 3 12.3 Halobacterium_salinarum TRUE 4
#> 4 8 4 9.85 Haloferax_mediterranei TRUE 1
#> 5 8 5 9.85 Haloferax_volcanii TRUE 2
#> 6 9 6 13.9 Salarchaeum_japonicum TRUE 3
#> 7 7 7 NA NA FALSE 2.69
#> 8 7 8 5.79 NA FALSE 1.5
#> 9 7 9 1.75 NA FALSE 3.88
#> 10 9 10 1.57 NA FALSE 4.75
#> 11 10 11 1.70 NA FALSE 5.5