Convert a parent vector format to the newick format tree

parentVector2nwk(parents, n)

Arguments

parents

A integer vector. Parent vector format tree.

n

A single integer. The number of mutations.

Value

the 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)
parentVector2nwk(parents=p,n = 16)
#> [1] "(((((((((8)7,(1)12)9)10)2)3)4,5,(((13)11)16)14)15)6)17;"