Skip to content
Dom Bennett edited this page Jun 26, 2017 · 5 revisions

For changing tree parameters there are a set of methods called set methods. These are used to update the tip IDs, remove spans, etc.

Change tree age.

tree <- randTree(10)
(getAge(tree))
# recalibrate the tree's age
tree <- setAge(tree, val=1)
(getAge(tree))

A TreeMan object requires all its node IDs to be unique and to contain only numbers, letters and _s. For example, the below tree can be read in, but its tip IDs are invalid because they contain . and should be renamed. This can be achieved with the setNdsIds() function.

tree <- readTree(text='(((Sp.1:1.0,Sp.2:1.0):1.0,(Sp.3:1.0,Sp.4:1.0):1.0):1.0,Sp.5:1.0):1.0;')
new_ids <- sub('\\.', '_', tree['tips'])
tree <- setNdsID(tree, tree['tips'], new_ids)

See set-methods for a full list.

Next page: Manipulating

Clone this wiki locally