Monday 18 January 2010

SEED SWAP DATABASE

KorganIconFor the last 4-5 days I've been writing a database program. As much as I try to get away from geeky blawgs, it's not happening.


It's a database that manages seed swapping, and it does it in a clever way. Let's say you have a box that you keep all your seeds in. Let's say it has two sections. The first section is your keep section. It contains all the seeds you aren't going to swap; they're for you. The second section is your swap section.

Now the goal is to get as many varieties of seed in your keep section as possible and hold as many of each as possible. You can only hold so much of each type of seed in either section. If your keep section is full of that type of seed, it goes into your swap section.

So I came up with this. Every seed has a value. I invented a currency called the U. Every seed in my keep section is worth 1U, but the value of seeds in the swap section changes. Let's say I add a tomato seed to my collection. The value of that tomato seed is less than any other tomato seed in the collection. The same happens with the next tomato seed I add. So, the value drops.


This works out awesomely two ways: if you come to me with seeds and I don't already have that variety of seed, then they are worth a good amount to me. You can get a lot of swap seeds in exchange. This encourages growth in my keep section and discourages growth in my swap section. It's great for someone swapping seeds with me because they usually get a lot more seeds than they gave.

Well I wrote a program that manages all of that stuff. You can create a database for seeds, add seeds to it, save and load databases to/from files. It will automate a swapping transaction, and issue credit if you have credit left over after a swap. And a few other nifty tricks.

It's not pretty though. It's all command line stuff. But it works.

So, if you have seeds that you want to swap, come to me and get them valued. If I have swap seeds, you'll get a very good deal. If I have nothing you need, leave your seeds and I'll issue you with credit. You can come to me later, bring your credit, and maybe pick up something you need then. Neat, huh?

Friday 8 January 2010

House Cider Rules

KorganIconI'm making up some cider and I thought I'd blawg it.

Here's a picture of what I have happening right now.


On the left is a bottle of water. On the right is a jar of apple juice, cider yeast and a tablespoon of honey. The jar is sealed closed and connected to the bottle of water with some 8mm aquarium tubing. The tubing is submerged in the water but not submerged in the apple juice. This makes an airlock; carbon dioxide from the yeasty apple juice can get out but oxygen can't get back in. Everything is sterilised before use. I got the juice by blending apples thoroughly and straining them with a piece of very fine mesh.

It's not a fancy setup. But it works.

Monday 4 January 2010

Virtual Plant Breeding Project

KorganIconThis blog is about my virtual plant breeding program. If you don’t know about Mendelian genetics, read my previous blog which explains the basics in an easy-to-read way.

The last frame of the animation on my previous blog is very interesting. It summarises all six rules of Mendelian genetics. This illustration explains why a child may have red hair even though its parents don’t but its grandmother does, it explains how hybrid seeds are made and why garden centres make money from selling F1 seeds, and it explains how to make a true-breeding plant from a hybrid.


Let’s say I breed together a red and a white plant and I get a bunch of hybrids. If I produce thousands of children from these hybrids, then I know I will get roughly 25% homozygous dominant plants, 25% homozygous recessive plants, and 50% heterozygous plants. So in this case, the majority of plants are heterozygous. But what if I make another generation from this one? What will the proportions of the second generation be? This was the question I had. What is the proportion on the 1,000th generation? And the 10,000th generation?

So I wrote a program that simulates this. Then it spits out the figures and I graph it and see the results. I took two heterozygous plants and made 1,000 children from them. Then, I made a 2nd generation by randomly mating members of the 1st generation. I did this for the 3rd generation, the 4th and so on. I simulated up to 10,000 generations. I recorded the proportion of homozygous dominants, homozygous recessives and heterozygous plants in each generation and plotted the results.

Here is a sample of the graphs. (click on them for larger image) In these examples, homozygous dominant eventually overthrows the others:


Well, does that always happen? Nope. Sometimes homozygous recessive won, as shown here:


So far, I've figured that the meek MIGHT inherit the Earth. But it's not certain. So I repeated this entire experiment 500 times. The figures settle down at around 50% each way. That is, out of the 500 experiments, homozygous dominant plants took over in 48.1% of cases, homozygous recessive plants in 51.9% of cases. Hybrids can never win.

I haven't included mutations or competition or any other environmental factors in these simulations. So what?

I've learned some useful things in all this. Maybe you read this stuff and use it.

The Basics on Plant Breeding

KorganIconI’m going to explain how Mendelian genetics works. I’ve been reading on it for a few weeks now and I’ve done my own work on it and produced some things.

