Red Lynx: A Population Genetics Simulator

| 28 Comments | 1 TrackBack

I’ve been building this simulator off and on for a few months. It is called Red Lynx and is written completely in client-side javascript using jQuery, jQuery UI, and jQuery SVG plugin.

My goal is to host several of these javascript toys and teaching tools on PT and allow our readers to experiment with them. I’ll be back later to explain the model, but I want to give y’all the chance to play with it and try to deduce the model beforehand. (Of course, you can look at the code, but that’s cheating.)

This simulation is inspired by a few Java applets written by Kent Holsinger at the University of Connecticut. Dan Earle came through big time by porting the binomial random number generator from GSL to javascript.

Internet Explorer does not have native support for SVG graphics. You can install Adobe SVG viewer or the Renesis Player to use the simulator.

Update: I’ve made some changes based on feed back that I’ve received and some new ideas I had.

1 TrackBack

A few of you may know that I put together a series of simple simulations to illustrate principles of population genetics. I wrote the code a long time ago (in 1999 or 2000, as I recall), and I wrote it... Read More

28 Comments

Cool and fast!

I agree with TL: it’s cool, and it’s smoking! I like twiddling with the backward mutation slider especially.

I’m delighted to see that you’ve made these simulations available in Javascript. I’ve been meaning to convert mine from Java to Javascript for a long time. Now I can just put a pointer to these pages instead.

Keep up the good work

Reed,

Can I get permission from Kent and yourself to use these simulations as classroom exercises? They are beautiful illustrations of basic population genetics principles. I’m sure that students would benefit greatly from such a great program, (especially future doctors). I assume that that is why you made the programs available for download, but I thought I would ask just to be sure. Thanks in advance.

This is very cool.

OK, I am an English teacher. So what am I looking at?

Looking at the labels of the graph, I am guessing that this simulates the frequency of 1 particular allele among many variants in a population, over generations, based on various properties of that allele, such as how likely it is to be expressed, how much it helps an organism survive, or how rapidly the allele mutates.

If I am correct, I do not understand how the simulation works since I would think it would also depend on the parameters of the competing alleles in that population.

One suggestion, it would be nice to be able to specify a number, especially when concerned at the low end of the ranges. For example, I can not select 2 alleles, initially, because the slider is not sensitive enough. Maybe this does not matter if the mutation rates are high because that will rapidly increase the number of alleles anyway?

I kind of agree with the English teacher DPF - can you define some of the terms, in particular, Mut? As is, it is too much like an in-joke.

Let me see if I’ve got it. Population size is self explanatory.
Initial allele number is the number of copies of that allele in the population. In the initial population of 800 there would be 1600 hundred copies of the gene (2 for each organism), of which 400 are of the allele in question.Allele number expressed as a percentage is the vertical axis.
Fitness is a relative number. It measures the effect of an allele on an organisms reproductive success compared to the average. A fitness of 1 means it is a neutral mutation, a fitness of .99 means it is slightly disadvantageous, and a fitness of 1.01 means it is slightly favored.
Dominance is a measure of how strong the effect of an allele is when it is heterozygous, that is when there is one copy of the allele in the organism. A dominance of 0 means that it is completely recessive and there must be 2 copies of the allele for there to be an effect. A dominance of 1 means it is dominant and that 1 copy of the gene produces the full effect.Something in between results in something in between
Forward mutation is a measure of how often that mutation occurs e.g. 1.000e-6 means it happens 1 time out of a million.
Backward mutation measures how often it mutates back to the original allele.
Generations is also self explanatory. It is the horizontal axis.
The results are randomly generated, using the appropriate and accepted equations. Thus multiple runs for any given setting produces different results. The tendency is towards 0 or 100%.

Well, I see that I got one thing wrong. Allele number seems to be the number of organisms in the population that have the allele since the simulation doesn’t allow a greater number than the population size.

Is there a reason that if you leave the inputs the same and run the simulation a couple of times, you don’t always get the same exact graph? Is that an error, or is it just a way of showing how chance affects the process?

I get a message under the graph: “Error: Your browser does not support SVG. Try Firefox.”

I’m using the latest Internet Explorer in Windows Vista.

But the graph works in the Apple Safari and Google Chrome browsers.

Dave C,

Try running a simulation with pop size at 10 a few times, then change the pop to 30 000.

Then add some weak selection (like fitness ~ 0.98) and fiddle with the population sizes again.

Reed,

Very nice work! Do you one that includes heterozygote fitnesses? Or can I do that by playing the the sliders somehow?

Let me see if I’ve got it. Population size is self explanatory …

Good, thanks! But it looks like dominance goes from -1 to +2. Don’t understand what that means.

The results I get are somewhat Greek to me, but I’ll keep hacking.

I’m going to answer several points in one comment. (I just got in from doing some field work and are tired.)

