Showing posts with label genetics. Show all posts
Showing posts with label genetics. Show all posts

Tuesday, July 21, 2009

Mitosis I Wigglies



Animated and wiggly duplicated chromosomes (Reddish wormie things*) scripted to separate and behave as they do during anaphase. The green structures are the paired centrioles, the pink box when touched tells the sister chromatids...those are the wigglies... to separate into unduplicated chromosomes.

*notice the precise biological terminology in this post.

Thursday, June 4, 2009

Particle fun

In building my protein synthesis model, I really don't want to use more prims than needed. At the same time I want to display the results in a more interesting way than than as a string. So I have been playing with a particle system.

Here's the result. The script is modified from a snippit of script that generates a particle banner by Debbie Trilling, part of her Random AV profile script.

I tweaked those settings to give two functions that collectively take a text string and converts it into a string of particles. One could use this to display text messages, but here I am using it to display the one letter amino codes of a proteins primary structure. The colors represent the type of amino acid (non polar, acidic, polar non ionizing etc). Of course you have to put a texture for each symbol.

The two functions I developed to represent the protein's primary structure as a string of particles

particleletter(string texture, float distance, float size)


particlemessage(string message, float distance, float size, float speed)

This system unfortunately does not work reliably in that the individual particles are not always produced so the display will have gaps in it. This is a big problem with long polypeptides such as this one here which is the primary structure of an opsin protein.

Another limitation is that the particles only last for a minute or so.

For the student version I will use a small polypeptide with 10-12 residues, that way the DNA template and RNA will require only 30 or so DNA bases. That is a lot more practical.

Friday, May 29, 2009

What's going on at the lab?

My protein synthesis functions, got me thinking about developing an animated model of protein synthesis that actually does transcription and translation and so I have been trying to figure out a good way to do this. The figure shows a animated prototype for an operon that I have been working on. The model loosely mimics the behavior of the repressor protein and inducer of the lac operon as well as the RNA polymerase.

In the picture the repressor protein (red) is sitting on the operator and the RNA polymerase(purple) cannot attach to the promoter to begin transcription of the operon's coding region (teal). The inducer is the green ball. The can see how the system behaves by touching say the inducer which will then bind to the repressor protein, preventing it from blocking the RNA polymerase.

This view shows the repressor protein not on the operator allowing the RNA polymerase to begin transcription. As the polymerase moves down the coding region the transcript (yellow) grows.










When the RNA polymerase reaches the terminator part of the operon the polymerase detaches, the RNA detaches and the small ribosomal subunit (brown) attaches to the start of the start of the transcript.

Obviously there are some simplifications here. For instance in prokaryotes translation can begin while transcription is still on going and I don't bother with the details of how RNA polymerase works.

The goal is to let the students input a short DNA sequence, animate transcription and show the mRNA in local chat (or perhaps as hovering text above the mRNA) and optionally send it as an e-mail. Then as translation proceeds actually have the tRNA's bring in the amino acids and make a short polypeptide. In this scheme the mRNA is a single prim but carries the codons as data inside. But the development of the polypeptide via translation is explicitly animated in terms of what happens at the ribosome, each amino acid shown as a separate object.

In the foreground are some crude tRNA's (orange rectangles) some of which have amino acids represented by balls attached to them. This is going to be a fairly elaborate scripting effort with some neat tricks involved so stay tuned...

My sabbatical is officially over and have already given my sabbatical report. I will be teaching summer school-just two intro biology lecture sections. Also at the end of July I will be speaking on Science simulations in Second Life at SidLit and giving also giving several local talks about Second Life in general.

Thursday, May 14, 2009

Protein synthesis functions

The chromosome module mentioned previously is part of my JCCC evolution build on the agents of evolution. Mutations are any sort of heritable change in the DNA, that is changes in the DNA passed on to future generations of cells. Chromosomal mutations are large scale rearrangements, involving many nucleotide bases. But a discussion of mutations has to include point mutations-changes on the level of a single nucleotide base.

