Center for Integrative Bioinformatics Vienna
Max F. Perutz Laboratories
Dr. Bohr Gasse 9
A-1030 Vienna, Austria
printable version  

   Max F. Perutz Laboratories
   University of Vienna
   Medical University, Vienna

   Deep Metazoan Phylogeny
   MaBS group
   Max Perutz Library

Haplotype Viewer

Haploviewer is a GUI application for viewing and exporting publication quality haplotype genealogies. In particular it turns trees build from traditional phylogenetic methods into haplotype genealogies. This software is still under development and should be considered a "beta" version.

The program runs on mac, windows and Unix operating systems. You will need to have java installed. Although you can run some phylip (not included) programs from haploview, it is recommended that you are familiar with running these programs yourself. Haploview will output a haplotype alignment for you in several different formats for this purpose.

Please note that this is a work in progress. Its not yet perfect and there are a few little quirks. However most have clear workarounds and are not serious limitations. Also the source code is distributed with the binary. Inside the jar file you will also find the source. I have also included jlibeps for eps export. This (jlibeps) is not my code and has its own copyright. Otherwise this code is released under the GPLv3 license.

Here is an example output.

Download and Installing

Download Here

The download is a zip file. Unzipping will give you a HapView directory with a bin, lib, and example directory. Under Unix systems and macs, the "hapview" script will launch java and the program. Simlinks to this script also work. Under windows the hapview.exe file will launch the application.

Note that haploviewer needs java 1.6 (also called java 6) to work. On macs this is part of the normal updates, however this is not always the default. Open the java console and set all java version to use version 1.6.

Using Haploviewer

There are three important points to understand in order to use haploviewer effectively.

The first is that it loads data at the time a tree is read in from the file system. So reading in a new alignment will not change any current trees or haplotypes. You must reload the trees. This also applies to the location sub strings (see below).

The second important point is that you must load an alignment that matches the tree that you load later. In particular the aliment must have the all the labels that the trees contain. If it doesn't the trees will fail to load. This however is not difficult since if a tree comes from a dataset, then it must have the same labels or a subset of the labels.

The final point is that branch lengths and the subsequent haplotype genealogy is calculated from the alignment. Branch lengths in the tree file are ignored. Only the topology information is used. Also there is not always a 1 to 1 relationship between trees and haplotype genealogies. A single tree can result in more that one genealogy. While a number of different trees my only resolve to a single haplotype genealogy. Haploview will provide you with a slider under the main buttons to scan through the first 100 genealogies. Its is rare to have more than a few genealogies however.

Some minor considerations are file formats. Only fasta files can be read for alignments and only newick trees (not nexus tree format) can be read for trees. For trees they should end with a ";". There are many file conversion programs so this should not cause problems. Note that output formats are more varied.


We will give a simple step by step example. We will assume that you have started the application from the HapView directory. Once you have a haplotype genealogy there are a few basic operations to work with. Dragging will drag the whole genealogy, the scroll wheel will zoom. Dragging a haplotype will rotate it and its children. If the legend is visible it can be dragged to where you want as with the size legend. Also the normal legend can be edited. Both the location names can be changed and the colors, by simply clicking on the name or color respectively. The mouse pointer will highlight edges and haplotypes. If its an edge, positions of the mutations are show at the bottom of the window. Haplotypes will give the label name, size, and location samples.

Loading a data set and trees

You can also load the finished version by simply using "load" in the main window and selecting the "example.obj" file.
  1. Push the "New Data" button
  2. A new window has popped up. Push the "Load" button and load the "example.fasta" file from the example directory. Note that everything else in this window is disabled.
  3. Once a alignment is loaded the other fields in the load dialog are enabled. Now we can add the location sub strings. In the text field just above the "add" button Enter "A","B","C" and "D" hitting the enter key between each letter. If a label in the alignment has an "A" in it, it will be added to the A's count. Note that this must be done before loading a tree. Also note that if more than one substring appears in label, only the first to match is used.
  4. Typically you would now use one of the save buttons at the bottom of the dialog window. This saves a haplotype alignment that can be read by different phylogenetic programs that would now be run manually.
  5. Now we are ready to load the trees. Click on "load trees" and select the "outtrees" file in the example directory. You should now see a nice -not so well layed out haplotype genealogy. We can now dismiss the dialog by clicking done.
  6. We now edit the layout of the haplotype genealogy till we are happy with the result. You can rotate haplotypes around by clicking. You can zoom with the mouse wheel. The ratio of haplotype size to edge length can be adjusted in the boxes in the top button pannel.
If you wish to use haploviewer to run phylip, first ensure that phylip is installed. Then use the set phylip path button. Once the path is set clicking run phylip will run it and load the resulting trees. If the program was run from the command line, you will see the progress. Note that its is possible to change the type of analysis by choosing different programs. For example if you use "dnapars" you will get a parsimony result, while if you selected "dnaml" you will get a maximum likelihood method.

Advanced Features

There are a number of features you can use to customize the appearance of your haplotype tree.

You can drag the whole tree around the display as well as haplotype groups. Also, both the legend and scale can be dragged to where you would like them. The colours are editable, by simply clicking on the colour in the legend, as are the labels. That is you can use different, full labels for locations rather than the substrings specified in step 3 above.

If you mouse over an edge, you get information at the bottom of the screen on the locations of the segregating mutations.

Bugs and support

Please email me at gregory.ewing -|at|- univie.ac.at