(Re)roots a tree on a specified outgroup Synopsis -------- nw_reroot [-dhl] [label*] Input ----- First argument is the name of a file that contains Newick trees, or '-' (in which case trees are read from standard input). Further arguments are node labels. If there is at least one label, the tree will be re-rooted on their LCAa. If there is no label, the tree is rerooted on the longest branch. In this case the tree must be a phylogram. Output ------ Re-roots the tree on the outgroup formed by the nodes whose labels are passed as arguments (by finding their LCA and rooting on its parent edge). Options ------- -d: deroot - splice out the LCA of the ingroup, attaching its children to the root. The ingroup is the root's child which has the more children. The root is expected to have two children. -h: print this message and exit -l: lax - if it is not possible to reroot on the outgroup, try the ingroup - that is, all nodes whose labels were NOT passed as arguments. This can also fail, if both the outgroup and the ingroup have the tree's root as LCA. Note that to use this option you must make sure that you pass ALL outgroup labels, otherwise the ingroup will be wrong. Examples -------- # This tree is rooted on humans, but the outgroup should be Cebus (New # World monkey) - let's fix that: $ nw_reroot data/catarrhini_wrong Cebus # We can reroot on more than one node: $ nw_reroot data/catarrhini_wrong_3og Cebus Aotus