| 1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> |
|---|
| 2 | <HTML> |
|---|
| 3 | <HEAD> |
|---|
| 4 | <TITLE>treedist</TITLE> |
|---|
| 5 | <META NAME="description" CONTENT="treedist"> |
|---|
| 6 | <META NAME="keywords" CONTENT="treedist"> |
|---|
| 7 | <META NAME="resource-type" CONTENT="document"> |
|---|
| 8 | <META NAME="distribution" CONTENT="global"> |
|---|
| 9 | <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1"> |
|---|
| 10 | </HEAD> |
|---|
| 11 | <BODY BGCOLOR="#ccffff"> |
|---|
| 12 | <DIV ALIGN=RIGHT> |
|---|
| 13 | version 3.6 |
|---|
| 14 | </DIV> |
|---|
| 15 | <P> |
|---|
| 16 | <DIV ALIGN=CENTER> |
|---|
| 17 | <H1>TREEDIST -- distances between trees</H1> |
|---|
| 18 | </DIV> |
|---|
| 19 | <P> |
|---|
| 20 | © Copyright 2002 by The University of |
|---|
| 21 | Washington. Written by Joseph Felsenstein. Permission is granted to copy |
|---|
| 22 | this document provided that no fee is charged for it and that this copyright |
|---|
| 23 | notice is not removed. |
|---|
| 24 | <P> |
|---|
| 25 | This program computes distances between trees. The distance that is |
|---|
| 26 | computed is the Symmetric Distance of Robinson and Foulds (1981). This |
|---|
| 27 | does not use branch length information, only the tree topologies. It |
|---|
| 28 | must also be borne in mind that the distance does not have any immediate |
|---|
| 29 | statistical interpretation -- we cannot say whether a larger distance is |
|---|
| 30 | significantly larger than a smaller one. |
|---|
| 31 | <P> |
|---|
| 32 | The Symmetric Distance is computed by considering each of the branches of |
|---|
| 33 | the two trees. Each branch divides the set of species into two groups -- |
|---|
| 34 | the ones connected to one end of the branch and the ones connected to the |
|---|
| 35 | other. This makes a partition of the full set of species. (in Newick notation) |
|---|
| 36 | <PRE> |
|---|
| 37 | ((A,C),(D,(B,E))) |
|---|
| 38 | </PRE> |
|---|
| 39 | has two internal branches. One induces the partition {A, C | B, D, E} |
|---|
| 40 | and the other induces the partition {A, C, D | B, E}. A different tree |
|---|
| 41 | with the same set of species, |
|---|
| 42 | <PRE> |
|---|
| 43 | (((A,D),C),(B,E))) |
|---|
| 44 | </PRE> |
|---|
| 45 | has internal branches that correspond to the two partitions {A, C, D | B, E} |
|---|
| 46 | and {A, D | B, C, E}. Note that the other branches, all of which are |
|---|
| 47 | external branches, induce partitions that separate one species from all the |
|---|
| 48 | others. Thus there are 5 partitions like this: {C | A, B, D, E} on each |
|---|
| 49 | of these trees. These are always present on all trees, provided that each |
|---|
| 50 | tree has each species at the end of its own branch. |
|---|
| 51 | <P> |
|---|
| 52 | The Symmetric Distance is simply a count of how many partitions there are, |
|---|
| 53 | among the two trees, that are on one tree and not on the other. In the |
|---|
| 54 | example above there are two partitions, {A, C | B, D, E} and {A, D | B, C, E}, |
|---|
| 55 | each of which is present on only one of the two trees. The Symmetric |
|---|
| 56 | Distance between the two trees is therefore 2. When the two trees are |
|---|
| 57 | fully resolved bifurcating trees, their symmetric distance must be an even |
|---|
| 58 | number; it can range from 0 to twice the number of internal branches, which |
|---|
| 59 | for <I>n</I> species is 4n-6. |
|---|
| 60 | <P> |
|---|
| 61 | We have assumed that nothing is lost if the trees are treated as unrooted trees. |
|---|
| 62 | It is easy to define a counterpart to the Symmetric Distance for rooted trees. |
|---|
| 63 | each branch then defines a set of species, namely the clade defined by that |
|---|
| 64 | branch. Thus if the first of the two trees above were considered as a rooted |
|---|
| 65 | tree it would define the three clades {A, C}, {B, D, E}, and {B, E}. The |
|---|
| 66 | symmetric distance between two rooted trees is simply the count of the number |
|---|
| 67 | of clades that are defined by one but not by the other. For the second tree |
|---|
| 68 | the clades would be {A, D}, {B, C, E}, and {B, E}. The Symmetric Distance |
|---|
| 69 | between thee two rooted trees would then be 4. |
|---|
| 70 | <P> |
|---|
| 71 | Although the examples we have discussed have involved fully |
|---|
| 72 | bifurcating trees, the input trees can have multifurcations. |
|---|
| 73 | This can lead to distances that are odd numbers. |
|---|
| 74 | <P> |
|---|
| 75 | <H2>INPUT AND OPTIONS</H2> |
|---|
| 76 | <P> |
|---|
| 77 | The program reads one or two input tree files. If there is one input tree |
|---|
| 78 | file, its default name is <TT>intree</TT>. If there are two their default |
|---|
| 79 | names are <TT>intree</TT> and <TT>intree2</TT>. The tree files may either |
|---|
| 80 | have the number of trees on their first line, or not. If the number of |
|---|
| 81 | trees is given, it is actually ignored and all trees in the tree file |
|---|
| 82 | are considered, even if there are more trees than indicated by the number. |
|---|
| 83 | (This is a bug and it will be fixed in the future). |
|---|
| 84 | <P> |
|---|
| 85 | The options are selected from a menu, which looks like this: |
|---|
| 86 | <P> |
|---|
| 87 | <TABLE><TR><TD BGCOLOR=white> |
|---|
| 88 | <PRE> |
|---|
| 89 | |
|---|
| 90 | Tree distance program, version 3.6a3 |
|---|
| 91 | |
|---|
| 92 | Settings for this run: |
|---|
| 93 | O Outgroup root: No, use as outgroup species 1 |
|---|
| 94 | R Trees to be treated as Rooted: No |
|---|
| 95 | T Terminal type (IBM PC, ANSI, none): (none) |
|---|
| 96 | 1 Print indications of progress of run: Yes |
|---|
| 97 | 2 Tree distance submenu: Distance between adjacent pairs |
|---|
| 98 | |
|---|
| 99 | Are these settings correct? (type Y or the letter for one to change) |
|---|
| 100 | |
|---|
| 101 | </PRE> |
|---|
| 102 | </TD></TR></TABLE> |
|---|
| 103 | <P> |
|---|
| 104 | The O option allows you to root the trees using an outgroup. It is specified |
|---|
| 105 | by giving its number, where the species are numbered in the order they |
|---|
| 106 | appear in the first tree. Outgroup-rooting all the trees does not |
|---|
| 107 | affect the unrooted Symmetric Distance, and if it is done and trees are |
|---|
| 108 | treated as rooted, the distances turn out to be the same as the unrooted |
|---|
| 109 | ones. Thus it is unlikely that you will find this option of interest. |
|---|
| 110 | <P> |
|---|
| 111 | The R option controls whether the Summetric Distance that is computed is |
|---|
| 112 | to treat the trees as unrooted or rooted. Unrooted is the default. |
|---|
| 113 | <P> |
|---|
| 114 | The terminal type (0) and progress (1) options do not need description here. |
|---|
| 115 | <P> |
|---|
| 116 | Option 2 controls how many tree files are read in, which trees are to |
|---|
| 117 | be compared, and how the output is to be presented. It causes |
|---|
| 118 | another menu to appear: |
|---|
| 119 | <P> |
|---|
| 120 | <TABLE><TR><TD BGCOLOR=white> |
|---|
| 121 | <PRE> |
|---|
| 122 | Tree Pairing Submenu: |
|---|
| 123 | A Distances between adjacent pairs in tree file. |
|---|
| 124 | P Distances between all possible pairs in tree file. |
|---|
| 125 | C Distances between corresponding pairs in one tree file and another. |
|---|
| 126 | L Distances between all pairs in one tree file and another. |
|---|
| 127 | </PRE> |
|---|
| 128 | </TD></TR></TABLE> |
|---|
| 129 | <P> |
|---|
| 130 | Option A computes the distances between successive pairs of trees in the |
|---|
| 131 | tree input file -- between trees 1 and 2, trees 3 and 4, trees |
|---|
| 132 | 5 and 6, and so on. If there are an odd number of trees in the input tree |
|---|
| 133 | file the last tree will be ignored and a warning message printed to |
|---|
| 134 | remind the user that nothing was done with it. |
|---|
| 135 | <P> |
|---|
| 136 | Option P computes distances between all pairs of trees in the input tree |
|---|
| 137 | file. Thus with 10 trees 10 x 10 = 100 distances will be computed, |
|---|
| 138 | including distances between each tree and itself. |
|---|
| 139 | <P> |
|---|
| 140 | Option C takes input from two tree files and cmputes distances between |
|---|
| 141 | corresponding members of the two tree files. Thus distances will be |
|---|
| 142 | computed between tree 1 of the first tree file and tree 1 of the second one, |
|---|
| 143 | between tree 2 of the first file and tree 2 of the second one, and so on. |
|---|
| 144 | If the number of trees in the two files differs, the extra trees in the |
|---|
| 145 | file that has more of them are ignored and a warning is printed out. |
|---|
| 146 | <P> |
|---|
| 147 | Option L computes distances between all pairs of trees, where one tree is |
|---|
| 148 | taken from one tree file and the other from the other tree file. Thus if |
|---|
| 149 | the first tree file has 7 trees and the second has 5 trees, 7 x 5 = 35 |
|---|
| 150 | different distances will be computed. <B> Note -- this option seems not |
|---|
| 151 | to work at the moment. We hope to fix this soon.</B> |
|---|
| 152 | <P> |
|---|
| 153 | If option 2 is not selected, the program defaults to looking at one tree |
|---|
| 154 | file and computing distances of adjacent pairs (so that option A is |
|---|
| 155 | the default). |
|---|
| 156 | <P> |
|---|
| 157 | <H2>OUTPUT</H2> |
|---|
| 158 | <P> |
|---|
| 159 | The results of the analysis are written onto an output file whose |
|---|
| 160 | default file name is <TT>outfile</TT>. |
|---|
| 161 | <P> |
|---|
| 162 | If any of the four types of analysis are selected, the program asks the |
|---|
| 163 | user how they want the results presented. Here is that menu for options |
|---|
| 164 | P or L: |
|---|
| 165 | <P> |
|---|
| 166 | <TABLE><TR><TD BGCOLOR=white> |
|---|
| 167 | <PRE> |
|---|
| 168 | |
|---|
| 169 | Distances output options: |
|---|
| 170 | F Full matrix. |
|---|
| 171 | V One pair per line, verbose. |
|---|
| 172 | S One pair per line, sparse. |
|---|
| 173 | |
|---|
| 174 | Choose one: (F,V,S) |
|---|
| 175 | </PRE> |
|---|
| 176 | </TD></TR></TABLE> |
|---|
| 177 | <P> |
|---|
| 178 | The Full matrix (choice F) is a table showing all distances. It is |
|---|
| 179 | written onto the output file. The table is presented as groups of |
|---|
| 180 | 10 columns. Here is the Full matrix for the 12 trees in the input |
|---|
| 181 | tree file which is given as an example at the end of this page. |
|---|
| 182 | <P> |
|---|
| 183 | <TABLE><TR><TD BGCOLOR=white> |
|---|
| 184 | <PRE> |
|---|
| 185 | |
|---|
| 186 | Tree distance program, version 3.6 |
|---|
| 187 | |
|---|
| 188 | Symmetric differences between all pairs of trees in tree file: |
|---|
| 189 | |
|---|
| 190 | 1 2 3 4 5 6 7 8 9 10 |
|---|
| 191 | \------------------------------------------------------------ |
|---|
| 192 | 1 | 0 4 2 10 10 10 10 10 10 10 |
|---|
| 193 | 2 | 4 0 2 10 8 10 8 10 8 10 |
|---|
| 194 | 3 | 2 2 0 10 10 10 10 10 10 10 |
|---|
| 195 | 4 | 10 10 10 0 2 2 4 2 4 0 |
|---|
| 196 | 5 | 10 8 10 2 0 4 2 4 2 2 |
|---|
| 197 | 6 | 10 10 10 2 4 0 2 2 4 2 |
|---|
| 198 | 7 | 10 8 10 4 2 2 0 4 2 4 |
|---|
| 199 | 8 | 10 10 10 2 4 2 4 0 2 2 |
|---|
| 200 | 9 | 10 8 10 4 2 4 2 2 0 4 |
|---|
| 201 | 10 | 10 10 10 0 2 2 4 2 4 0 |
|---|
| 202 | 11 | 2 2 0 10 10 10 10 10 10 10 |
|---|
| 203 | 12 | 10 10 10 2 4 2 4 0 2 2 |
|---|
| 204 | |
|---|
| 205 | |
|---|
| 206 | 11 12 |
|---|
| 207 | \------------ |
|---|
| 208 | 1 | 2 10 |
|---|
| 209 | 2 | 2 10 |
|---|
| 210 | 3 | 0 10 |
|---|
| 211 | 4 | 10 2 |
|---|
| 212 | 5 | 10 4 |
|---|
| 213 | 6 | 10 2 |
|---|
| 214 | 7 | 10 4 |
|---|
| 215 | 8 | 10 0 |
|---|
| 216 | 9 | 10 2 |
|---|
| 217 | 10 | 10 2 |
|---|
| 218 | 11 | 0 10 |
|---|
| 219 | 12 | 10 0 |
|---|
| 220 | |
|---|
| 221 | |
|---|
| 222 | </PRE> |
|---|
| 223 | </TD></TR></TABLE> |
|---|
| 224 | <P> |
|---|
| 225 | The Full matrix is only available for analyses P and L (not for A or C). |
|---|
| 226 | <P> |
|---|
| 227 | Option V (Verbose) writes one distance per line. The Verbose |
|---|
| 228 | output is the default. Here it is for the example data set given below: |
|---|
| 229 | <P> |
|---|
| 230 | <TABLE><TR><TD BGCOLOR=white> |
|---|
| 231 | <PRE> |
|---|
| 232 | |
|---|
| 233 | Tree distance program, version 3.6a3 |
|---|
| 234 | |
|---|
| 235 | Symmetric differences between adjacent pairs of trees: |
|---|
| 236 | |
|---|
| 237 | Trees 1 and 2: 4 |
|---|
| 238 | Trees 3 and 4: 10 |
|---|
| 239 | Trees 5 and 6: 4 |
|---|
| 240 | Trees 7 and 8: 4 |
|---|
| 241 | Trees 9 and 10: 4 |
|---|
| 242 | Trees 11 and 12: 10 |
|---|
| 243 | |
|---|
| 244 | </PRE> |
|---|
| 245 | </TD></TR></TABLE> |
|---|
| 246 | <P> |
|---|
| 247 | Option S (Sparse or terse) is similar except that all that is |
|---|
| 248 | given on each line are the numbers of the two trees and the distance, |
|---|
| 249 | separated by blanks. This may be a convenient format if you want to |
|---|
| 250 | write a program to read these numbers in, and you want to spare yourself |
|---|
| 251 | the effort of having the program wade through the words on each line |
|---|
| 252 | in the Verbose output. |
|---|
| 253 | The first four lines of the Sparse output are titles that your program would |
|---|
| 254 | want to skip past. Here is the Sparse output for the example trees. |
|---|
| 255 | <P> |
|---|
| 256 | <TABLE><TR><TD BGCOLOR=white> |
|---|
| 257 | <PRE> |
|---|
| 258 | |
|---|
| 259 | Tree distance program, version 3.6 |
|---|
| 260 | |
|---|
| 261 | Symmetric differences between adjacent pairs of trees: |
|---|
| 262 | |
|---|
| 263 | 1 2 4 |
|---|
| 264 | 3 4 10 |
|---|
| 265 | 5 6 4 |
|---|
| 266 | 7 8 4 |
|---|
| 267 | 9 10 4 |
|---|
| 268 | 11 12 10 |
|---|
| 269 | </PRE> |
|---|
| 270 | </TD></TR></TABLE> |
|---|
| 271 | <P> |
|---|
| 272 | <H2>CREDITS AND FUTURE</H2> |
|---|
| 273 | <P> |
|---|
| 274 | TREEDIST was written by Dan Fineman. In the future we hope to expand it |
|---|
| 275 | to consider a distance based on branch lengths as well as tree topologies. |
|---|
| 276 | The Branch Score distance defined by Kuhner and Felsenstein (1994) is |
|---|
| 277 | the one we have in mind (the Branch Score defined by them is actually |
|---|
| 278 | the square of the distance). We also hope to compute a distance based on |
|---|
| 279 | quartets shared and not shared by trees (implicit in the work of Estabrook, McMorris, and |
|---|
| 280 | Meacham, 1985). |
|---|
| 281 | <P> |
|---|
| 282 | <HR> |
|---|
| 283 | <P> |
|---|
| 284 | <H3>TEST DATA SET</H3> |
|---|
| 285 | <P> |
|---|
| 286 | <TABLE><TR><TD BGCOLOR=white> |
|---|
| 287 | <PRE> |
|---|
| 288 | (A,(B,(H,(D,(J,(((G,E),(F,I)),C)))))); |
|---|
| 289 | (A,(B,(D,((J,H),(((G,E),(F,I)),C))))); |
|---|
| 290 | (A,(B,(D,(H,(J,(((G,E),(F,I)),C)))))); |
|---|
| 291 | (A,(B,(E,(G,((F,I),((J,(H,D)),C)))))); |
|---|
| 292 | (A,(B,(E,(G,((F,I),(((J,H),D),C)))))); |
|---|
| 293 | (A,(B,(E,((F,I),(G,((J,(H,D)),C)))))); |
|---|
| 294 | (A,(B,(E,((F,I),(G,(((J,H),D),C)))))); |
|---|
| 295 | (A,(B,(E,((G,(F,I)),((J,(H,D)),C))))); |
|---|
| 296 | (A,(B,(E,((G,(F,I)),(((J,H),D),C))))); |
|---|
| 297 | (A,(B,(E,(G,((F,I),((J,(H,D)),C)))))); |
|---|
| 298 | (A,(B,(D,(H,(J,(((G,E),(F,I)),C)))))); |
|---|
| 299 | (A,(B,(E,((G,(F,I)),((J,(H,D)),C))))); |
|---|
| 300 | </PRE> |
|---|
| 301 | </TD></TR></TABLE> |
|---|
| 302 | <P> |
|---|
| 303 | The output from default settings for this test set is given above (it is the |
|---|
| 304 | Verbose output example). |
|---|
| 305 | </BODY> |
|---|
| 306 | </HTML> |
|---|