Navigation Banner
 
  HyPhy Documentation: HyPhy GUI Examples: Tree Reconstruction and Display

Prerequisites
This example uses the ideas of Simple MLE analysis.
Description
The objective of this example is to do the following: load a data set and infer the topology using maximum likelihood tree search under HKY85 with two independent parameters per branch (i.e. transvertion/transition ratios vary from branch to branch). Afterwards, display the inferred tree, scale branches and label them with transvertion/transition ratios.
Create data partitions
In HyPhy, open the data file 'actin.nuc' from 'data' in 'GUIExamples'. First, we define a single partition (the entire file) To that end, first select all the sites in the data ('Select All' or Command-A), and choose 'Selection->Partition' from the 'Data' menu. Double clock on the partition row and rename the partition to 'All'.

Assign 'Infer Topology' to the partition, set the model to 'HKY85', parameters to 'Local' (independent transversion/ transition ratios for each branch in the tree) and frequencies to 'Partition'.

The end result should look like this:

Infer the topology
Select 'Inference', then 'Infer Topology' (Command-L), from the likelihood value. You will be presented with the choice of inference methods. Choose 'Sequential Addition', then 'Random Order', then 'Complete NNI', then 'First 3'. Each dialog provides brief explanation of inference options. For a discussion of inference methods, refer to documentation pages on standard analyses which perform topology inferences. HyPhy will begin the inference process, which should take a minute or two. Since the order of sequences was randomized, you may end up with a different tree from that discussed in this example, but most likely, the tree will be same, just the rootings will differ.

A parameter table will appear once the inference has finished, and 'Infer Tree' will be replaced with the actual inferred tree as the topology for our partition.

Double click on the tree in the parameter table to open a tree window. By default tree branches are scaled on the expected number of substitutions per site. HKY85 with local parameters will have two parameters per branch, thus it is possible to scale the tree on either of these parameters, or any function thereof. Select various scaling options in the tree panel, to get immediate visual interpretation of parameter values. You can save trees to graphics file for comparison or inclusion in other documents - just select 'Save' from the 'File' menu. You can also copy the tree picture to clipboard, print the tree, or save the tree to a PDF of PS file via printer drivers (on OS X - choose 'Save to PDF' when you print, on OS 9, user the LaserWriter 8 driver and choose to save the file).

Scaled on E[subs] Scaled on transitions

Scaled on transversions Scaled on transversion/transition ratios.

You may ask: how did we know which parameter represented transitions and transversions? And: how can we scale on the ratio of the parameters, because it doesn't appear as an option in 'Branch Scaling'?

Display the model matrix
In order to see that 'a' represents transversions and 'b' represents transitions, we will look at the structure of the model rate matrix. To do that, open 'Object Inspector' (from the 'Windows' menu, or Command-I), and switch to 'Models' using the pulldown menu at the top of the Object Inspector window. Scroll all the way to the bottom of the table:

The model at the bottom is the one we want. Why? At the top of the list you will see a bunch of Template models that are predefined (they are in italics), some other models which are not in italics (they were created using HyPhy GUI model module), and finally the single model in bold. If we look at the name of the model in bold, it is prefixed with 'All' (the name of our partition) and then followed by HKY85, which is the form of the rate matrix. It is in bold, because it is currently being used in a likelihood function. Double click on that model. A new window pops up:

It actually shows us the rate matrix (pretty cool, huh) and the equilibrium frequencies vector. Looking at the matrix, you can see that A<->G and C<->T rates (transitions) are parametrized by 'b', and all other rates are parameterized by 'a'. This method is useful for looking up model matrices in general.
Define the new scaling parameter
Since 'b' is the transition rate and 'a' is the tranversion rate, their ratio 'a/b' is the transversion/transition ratio for the branch. Switch back to the tree window, and select all branches (Command-A or 'Select All' from the 'Edit' menu). Hit 'Enter' or select 'Edit Properties' from the 'Tree' menu. A new dialog appears, listing common parameters for each branch ('a' and 'b'). To add a new scaling parameter, click on the '+' button in the dialog and enter 'a/b' in the formula window:

Click on the check button to validate the expression, and then click OK. The dialog goes away and 'user_param' is now available in the scaling menu! We could have entered any other valid formula in terms of 'a' and 'b' in the formula box (try it if you want to see some other scalings), or added more user parameters. If you don't like the default name 'user_param', you can select all branches, open the parameter dialog, double click on 'user_param' cell in the table and type in a new name (it has to be a valid unique HyPhy identifier, i.e. w/o spaces and beginning with a letter or an undescore). You can double click on individual tree branches to see the value of 'user_param' or scale the tree on it and hover the mouse over a branch of interest for a second or so and a little floater with the branch length will appear.
More cool stuff
While in the tree window, click on a tree branch to select it, then go to the 'Tree' menu and choose 'Show Rate Matrix' or 'Show Transition Matrix'. HyPhy will display the transition/rate matrix for that branch. Remember that the transition matrix is the exponential of the rate matrix and shows the actual probabilities of substituion along that branch.
Label tree branches
Finally, to produce a good looking tree let us do the following:
  • Scale the tree on E[Substitutions]
  • Set line thickness to 3 and label font to 'Times' size 14. To do this, select 'Tree Display Options' from the 'Tree' and make the appropriate choices. Also, check 'Scale tree by resizing the window' box. It will make sizing this small tree easier and more visual.
  • Label tree branches with the values of transversion. Select 'Branch Labels', then 'Above Branches' from the 'Tree' menu, then choose 'Label with:' user_param, align at left, max digits 2, font style bold.
  • Resize the window to your liking.


If a branch is too short for the label to fit, no label will be displayed. You can get around that by using an 'Unscaled' view, however that way branch lengths aren't reflected graphically.

 
Sergei L. Kosakovsky Pond and Spencer V. Muse, 1997-2002