---
name: "reroot"
section: "1"
platform: "linux"
package: "prime-phylo"
version: "1.0.11-13+b1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/reroot"
---

# reroot(1)

Compute a (new) root for the tree.

## NAME

reroot - Compute a (new) root for the tree.

## SYNOPSIS

**reroot** \[*OPTIONS*\] *tree-file*

## DESCRIPTION

This program reroots the trees in \<treefile\> on an selected edge.

The default is to output a random rerooting, but you can also choose to give the edge to put the root on, or an outgroup, or even all possible rootings.

Output is written to stdout unless the exhaustive rooting is chosen. Then -o is giving the prefix for filenames to use and the results are written to \<prefix\>\_\<n\>.tree, where \<n\> is the node number of the head of the edge.

Warning! In the current implementation all time/length info is lost.

## OPTIONS

- **--help**

  Display help

- **-V**, **--version**

  Print version and exit

- **-S**, **--read-tree-from-stdin**

  read tree from STDIN (no \<tree-file\>)

- **-f**, **--input-format** **prime\|inputxml**

  The input format. Default is prime

- **-e**, **--exhaustive**

  Do all possible rootings

- **-o**, **--output-file-prefix** **file-prefix**

  The stem for filenames

- **-n**, **--node-index** ***INT***

  Reroot tree at edge leading to node

- **-g**, **--outgroup** ***STRING***

  Root tree at smallest subtree containing the leaves listed in a commaseparated arguments

## EXIT STATUS

- **0**

  Successful program execution.

- **1**

  Some error occurred

## URL

- The prime-phylo home page: http://prime.sbc.su.se

  ## SEE ALSO

[**primeDTLSR**(1)](/primeDTLSR/1.md), [**primeDLRS**(1)](/primeDLRS/1.md), [**primeGEM**(1)](/primeGEM/1.md), [**chainsaw**(1)](/chainsaw/1.md), [**reconcile**(1)](/reconcile/1.md), [**showtree**(1)](/showtree/1.md), [**tree2leafnames**(1)](/tree2leafnames/1.md), [**treesize**(1)](/treesize/1.md)