Discussing these means dealing with protein synthesis first. So the last couple of days I have been scripting core functions to do the basic steps in protein synthesis , namely transcription and translation. Max Chatnoir over at Genome Island has a nice little collaborative game related to protein synthesis, (http://slurl.com/secondlife/Genome/119/144/54) but since my focus is on evolution at JCCC, I've decided to build my module around a series of functions that start with a strand of DNA, transcribe that DNA to get a messenger RNA and then translate that DNA.

Doing this involves a series of string manipulations and here are some functions I've written specifically to manipulate DNA and RNA represented as a sequence of letters:

string stringclean(string toclean, string allowed);

This function takes a string toclean and strips out blanks and any characters that are not allowed after converting upper case letters to lower case. Permissible characters are in the string allowed. For instance DNA nucleotide bases are represented as a,t,g or c so the the string allowed is "atgc". Were the string toclean representing RNA then allowed would be "augc". Just to be safe the function trims any leading and trailing spaces. The reason for this function is to try to catch elementary mistakes and strip out extra characters from genetic information copied and pasted from GenBank or FASTA formatted data.

string compdna(string dna);

This function takes a DNA strand and outputs the complementary strand. This is useful because data bases often give a so called sense strand which is like the RNA only with "t" shown instead of "u". For illustrating transcription you need to start with the complement of the the sense strand as happens in the cell. Hence the need for a function to generate the correct DNA strand.

string transcription(string dna);

This function takes what ever DNA strand is given it and mechanically does transcription. It doesn't recognize any sort of promoter region such as a -35 or Pribnow box. If you don't know what those are..well don't worry.

string transcodon(string codon);

Takes an mRNA codon and uses the standard genetic code table to translate the codon into the corresponding amino acid using the standard genetic code, used by most eukaryotes. This function is needed for the translation function:

string translation(string mrna);

This function takes the mRNA string and using the function transcodon, translates the mRNA into the polypeptide that would be produced in the cell at the ribosome. The function does not recognize the Shine-Dalgarno sequence and mRNA's start for simplicity with the start codon, 'aug'. The function terminates the polypeptide when it recognizes a stop codon. Polypeptides are represented by the now standard one letter abbreviations commonly used in protein data bases. Thus it will allow the student to compare the effects of frame shift mutations caused by insertions or deletions to substitutions on the resulting polypeptide.

These functions work for small genes with on the order of 250 nucleotide bases. One frustrating thing is the limited ability of SL to write data to files and for now the easiest way fo the user to save the output, is to e-mail it to themselves.That will be built into the module as an option. Otherwise users would have to cut and paste from the chat window.

Users will have the option of using data they obtain from another source by configuring a note card with the raw data copied from say NCBI, or using a small gene data set preloaded onto a note card.

Three other core functions are being developed:

string makesubstitution(string dna) makes a random base substitution in an original DNA strand.

string makeinsertion(string dna) makes a random insertion while
string makedeletion(string dna) makes a random deletion.

But these will be easy to make. The activities are being designed around a pencil and paper exercise I use in my classes currently, only now the students will be able to use more realistic data and quickly investigate at a number of different mutations.

Wednesday, May 6, 2009

JCCC Chromosome module

Chromosome Build at JCCC site. This is part of the evolution unit being installed at the JCCC site. It currently includes the human chimp ideograms courtesy of ENSI. You can see two of my real simple viewers, the one on the left with some narrative and the one on the right with the human chimp chromosome ideograms.







On the side directly behind me are some red and blue chromosome, that illustrate reciprical and non reciprical translocations. The four cylinders with the colored horizontal stripes illustrate basic chromosomal rearrangements. Because of their importance, I want to have a separate activity for duplications and the evolution of gene families if I can keep it simple.

On the right hand side of the picture a some of my human chromosomes that link into the Ensemble web site.

The chromosome build is at http://slurl.com/secondlife/JohnsonCountyCommCollege/38/94/65

This is open access but the rest of the JCCC sim is currently not.

Friday, April 3, 2009

The Cami Lab is up!















The Caminalcules
(camis for short) have been safely installed in a Mendelian Genetics lab module called the Cami Lab. I use my note card configurable camis to illustrate dominance relations, monohybrid crosses, and dihybrid crosses. The evolution module will be directly underneath.

I have had to readjust my land and merge several parcels to give me some prim breathing room. Feel free to come and visit Cami Lab currently at:

http://slurl.com/secondlife/Carmine/128/144/136

As part of this, I rescripted my simple viewer to use Erich Bremer's double buffering script which makes loading much faster. My essentially new viewer uses LSL's way cool llDetectedTouchST function. This function detects where on a prim's surface you are touching and returns that as the x and y terms of a vector.

You can then access, these to do things like change a slide or teleport. What is really cool is that the coordinates are normalized to the size of the prim so they are presented as a float between 0.0 and 1.0, so if you stretch, say a viewer, the detected function still works properly.

Wednesday, April 1, 2009

Evolution I: Simulating genetic drift with Caminalcules

So far I been working with my caminalcules in terms of genetics. But of course-and maybe someone ought to tell creationists about this-evolution and genetics are logically connected and evolution follows from genetics. So naturally I want to use my system to simulate the basic mechanisms of evolution.

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) that the recessive allele ought to dissappear over time any way.

