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.


2 comments:

Eloise said...

llRezObject and the on_rez event have a shared integer parameter value.

You can code bits in that to values using | and & operators, or >> and << if you prefer.

Say, for example, you have B or b as the alleles at a locus, and they are 100%, 75%, 50%, 25% or 0% dominant (you can get more resolution with more bits)

And let's say B=1, b=0

Adding those:

BB=2
Bb or bB=1
bb=0

Which we'll call integer genotype;

Although it's going to sound a bit odd, we're going to convert the 1/4s in those percentages to some powers of 2, so 100% = 64, 75%=32, 50%=16, 25%=8, 0%=4, which we'll call integer dominanceLevel;

You can join these together in mum to with

integer inheritThis = genotype | dominanceLevel;

then in your llRezObject you pass inheritThis as the final parameter.

In the offspring, extracting the genotype is easy...

if you have on_rez(integer p)
{
integer genotype=(p & 1) | (p & 2); //This should give you the 0, 1, or 2 responses.

The dominance levels are a bit trickier but
float dom;
if(p & 4) dom =0.0;
else if(p & 8) dom=.25;
etc.

If you're doing multilocus inheritance, you have 32 bits to play with... 2 bits for your genes and 5 for the dominance level at this sort of % gives you 4 loci you can do at once.

Unknown said...

Ohh I like this....and so compact too.

Way cool!