PopG genetic simulation program
This is a one-locus, two-allele genetic simulation program for use by
students. Earlier versions were called Simul8.
At our distribution server
evolution.genetics.washington.edu in directory pub/popgen
there are archives that can be fetched for Windows, Macintosh and Linux or
Unix. These contain documentation, source code, and (for Windows and
See below for links that will enable you to fetch the archives.
The C source code is provided,
which can be compiled with the Makefile to produce executable versions for
most workstations that have X windows, as well as the CygWin compiler on
Windows. A project file is also included which can be used to compile
executables for Macintosh using the Codewarrior compiler.
However, most people using Windows or Macintosh will not want to recompile
the program -- all they need to do is to use the executable that we supply.
You can fetch PopG using the links below.
- For Windows: win.exe
A self-extracting WinZip archive containing the files of the Windows version for Windows 95, 98, NT, 2000, me, xp, and as far as we
know all other recent versions of windows.
- For Macintosh:
popgmac.sit Macintosh version which can be run on all PowerMacs and later
Macs, running under MacOS. It is a Stuffit archive which should be unstuffed
as it is transferred; if not, you could use Stuffit Deluxe to unpack it.
- For Linux or Unix: popglinux.tar.gz Linux and Unix version, as a Gnuzip'ed tar archive of
the source code and documentation. The executables can easily be created from this (see below).
The documentation files are included in the fetchable archives, and consist
of this web page. The latest version of it can be read on the Web
using this link.
Unpacking the archives
After fetching the archives for Windows, for Mac, or for Linux/Unix, you need
to unpack them. Do this:
- For Windows
- Make sure the popgwin.exe file is in the directory where you want
the program to be. The click on it. It will run and unpack itself into
a set of files, including this documentation file, the source code files, and
the PopG executable.
- For Macintosh
- When the file popgmac.sit was downloaded, it should have
been unpacked into the component files (documentation, source code, and the
PopG executable. Make sure these got into the desired directory.
If the popgmac.sit archive was transferred without being unpacked,
you could unpack it using Stuffit Deluxe.
- For Linux or Unix
- Put the popglinux.tar.gz file into the directory where you want
the program to reside. If your system has the Gnuzip program for unpacking
.gz archives, you can run it by typing gunzip popglinux.tar.gz, after which you use tar xvf popglinux.tar
Running the program
To run the program on Linux or Unix systems you should simply type popg
while in the proper directory.
On Windows or Macintosh systems you simply click (or double-click) on the
program icon. The Macintosh version is for PowerMac systems and will not
run on older 68k Macintoshes. You can download an older 68k Macintosh
version from our web site if you have such a system.
The program uses a random number generator. It should give you a different
result every time it is run.
The program opens a window, and there are three menus that you can use to
control it. On Windows and Linux/Unix systems the menus are in the upper
left of the main window. On Macintoshes they are in the upper left of your
desktop window. The windows are File and Run. Most of their menu items
can selected using the mouse or else (in the Windows and Macintosh cases) by
typing the appropriate character on the keyboard. On Windows systems
these are Control characters such as Control-C (holding down the
Ctrl key while typing C). On Macintosh systems they are
Command characters such as Command-C (holding down the Command key while typing C.
The Run menu
This contains four menu items, Continue, Continue w/, New Run, and Restart.
- New Run (Control-N or Command-N)
- Initially only New Run is available. It brings up a box with
parameter values that can be changed, marking then with the mouse and using
backspace and/or delete keys, and typing modified values in. When these are
given the desired values, clicking the OK box will dismiss the
parameter values and start the run. If at any point you want to restart
the run with different parameter values, you can select New Run
and you will be given a chance to change the parameters.
- Continue w/ (Control-C or Command-C)
- This choice continues the run, for the same number of generations as
before (which is shown in the menu).
- This continues the run, but presents a box allowing the user to first
change the number of generations run in the continuation of the run.
- Restart (Control-R or Command-R)
- This restarts the run with the same parameter values as before..
The File menu
This contains four menu items, which may not all be available. They are
Save, Print, About and Quit.
- Quit (Control-Q or Command-Q)
- This is self-explanatory: the program quits.
- Print (Control-P or Command-P)
- This sends the present image of the graph to the system's print queue.
On Windows and Macintosh systems it will present the user with a "print box"
in which various options can be selected. On Linux or Unix systems it will
send the graph to the system's lpr printing command.
- Save (Control-S or Command-S)
- This saves the graph as a Postscript file, allowing the user to
select the name of the file (the default name is output.ps.
- About (Control-A or Command-A)
- Displays the program's copyright notice.
Compiling it yourself for Linux or Unix
For Linux or Unix we do not supply an executable program, but you must
compile the source code yourself (for Windows and Macintosh this is
not necessary as you can simply use the executables we supply).
If you want to compile the program yourself on Linux or Unix, instructions
are as follows (if, not, you can skip this section).
Download the popg.tar.gz archive using the link given above in the
section on Getting PopG. Using the Gunzip archive unpacking program you
can unpack it (by the command gunzip popglinux.tar.gz followed by
tar xvf popglinux.tar). This will
create a directory called popg in your current directory.
Go into this popg directory. Type make which will
cause the system compiler to compile the program, creating an executable
called popg. If this does not work, try to modify the
compiling command and switches in the Makefile which controls the
The resulting executable (popg) can display on any X terminal or X-capable
Compiling the program for Windows or for Macintosh
This will generally not be necessary, as we have supplied the
already-compiled executables for these systems, and you can simply
run those. Only if you want to modify the program somehow
should you attempt this.
We have not provided here the detailed steps for these compilations
as in general you should not do them.
- We supply a Makefile which can be used with the Cygwin Gnu C++
compiler, which is a Windows port of the Gnu C++ compiler. The
Makefile in the Windows distribution is called Makefile (the
Linux/Unix Makefile is called Makefile.unix in that distribution).
- We supply a project file for the Metrowerks Codewarrior 7 compiler.
You can run the compiler and load this project file to prepare for
compiling the programs.
Simulating with PopG
This program simulates the evolution of random-mating populations with two
alleles, arbitrary fitnesses of the three genotypes, an arbitrary mutation
rate, an arbitrary rate of migration between the replicate populations, and
finite population size.
The programs simulate eight simultaneously evolving populations with you
specifying the population size, the fitnesses
of the three genotypes, the mutation rates in both directions (from A
and from a to A), and the initial gene frequency. They also ask for a
migration rate among all the populations, which will make their gene
frequencies more similar to each other. Much of the time (but not always!)
you will want to set this migration rate to zero. In most respects the
program is self-explanatory.
When you make a menu selection that causes the program to run,
a graph of the gene frequencies of the A allele in each of the
populations will be drawn in the window. Note that the window can be
resized, and the graph should adjust to this.
There will also be a dashed curve that shows what the
gene frequencies would be in an infinite population (one with no
genetic drift). The graph can be printed using the Print
option of the File menu, or saved to a Postscript file using
the Save option in that menu.
Note that once the plot of the gene frequency curves reaches the
right-hand side of the graph, the program prints there the number of
populations that fixed for the A allele (ended up with a
frequency of 1.0) and the number that lost this allele.
The program can simulate a wide variety of cases, and you should
explore some of these. Here are some suggestions:
You should be able to use the program to get a good feel for the
relative strengths of different evolutionary forces. It is worthwhile
trying many different kinds of cases and asking what values of
parameters are needed to make one evolutionary force be influential in
the presence of another.
- Try cases with no mutation, no migration, and all fitnesses 1.0 so
that there is no selection. Does genetic drift in a population of
size 1000 accomplish roughly the same changes in 1000 generations as
genetic drift in a population of size 100 does in 100 generations?
By running a largish number of populations, can you check whether
the probability that an allele is fixed by genetic drift is equal to
its initial frequency in the populations?
- Try a case with no mutation or migration, with the A
allele favored by natural selection (with fitness of the AA
genotype set highest and fitness of the aa genotype set
lowest). Start with a small frequency of A. Is it always
fixed? If one starts with a single copy of the allele, how does
the probability that A is fixed compare with the selection
coefficient favoring it in the heterozygote (compared to the fitness
of the aa genotype? Is this fixation probability larger than
the one you would get with the same initial frequency with no
- Try overdominance (Aa having the highest fitness). Does
the gene frequency converge towards an equilibrium? Why does it
vary from this equilibrium frequency? How large do the selection
coefficients have to be to cause the gene frequency to stay away from
fixation or loss for large amounts of time?
- Try underdominance (Aa having the lowest fitness).
Is there a starting gene frequency that will result in some populations
heading for fixation, and others heading for loss? If you add a small
amount of migration, what will happen? if you add a small amount of
mutation in both directions?
- With migration but no selection or mutation, how much migration is
needed to make the gene frequency curves be quite similar to each other?
How much is needed to make them all end up at the same gene frequency?
- With mutation but no migration or selection, how much mutation is
needed to cause the gene frequencies to converge on a mutational
equilibrium gene frequency? How does this value relate to the
- If an allele is selected against, can you set up mutation rates
that will maintain it at low frequency in the population?
PopG was written by Joe Felsenstein, Hisashi Horino, Sean Lamont,
Bill Alford, Mark Wells, and Mike Palczewski. I wrote the original
version of the program. Hisashi and Sean did the screen graphics for
IBM PC and the first part of the Postscript printing system. Bill
greatly improved and expanded the Postscript printing and
the X windows graphics. Mark Wells did the
original Macintosh version. Mike Palczewski greatly improved the Windows,
Macintosh and X Windows graphical user interface.
Copyright 1993-2002. University of Washington and Joseph Felsenstein. All
rights reserved. Permission is granted to reproduce, perform, and modify
this program. Permission is granted to distribute or provide access to this
program provided that this copyright notice is not removed, this program is
not integrated with or called by any product or service that generates
revenue, and that your distribution of this program is free. Any modified
versions of this program that are distributed or accessible shall indicate
that they are based on this program. Educational institutions are
granted permission to distribute this program to their students and staff
for a fee to recover distribution costs. Permission requests for any other
distribution of this program should be directed to firstname.lastname@example.org.
| Joe Felsenstein|
Department of Genome Sciences
University of Washington
Seattle, WA 98195-5065, USA
email: joe (at) genetics.washington.edu