Yesterday and today I programed a prototype Evolver (pink square) that simulates genetic drift. Genetic drift is an agent of evolution where a population's genetic make up changes due to sampling error. Drift is particularly important for small populations, such as caminalcule populations which given the prim limits in SL can never be very big.
Genetic drift is actually easier to simulate than natural selection, so it makes a good starting point for scripting and probably also for students to play with.
To look at populations of caminalcules I treat the population as a list containing the genotypes of all the individuals in the population. I use the same phenotype routines developed for genetics crosses and simply can access the approriate caminalcule through the list index.
Next I had to write a series of population functions:
string randommating(list the_pop) chooses two individuals from the population at random to mate and produces one offspring.
initialise(integer popsize) produces an initial random population and stores it in a list called start_pop_list and returns that list after rezzing an offspring:
Here's a snippet form this function:
start_pop_list = start_pop_list + genotype;
pass2offspring = (integer)genotype;
llRezObject("bigpup",llGetPos()+<2.0-llfrand(4),2.0-llfrand(4),0>,<0,0,0>,<0,pi/4,0,0>, pass2offspring);
}
while (++icount
return start_pop_list;
Most of the other routines are functions made before for the Caminalcule genetics module. So there is nothing new here. The simulation is direct in that I do not calculate allele frequencies and sample from that.
Doing random mating is pretty easy and here is the new function that handles that:
string randommating(list the_pop)
{
integer index;
string organism1;
string organism2;
string thezygote;
string gamete1;
string gamete2;
integer pop_size = llGetListLength(the_pop);
index = irandom(0, pop_size-1);
organism1 = llList2String(the_pop,index);
gamete1 = make_a_gamete(organism1);
index = irandom(0, pop_size-1);
organism2 = llList2String(the_pop,index);
gamete2 = make_a_gamete(organism2);
//----pick 2 organisms at random to mate from the_pop, self mating allowed----
//list the_pop must have been checked!
return make_zygote_string("4",gamete1, gamete2);
//4 because we assume independence here
}
Well so what happens with genetic drift? I want to write routines to quantitatively track what happens, but for many situations running the drift script for for a number of trials ought to get the idea across so here are some pictures from two sets of runs.
My first run started with a population that looked like this:
Four generations later...
Notice the pink and green phenotypes are becoming more common. The the genes related to the white caminalcules have apparently been eliminated. Since the genes related to the white photype are recessive the student might think (as did some geneticicts in the early 20th century)
By the 11th generation all you have are these caminalcules:
Now consider a trial starting with this population:
Not very different than the starting population from the previous run. But look what happens now! This is at generation 10. Note the large number of white caminalcules. Remember white is recessive.
And by generation 15:
Only the white caminacules are left and it looks like only one type of spotting! This illustrates two points. First of all as I noted earler, recessive alleles are not eliminated just because they are recessive, but evolution is strongly contingent. Just because you get one result one time, the chance elements in evolution such as genetic drift may cause completely different out comes the following time. This can lead students and teachers into all sorts of interesting avenues of thinking about how evolution works!
If you want to see how this works, look for me in world.
Hopefully later this week I will have worked through natural selection.
No comments:
Post a Comment