Population Size: Right now “pop size” = number of genes, while it should equal number of diploid individuals. I’ll fix that bug when I get a chance.

Dominance: [-1,0) = underdominance, heterozygote is less fit than either homozygote. (0,1) = incomplete dominance, heterozygote is intermediate of the two fitnesses. (0,2] = overdominance, heterozygote is more fit than both homozygotes. 0 = recessive. 1 = dominant. 0.5 = codominant. Note that the limit of [-1,2] in this app is not necessarily the full range of the values from the more.

Internet Explorer: I’ve used the Renesis player to get svg to display right in IE.

Teaching: Feel free to use this in class, but it is not bug free or documented. If you don’t want to direct your students to PT, I can stick a version up on its own sub site of http://scit.us/.

Updates have been made.

A great job, Reed. Of course I cannot resist pointing out that if people want a very similar standalone program (just ordinary executables, not Javascript) they can download our program PopG: from this web page. It is designed for classroom use and available for Windows, for Mac OS X, and for Linux.

The two are quite similar (except I have multiple simultaneous populations and allow migration between them as well). I like the curves of changing color. But you really need to add another slider to allow us to change the initial gene frequency and not always use 0.5.

Oops! I just saw that you do have a slider to set initial gene frequency.

0.5 = codominant.

Minuscule nit-pick, but shouldn’t you say 0.5 = incomplete dominance? Since fitness is the phenotype, in the heterozygous state we do not see expression of both phenotypes, but rather see expression of a single intermediate phenotype which is different from either of the homozygous phenotypes.

I don’t think it is a very useful to distinguish between co-dominance and incomplete dominance, but when I see something to complain about, I just can’t help myself…

Good work on including over and under dominance.

This is a nifty little simulator. I notice funny things happen if you only adjust the population size. Right around a pop of 65-70, you can either get complete saturation of the allele or it drops out entirely after only a few hundred generations.

Thanks to Firefox, it works “right out of the box,” but also thanks for linking to Renesis for IE. I thought Adobe SVG Viewer was being abandoned a couple of years ago, but it seems they kept pushing the date back. I might switch to Renesis on my XP partition just so that I have something current. But who knows when I’ll be using IE again on that anyway? :)

Joe Felsenstein said:

The two are quite similar (except I have multiple simultaneous populations and allow migration between them as well). I like the curves of changing color.

I think that I’m going to add a continent and an immigration rate to this population at some point.

Larry_boy said:

Minuscule nit-pick, but shouldn’t you say 0.5 = incomplete dominance?

I was saying that co-dominance was a specific form of incomplete dominance. But you may be correct that it might be better to ignore co-dominance in this model since the only phenotype is fitness.

Reed A. Cartwright said:

Teaching: Feel free to use this in class, but it is not bug free or documented. If you don’t want to direct your students to PT, I can stick a version up on its own sub site of http://scit.us/.

That would be great, Reed.

When you do, could you post the URL here?

Wheels said:

This is a nifty little simulator. I notice funny things happen if you only adjust the population size. Right around a pop of 65-70, you can either get complete saturation of the allele or it drops out entirely after only a few hundred generations.

That sounds like the expected behavior if you don’t have mutation. Try decreasing the length of the simulation (generations slider), if you want to run very low population sizes.

Two questions for Reed-

How many offspring are born each generation? Is there a way that the number of offspring could be included as another variable?

Jeremy Mohn said:

How many offspring are born each generation? Is there a way that the number of offspring could be included as another variable?

The population size stays constant, but it can be varied.

I do have plans to produce a population ecology simulator, that would allow the birth rate to vary, and thus the population size to fluctuate.

Reed A. Cartwright said:

Jeremy Mohn said:

How many offspring are born each generation? Is there a way that the number of offspring could be included as another variable?

The population size stays constant, but it can be varied.

I do have plans to produce a population ecology simulator, that would allow the birth rate to vary, and thus the population size to fluctuate.

OK, thanks Reed.

The reason I asked is that I am thinking of using your simulator in my classroom during a discussion of the rock pocket mouse example of natural selection from Sean Carroll’s book “The Making of the Fittest.” However, I think those calculations assume a constant population size due to predation, so it should work for my purposes. The number of offspring comes into play when calculating the likelihood of the mutation arising in the population, so I can simply adjust the forward mutation slider to get what I need.

Jeremy Mohn said:

That would be great, Reed.

When you do, could you post the URL here?

http://scit.us/redlynx/

About this Entry

This page contains a single entry by Reed A. Cartwright published on March 7, 2009 9:02 PM.

Egnor’s pseudo-logical pseudo-reply was the previous entry in this blog.

Oklahoma’s OK, but not necessarily with evolution is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.

Categories

Archives

Author Archives

Powered by Movable Type 4.361

Site Meter