Population to Population Genetic Distance Calculator

This calculator gives various measures of distance between populations.

If you want to calculate the Dlr distance measure (a.k.a. assignment test) used in Paetkau et. al. (1997)'s Genetics paper, then follow this link.

New - avoiding the clipboard with local load/save

The Virtual Clipboard for large datasets

Note on multi-page text windows

(Click here to go to the individual-level genetic distance calculator instead)

Changes in Rst , Dsw and Dmu

This program used to ask for allele lengths as number of repeated units, rather than number of base pairs. Unfortunately, Dsw and Dmu treated allele lengths as number of base pairs, while Rst treated them as number of repeated units. The program now expects allele lengths as number of base pairs, and these distances all treat them that way. Also, you can now enter different size of repeated unit values at each locus; if you enter only one number in this box, it is used for all loci. Otherwise, you must enter one number for each locus. If anyone can independently calculate Rst for their data, I'd appreciate seeing the results: this program extends Slatkin's 1995 formula to multiple loci, and the results haven't been independently verified yet!


Input Format:

Field Format
Size of unit repeated in alleles a single number for all loci, or one number per locus.
Number of alleles the number of alleles at each locus (i.e. one number per locus).
Allele state (number of bp) in this order:  L1A1 L1A2 ... L1An L2A1 L2A2 ... (i.e. allele within locus)
Allele frequencies or counts in this order:  L1P1A1 L1P1A2 ... L1P1An L1P2A1 L1P2A2... L2P1A1 L2P1A2...
(For each locus, list data for each population; for each population, list frequency of each allele at that locus;  i.e. allele within population within locus)

You should be able to copy and paste in and out of these windows, and your browser might support a Select All function (under its Edit menu) that selects the entire contents of whatever field you are in.

The sample data for bear populations is from Petkau and Strobeck (19xx).
Click "Calculate!" to run this example, or "Clear Inputs" to enter your own data.

You need a Java-enabled browser to run this program. Perhaps your browser has Java disabled? 

Note on Nei's Ds:

This applet uses a simple estimate of homozygosity at a locus, namely
H = the sum over all loci i of Xi2
where Xi is the frequency of allele i in the population at the given locus.
The gnkdst program (in the dispan package available at http://iubio.bio.indiana.edu/IUBio-Software+Data/molbio/ibmpc/) uses an unbiased estimator of homozygosity, namely
H' = (n*H - 1) / (n-1)
where n is the number of individuals in the population. As a result, this calculator gives a larger value for Ds than does gnkdst. Thanks to Alan Redd (ajr4@psu.edu) for pointing out the discrepancy.

How to Read/Write Files on Your Machine

The virtual clipboard was a clunky work around for the security that Java-enabled browsers impose (with good reason!) on web-programs. Provided you trust that you are getting an unmodified copy of this program from our website, you can save a copy on your machine so that data can be read from or written to files directly on your machine, without going through the network and virtual clipboard. This procedure only works for Netscape browsers.

Here's how:

The VC buttons should be replaced by Load and Save buttons which will operate directly on your files. Note: Your browser will ask you to grant permission to this "unsigned" applet, and you'll have to agree to this for it to work.

Virtual Clipboard (for large files)

The Virtual Clipboard lets you paste data into or copy data out of multi-page windows. The ---> VC and <--- VC buttons move data to and from the virtual clipboard. If you see a "Browse" button below, then your browser will also let you copy a file on your machine to the Virtual Clipboard. You can then paste it from the V.C. into the calculator's input windows.

Name of file:

Note: if you get a "Save As..." dialog box when viewing the virtual clipboard, it is because the data there is in a binary format (e.g. a PICT file saved from TreeToy). You should specify an appropriate name (e.g. myplot.pict instead of viewclip.php) before saving it.

The Virtual Clipboard is Brainless

Is your window full of garbage after pasting? Unfortunately, the Virtual Clipboard knows nothing about file formats, so cutting and pasting directly from an Excel file will fill your window with junk (ie. raw Excel file bytes). You can, however, copy from the open Excel worksheet to a text editor, then save as text in a new file which you can then copy to the Virtual Clipboard. You can also just save a copy of your Excel file in tab-delimited text format, and copy that file to the VC. The point of the VC is just to help work around the limitations on window size in Netscape, MS Explorer, and probably other browsers.

(back to top)

Note on Pages

Some browsers limit the size of text windows, so this program allows for bigger input and output using multiple pages. Each page is limited to around 10000 characters. To see if you have filled a page, try typing more characters at the end of the window. When you copy/paste in and out of this program, you have to do so one page at a time; the program has no control over cut/paste, and so can't tell when your input is bigger than one page. Use the Virtual Clipboard above to copy/paste large files.

(back to top)

This calculator is by John Brzustowski - feel free to send me comments or questions. The source code for this free software is available here