By the 11th generation all you have are these caminalcules:

Actually the picture shows the population after 14 generations since I wanted to make sure the other types were eliminated. This nicely shows that the effect of genetic drift is to reduce genetic variation in a population.

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.






Saturday, March 28, 2009

Configurable Caminalcules!















One thing I wanted for my Caminalcules
to is allow for the instructor to configure different genetic systems via a note card rather than a menu system. Turned out to be pretty easy and so in amongst Best Practices Workshops, I've been squeezing out time for this.

So here is an example of a pair of Caminalcules who have indulged in a little bit of dihybrid Mendelian interaction. I'm making little activity pens or corrals (as Max Chatnoir suggests) for them partly to keep them in but because when the pups are "born" sometimes they don't end up right side up. Visitors can move them around with fear that they are going to escape!

I need to give them some sort of movement but that will need to wait and I will probably introduce that option in a couple weeks when I script my Caminalcule evolution activity.

Friday, March 27, 2009

Caminalcules Spotted at Genome Island!

No need to panic. I sent Max Chatnoir a pair of them for her to break as a beta tester, which she very nicely did in about 1 minute. So made some changes based on her feedback. The Caminalcules can now do various modes of inheritance and can either mate with each other of self fertilize as any proper organism for genetic studies ought to be able to do. Did I mention they also do linked genes? The picture show Max with her first brood. There had been a problem with permissions which caused a bit of grief until I tracked the problem down.






This coming week will see lots of frantic designing and building for the Caminalcule project including plans for a build on Genome Island once the prototype build is finished at Carmine. But a good part of today and Saturday I will be at the Virtual World best Practices Conference. Oops! Starting in about 10 minutes.

Saturday, March 21, 2009

OpenSim and INTEL's ScienceSim

A group from INTEL has been busy setting up a virtual world called ScienceSim using OpenSim and so over the last few days I took a little look. First about OpenSim: OpenSim can use a scripting language based on lsl and indeed you can use the standard SL viewer for OpenSim sites. However OpenSim is not centralized as is most of SL but is run on servers owned by different people and groups.

According to the OpenSim wiki, OpenSim:

  • Supports creating multiple 'worlds' in a single application instance.
  • Supports multiple clients and protocols - access the same world at the same time via multiple protocols.
  • Extensive ability to customize your avatar, both with custom clothing, skins, and attached objects.
  • Realtime Physics Simulation, with multiple engine options including ODE, PhysX, Bullet and more.
  • The ability to create content real time in the environment using in world building tools. What you see is what you get.
  • In world application development using a number of different languages, including LSL/OSSL, C#, JScript and VB.NET

You can have your own virtual world offline on your own computer or link a server so that people from the outside can visit. Plus its free and you don't have to pay $L to anyone. So let's see, I am at the $40/month tier so that means I pay $480 + $88 or $568/year so maybe it would pay to use my tier money and get my own server and load OpenSim. Also OpenSim has some really cool extensions to LSL. Check these out.

Of course the flip side is I have never run my own server and OpenSim is buggy at least when using the current SL client so it would be very difficult to bring freshmen or sophomore students into an OpenSim region. For example I had great difficulty teleporting and my avatar sometimes would not be easily controllable. How much of that is due to problems with the software vs the servers and connections is not clear to me. As an alternative to the SL viewer you can use a viewer called Hippo.

First getting there- You need to set up an account via the ScienceSim adminstration page. But read these instructions and follow them carefully. You will need to make another copy of your Second Life shortcut, rename it and change the target. Remember that OpenSim is not Second Life so that you need to register a new avatar. ScienceSim prefers that you use your real life name for your avatar; I chose to register Simone again since I am not working in ScienceSim's grid but did register with my carbon based world name.

When you open the log in page, the left hand side has a list of regions run on private servers linked to the ScienceSim grid but I recommend just logging in. It may look at first like you are going to Second Life but you are not!










