Converts a tree given as parent vector format to an ancestor matrix

anc2nwk(anc, n)

Arguments

anc

A matrix. An ancestor matrix.

n

A single integer. The number of mutations.

Value

a string of newick format tree.

Examples

p = c(11, 2, 3, 14, 14, 16, 8, 6, 9, 1, 15, 8, 10, 14, 5, 13, 17)
anc <- parentVector2anc(parents=p,n = 16)
anc2nwk(anc=anc,n=16)
#> [1] "(((((((((8)7,(1)12)9)10)2)3)4,5,(((13)11)16)14)15)6)17;"