But this blog is just to lay down the basics so you can understand my next blog about my virtual plant breeding project. If you already know how this stuff works, you might want to skip it. If you want to learn how plant breeding works, keep reading.

These are the basics. Let’s say I have a red-flowered plant that is true breeding. This means that if I breed this plant with itself the seed will produce red-flowered plants that are also true breeding. The same goes if I breed any of these plants together. I will always have red-flowered true breeding plants.

Let’s say I have a white-flowered plant that is true breeding. I know that if I breed it with itself, the seed will always give me white-flowered plants that are also true breeding.

Let’s now say I breed the red-flowered plant with the white-flowered plant. What will the seeds produce? The seeds will produce hybrids. This means that each child contains a red gene and a white gene. This is where the issue of dominance comes in. What colour are the flowers? Which gene wins?

We can say that a gene can be dominant or recessive. If the red gene is dominant then all the children would be red. In this case, the white gene is recessive. If all the children are white, then the white gene is dominant and the red gene is recessive.

Let’s say for this example that the red gene is dominant. So all the seeds from our hybrids produce red plants but hybrids are not true-breeding. So what happens when I breed two hybrids together?

There are three possibilities. A new plant could take one dominant gene from both parents, or it could take one dominant gene from one parent and one recessive gene from the other, or it could take a recessive gene from both parents. This is what punnet squares are for: to show the possible combinations without having to write a long awkward paragraph like this.



In a punnet square diagram you use letters to represent the genotypes. In this case, since my dominant genes are red, I’ve used an uppercase R to represent it, and a lowercase w to represent the recessive white genes. (Most people would write this using an uppercase R and a lowercase r but it’s more confusing that way.)

Along the top are the hybrid genes from one parent, along the left side are hybrid genes from the other parent. The middle 4 cells contain the possible combinations of genes from the two parents. As you can see there is RR, Rw, Rw and ww. RR is a plant with two dominant red genes. Rw is a hybrid with a dominant red gene and a recessive white gene. The ww is a plant with two recessive white genes. RR and WW are our true breeding plants. Rw is a hybrid.

So when we breed two hybrids together we get 25% RR plants, 25% ww plants and 50% hybrids. The larger the number of plants we have the more accurate these figures will be. You might breed two hybrids together and get all true-breeding red plants, but it’s not as likely with a larger sample size.

Homozygous means a gene is true breeding. Heterozygous means a gene is a hybrid. In this example, we'd call RR a homozygous dominant gene, ww is a homozygous recessive gene, and Rw a heterozygous gene.

Now. We know what happens if we breed our red-flowered true-breeding plant, the RR (homozygous dominant) with itself. We know what happens if we breed our white-flowered true-breeding plant, the ww (homozygous recessive) with itself. And now we know what happens when we breed two hybrids together, the Rw. So what happens when we breed a hybrid with a true-breeding plant?



If, as in the diagram, our true-breeding plant is homozygous dominant, RR, you get 50% RR and 50% Rw. So all our flowers are red, but only half of them are true-breeding. If we had used the homozygous recessive plant, ww, as the true-breeding plant, then we'd have 50% ww and 50% Rw. Half of them would be red, the other half white.

Now you know all the rules. The last couple of things to mention are these. Sometimes a dominant gene isn’t very dominant. Maybe this is down to self-esteem issues. Let’s say that our red/white hybrid’s dominant red gene isn’t very dominant at all. The resulting flower will come out pink. So, sometimes hybrids can be three colours instead of just two. This is very useful because it makes the true-breeding plants easy to identify.



Lastly, when you breed together two true-breeding plants to produce a hybrid, those hybrids are called F1. If you go to a garden store you’ll probably see on the packet that they are F1 seeds. They are hybrids. There’s such a thing called ‘hybrid vigour’ where F1 plants will be more ‘vigorous’ than the parents; the plants from F1 seeds will be stronger or faster or sexier. F2 seeds are seeds from an F1 generation. As we’ve seen when we breed together two hybrids, 50% of the children will be hybrids. So half of F2 seeds will be hybrids. This is why, when you keep seeds from the plants you grew from F1 seeds bought at a garden store, they don’t turn out looking much like the first generation of plants. You have a 1 in 2 chance of getting plants that have the same trait you're looking for.

I also learned about backcrossing and how to use it to maximise the number of true-breeding plants in a generation. This is useful when you have one awesome true-breeding plant and you need to produce more but the plant can’t breed with itself. Some plants won’t. Cannabis is one excellent example. Here is my backcrossing blog.

Now you know how plant breeding works, read my next blog to understand what I did with this stuff.