When you first launch your viewer to enter ScienceSim, you get a default female avatar which you can customize just as in Second Life. But while visiting ScienceSim decided to keep things simple. So here I am rezzing at ScienceSim's orientation site which serves as your default home.

There are four regions in the main ScienceSim grid Galileo, Kepler, Newton and Einstein, the world map is shows just those four regions. However there are currently 46 regions in total as shown here, which is a bit confusing. But it makes sense when you consider that these other regions are not really set up for the most part for public display but used for visualizing scientific data.

Here are some various screen shots I took on my first visit:

Einstein Region














Kepler Region














Newton Region. This shows part of the amphitheater. There also an observatory build in ScienceSim from where you can teleport to some of the other regions connected to the grid.











There is kind of a fun marble launcher and several other goodies like that in the main grid but right now there is not a whole lot to see.

Since I am a biologist I was particularly hot to see some of the biology being done there and sent an inquiry to the site master and got a nice response inviting me to the user's meeting on Friday. Unfortunately people got really confused as to what time the meeting was so it really didn't happen as scheduled.

However I did find a friendly group of users and they invited me to join their discussion and then later on met some other users at the amphitheater. They use Skype for much of their conferencing so I had to download and set up skype on my machine but that was pretty painless and the sound quality was excellent, much better than SL's voice.

One of the people I met is Aaron Duffy who a grad student using OpenSim to simulate the population genetics of ferns and since some of my training is in population genetics, was interested to see that. So today I went back and he graciously gave me a tour and demo of his work which is just starting. His project superficially resembles the ecosystem working group effort in Second Life, in fact Aaron got onto his project from exposure to that group.

This is Aaron and in the back ground are shown the 3 basic stages of the fern life cycle. The tall structure that is not entirely in the frame represents a sporophyte. The upside down "hat" to the left of sporophyte stem is a gametophyte and the brown ball partially hidden by Aaron is the spore which of course is produced by the sporophyte. Guess what gametophytes produce. Hmmm.

His simulation tracks the details of the genetics of the population as the population evolves over time. So for me this was really neat to see. Right now he is working on interpretative slides to make his project more understandable to non population genetics geeks.

Thursday, March 5, 2009

Caminalcules III Colorful pups...
















This week I implemented a version
of Eloise Pasteure's suggestion to get genetic data into the Caminalcule's offspring, representing the genetic data as a 7 digit integer. This integer has two positions for each locus or allele pair, a dominance term which is 1 position for each locus and an extra flag telling the program whether to process one or both loci when making the phenotype of the offspring. It's a little less compact than what Eloise suggested but easier for me to keep track of.

This version of the Caminalcule will illustrate Mendel's two laws and does not do linkage...yet. The second locus, by the way, has to do with the type and number of black spots on the critter and I just got that implemented today.

Yet to do are some fixes to the menu system- I've had to think carefully how the lldialog function works-and think out the mechanics of Caminalcule mating. How will they communicate and behave? Right now they can detect each other with sensors but I haven't given them an sort of movement. What happens if two encounter each other and they are genetically incompatible? What sort of reproductive system? We already know that some of them are hermaphroditic. Is there also a non hermaphroditic gender? Hmmmm. Stranger things than this happen in nature. You might look up the life cycle of Caenorhabditis elegans, one of the major organisms in modern genetics.

Lots of potential here for getting students thinking about life cycles and gender that go beyond genetics and collaborating with each other. I've also been to several interesting workshops related to Second Life and I will post more on those later.

Thursday, February 26, 2009

Caminalcules II: Mother and her pups

Continuing along with my Caminalcule genetics activity...

Here is a heterozygous Caminalcule mother with 10 of her pups produced by selfing under incomplete dominance. The maternal script produces two gametes at random, the "pup" is rezzed and the genotype along with the degree of dominance communicated to the pup and the pup then changes phenotype.

This is of course not the way it works in the real world; the pups should be rezzed with the genotype in place but there doesn't seem to be an easy way to do that save maybe with some really clever use of llSetPrimativeParams. But my approach seems more flexible.


Here notice that roughly half the "pups" have the heterozygote's phenotype (grey) and roughly half are one of the two phenotypes (black or white) of the homozygotes.

Right now I represent a gene's locus with an SL vector type. The third position is not currently used but it could be used to store some other type of float type information related to the gene say something about its linkage position along a chromosome.

Coming up soon...Caminalcules make nookie.