EMBOSS: fretree

| fretree

## Wiki

The master copies of EMBOSS documentation are available at http://emboss.open-bio.org/wiki/Appdocs on the EMBOSS Wiki.

Please help by correcting and extending the Wiki pages.

## Function

Interactive tree rearrangement

## Description

Reads in a tree (with branch lengths if necessary) and allows you to reroot the tree, to flip branches, to change species names and branch lengths, and then write the result out. Can be used to convert between rooted and unrooted trees, and to write the tree into a preliminary version of a new XML tree file format which is under development and which is described in the RETREE documentation web page.

## Algorithm

RETREE is a tree editor. It reads in a tree, or allows the user to construct one, and displays this tree on the screen. The user then can specify how the tree is to be rearranged, rerooted or written out to a file.

The input trees are in one file (with default file name intree), the output trees are written into another (outtree). The user can reroot, flip branches, change names of species, change or remove branch lengths, and move around to look at various parts of the tree if it is too large to fit on the screen. The trees can be multifurcating at any level, although the user is warned that many PHYLIP programs still cannot handle multifurcations above the root, or even at the root.

A major use for this program will be to change rootedness of trees so that a rooted tree derived from one program can be fed in as an unrooted tree to another (you are asked about this when you give the command to write out the tree onto the tree output file). It will also be useful for specifying the length of a branch in a tree where you want a program like DNAML, DNAMLK, FITCH, or CONTML to hold that branch length constant (see the L suboption of the User Tree option in those programs. It will also be useful for changing the order of species for purely cosmetic reasons for DRAWGRAM and DRAWTREE, including using the Midpoint method of rooting the tree. It can also be used to write out a tree file in the Nexus format used by Paup and MacClade or in our XML tree file format.

This program uses graphic characters that show the tree to best advantage on some computer systems. Its graphic characters will work best on MSDOS systems or MSDOS windows in Windows, and to any system whose screen or terminals emulate ANSI standard terminals such as old Digitial VT100 terminals, Telnet programs, or VT100-compatible windows in the X windowing system. For any other screen types, (such as Macintosh windows) there is a generic option which does not make use of screen graphics characters. The program will work well in those cases, but the tree it displays will look a bit uglier.

## Usage

Here is a sample session with fretree

    % fretree
    Interactive tree rearrangement
    Number of species [0]: 10
    Phylip tree file: retree.dat
    Phylip tree output file [retree.treefile]:
    NEXT? (R . U W O T F D B N H J K L C + ? X Q) (? for Help): Q
    Do you want to write out the tree to a file? (Y or N): Y
    Enter R if the tree is to be rooted, OR enter U if the tree is to be unrooted: U

    Tree written to file "retree.treefile"

    Reading tree file ...

                                          ,>>1:Human
                                       ,>22
                                    ,>21  `>>2:Chimp
                                    !  !
                                 ,>20  `>>>>>3:Gorilla
                                 !  !
                     ,>>>>>>>>>>19  `>>>>>>>>4:Orang
                     !           !
                  ,>18           `>>>>>>>>>>>5:Gibbon
                  !  !
                  !  !              ,>>>>>>>>6:Barbary Ma
                  !  `>>>>>>>>>>>>>23
                  !                 !  ,>>>>>7:Crab-e. Ma
         ,>>>>>>>17                 `>24
         !        !                    !  ,>>8:Rhesus Mac
         !        !                    `>25
         !        !                       `>>9:Jpn Macaq
      ,>16        !
      !  !        `>>>>>>>>>>>>>>>>>>>>>>>>>10:Squir. Mon
      !  !
      !  !                                ,>11:Tarsier
    ** 7 lines below screen **

Go to the input files for this example
Go to the output files for this example

## Command line arguments

    Interactive tree rearrangement
    Version: EMBOSS:6.6.0.0

       Standard (Mandatory) qualifiers:
      [-spp]               integer    [0] Number of species (Any integer value)
      [-intreefile]        tree       Phylip tree file
      [-outtreefile]       outfile    [*.fretree] Phylip tree output file

       Additional (Optional) qualifiers:
       -initialtree        menu       [Arbitary] Initial tree (Values: a
                                      (Arbitary); u (User); s (Specify))
       -format             menu       [p] Format to write trees (Values: p
                                      (PHYLIP); n (NEXUS); x (XML))
       -screenwidth        integer    [80] Width of terminal screen in characters
                                      (Any integer value)
       -vscreenwidth       integer    [80] Width of plotting area in characters
                                      (Any integer value)
       -screenlines        integer    [24] Number of lines on screen (Any integer
                                      value)

       Advanced (Unprompted) qualifiers: (none)
       Associated qualifiers:

       "-outtreefile" associated qualifiers
       -odirectory3        string     Output directory

       General qualifiers:
       -auto               boolean    Turn off prompts
       -stdout             boolean    Write first file to standard output
       -filter             boolean    Read first file from standard input, write
                                      first file to standard output
       -options            boolean    Prompt for standard and additional values
       -debug              boolean    Write debug output to program.dbg
       -verbose            boolean    Report some/full command line options
       -help               boolean    Report command line options and exit. More
                                      information on associated and general
                                      qualifiers can be found with -help -verbose
       -warning            boolean    Report warnings
       -error              boolean    Report errors
       -fatal              boolean    Report fatal errors
       -die                boolean    Report dying program messages
       -version            boolean    Report version number and exit

Qualifier | Type | Description | Allowed values | Default
--- | --- | --- | --- | ---
Standard (Mandatory) qualifiers
[-spp] (Parameter 1) | integer | Number of species | Any integer value | 0
[-intreefile] (Parameter 2) | tree | Phylip tree file | Phylogenetic tree |
[-outtreefile] (Parameter 3) | outfile | Phylip tree output file | Output file | <*>.fretree
Additional (Optional) qualifiers
-initialtree | list | Initial tree |
a | (Arbitary)
u | (User)
s | (Specify)
| Arbitary
-format | list | Format to write trees |
p | (PHYLIP)
n | (NEXUS)
x | (XML)
| p
-screenwidth | integer | Width of terminal screen in characters | Any integer value | 80
-vscreenwidth | integer | Width of plotting area in characters | Any integer value | 80
-screenlines | integer | Number of lines on screen | Any integer value | 24
Advanced (Unprompted) qualifiers
(none)
Associated qualifiers
"-outtreefile" associated outfile qualifiers
-odirectory3 -odirectory_outtreefile | string | Output directory | Any string |
General qualifiers
-auto | boolean | Turn off prompts | Boolean value Yes/No | N
-stdout | boolean | Write first file to standard output | Boolean value Yes/No | N
-filter | boolean | Read first file from standard input, write first file to standard output | Boolean value Yes/No | N
-options | boolean | Prompt for standard and additional values | Boolean value Yes/No | N
-debug | boolean | Write debug output to program.dbg | Boolean value Yes/No | N
-verbose | boolean | Report some/full command line options | Boolean value Yes/No | Y
-help | boolean | Report command line options and exit. More information on associated and general qualifiers can be found with -help -verbose | Boolean value Yes/No | N
-warning | boolean | Report warnings | Boolean value Yes/No | Y
-error | boolean | Report errors | Boolean value Yes/No | Y
-fatal | boolean | Report fatal errors | Boolean value Yes/No | Y
-die | boolean | Report dying program messages | Boolean value Yes/No | Y
-version | boolean | Report version number and exit | Boolean value Yes/No | N

## Input file format

fretree reads any normal sequence USAs.

### Input files for usage example

### File: retree.dat

    ((((((((Human,Chimp),Gorilla),Orang),Gibbon),(Barbary_Ma,(Crab-e._Ma,
    (Rhesus_Mac,Jpn_Macaq)))),Squir._Mon),((Tarsier,Lemur),Bovine)),Mouse);

## Output file format

The N (output file format) option allows the user to specify that the tree files that are written by the program will be in one of three formats:

1. The PHYLIP default file format (the Newick standard) used by the programs in this package.
2. The Nexus format defined by David Swofford and by Wayne Maddison and David Maddison for their programs PAUP and MacClade. A tree file written in Nexus format should be directly readable by those programs (They also have options to read a regular PHYLIP tree file as well).
3. An XML tree file format which we have defined.

The XML tree file format is fairly simple. The tree file, which may have multiple trees, is enclosed in a pair of <PHYLOGENIES> ... </PHYLOGENIES> tags. Each tree is included in tags <PHYLOGENY> ... </PHYLOGENY>. Each branch of the tree is enclosed in a pair of tags <CLADE> ... </CLADE>, which enclose the branch and all its descendants. If the branch has a length, this is given by the LENGTH attribute of the CLADE tag, so that the pair of tags looks like this: <CLADE LENGTH="0.09362"> ... </CLADE>

A tip of the tree is at the end of a branch (and hence that branch is enclosed in a pair of <CLADE> ... </CLADE> tags). Its name is enclosed by <NAME> ... </NAME> tags. Here is an XML tree:

    <phylogenies>
      <phylogeny>
        <clade>
          <clade length="0.87231"><name>Mouse</name></clade>
          <clade length="0.49807"><name>Bovine</name></clade>
          <clade length="0.39538">
            <clade length="0.25930"><name>Gibbon</name></clade>
            <clade length="0.10815">
              <clade length="0.24166"><name>Orang</name></clade>
              <clade length="0.04405">
                <clade length="0.12322"><name>Gorilla</name></clade>
                <clade length="0.06026">
                  <clade length="0.13846"><name>Chimp</name></clade>
                  <clade length="0.0857"><name>Human</name></clade>
                </clade>
              </clade>
            </clade>
          </clade>
        </clade>
      </phylogeny>
    </phylogenies>

The indentation is for readability but is not part of the XML tree standard, which ignores that kind of white space.

What programs can read an XML tree? None right now, not even PHYLIP programs! But soon our lab's LAMARC package will have programs that can read an XML tree. XML is rapidly becoming the standard for representing and interchanging complex data -- it is time to have an XML tree standard. Certain extensions are obvious (to represent the bootstrap proportion for a branch, use BOOTP=0.83 in the CLADE tag, for example).

There are other proposals for an XML tree standard. They have many similarities to this one, but are not identical to it. At the moment there is no mechanism in place for deciding between them other than seeing which get widely used. Here are links to other proposals:

Taxonomic Markup Language | http://www.albany.edu/~gilmr/pubxml/. and preprint at xml.coverpages.org/gilmour-TML.pdf | published in the paper by Ron Gilmour (2000).
Andrew Rambaut's BEAST XML phylogeny format | See page 9 of PDF of BEAST manual at http://evolve.zoo.ox.ac.uk/beast/ | An XML format for phylogenies is sketchly described there.
treeml | http://www.nomencurator.org/InfoVis2003/download/treeml.dtd (see also example: ) http://www.cs.umd.edu/hcil/iv03contest/datasets/treeml-sample.xml | Jean-Daniel Fekete's DTD for a tree XML file

The W (screen and window Width) option specifies the width in characters of the area which the trees will be plotted to fit into. This is by default 80 characters so that they will fit on a normal width terminal. The actual width of the display on the terminal (normally 80 characters) will be regarded as a window displaying part of the tree. Thus you could set the "plotting area" to 132 characters, and inform the program that the screen width is 80 characters. Then the program will display only part of the tree at any one time.

### Output files for usage example

### File: retree.treefile

    (((((((Human,Chimp),Gorilla),Orang),Gibbon),(Barbary_Ma,(Crab-e._Ma,
    (Rhesus_Mac,Jpn_Macaq)))),Squir._Mon),((Tarsier,Lemur),Bovine),Mouse);

## Data files

None

## Notes

None.

## References

None.

## Warnings

None.

## Diagnostic Error Messages

None.

## Exit status

It always exits with status 0.

## Known bugs

None.

## See also

Program name | Description
--- | ---
fdrawgram | Plots a cladogram- or phenogram-like rooted tree diagram
fdrawtree | Plots an unrooted tree diagram

## Author(s)

This program is an EMBOSS conversion of a program written by Joe Felsenstein as part of his PHYLIP package.

Please report all bugs to the EMBOSS bug team (emboss-bug © emboss.open-bio.org) not to the original author.

## History

Written (2004) - Joe Felsenstein, University of Washington.

Converted (August 2004) to an EMBASSY program by the EMBOSS team.

## Target users

This program is intended to be used by everyone and everything, from naive users to embedded scripts.

## Comments

    None