Adding More Genetics To My Cat Algorithm

Adding More Genetics To My Cat Algorithm

But also running into more problems


4 min read

You may remember, that I followed my Python-Beginners course and then "accidentally" wrote a program for a cat gene algorithm. Yesterday I felt, it's about time to add more genes to this program. Most important the point and the dilution alleles.

Point Allele

Point is the color of Siamese cats. It prevents the development of pigments on the warmer parts of the body and they will only develop on the colder body regions. It's also known as partial Albinism. Point cats always have blue eyes. Point is also existent in different other cat breeds that had somewhere in the past a Siamese cat interfering. Point is autosomal recessive to the wild type of cats, which means, both cats need to be carriers of the point gene to make point babies. That's the reason why mutations like this one can go undiscovered through the generational lines for so long.

felix-mittermeier-X_rJfNo0CdQ-unsplash.jpg Photo by Felix Mittermeier on Unsplash

Dilution Allele

The dilution allele will change the way the pigment on the cat's hair is distributed. While the cat is developing in the mom's womb, the pigment will clump together leaving more space in between the different "clusters". So diluted cats do not have fewer pigments but they are not evenly spread. You could compare it to a cake that has cocoa powder on top or a cake that gets chocolate sprinkles. But since pigments are so small, it will look like a less hue variant of the original color.

milada-vigerova-JLN0U5Rj0gg-unsplash.jpg Photo by Milada Vigerova on Unsplash

A black cat would turn to grey or "blue". The latter is the term used in cat breeding.

The New Code

To put the genes or rather the alleles into my logic was not really hard, because I already had autosomal recessive genes in my logic so I could copy the code and only replace the names. But with adding both new variants I had to face a problem, that certain phenotype (the visual appearance of genetic attributes) combinations get new names. Especially the wild-form genes are usually not mentioned when describing the color. When you say "a black cat" everyone knows that it doesn't have a siamese point color or is diluted even tho black is part or rather the base of black-point and blue coloring. So I had to rewrite the logic a little bit.

When a female cat is tortie or torbie, it means she has red and black color showing in her coat. Tortie is without a tabby pattern and torbie is with. That means when I print out the phenotype, red and black shouldn't be shown. The same goes for tabby/striped for a torbie.

My solution to this was to simply define tortie and torbie with their own logic.

lucky_cat = (( and not or (not and and not male
tortie = lucky_cat and not striped and not diluted
torbie = lucky_cat and striped and not diluted

I then did the same for the diluted version

tortie_diluted = lucky_cat and diluted and not striped
torbie_diluted = lucky_cat and diluted and striped

While "striped" would still be the tabby version of a cat. I defined "striped_pure" as a non-torbie tabby pattern so when it basically has only one color. Those changes are purely to put out the optimized phenotype and won't change anything about the genetic code of the cat and its heritage.

striped_pure = (mother.agouti or father.agouti) and not (torbie or torbie_diluted)

That could probably be solved a little more elegant, but at least it didn't mess with the inheritance code and cleaned up the output.

A printed list of kittens after putting in some very mutation-diverse parents as the source, the code printed this.

['female', 'point', 'shorthair', 'dilluted torbie']

red, black, creme, and blue aren't mentioned even tho they are in the genetic code. The same with tabby. Perfect!

['female', 'torbie', 'fluffy']

Fluffy is my description of long hair ๐Ÿ˜‚ Let me have some fun! But here as well, no mentioning of red and black and tabby and also not that it's not diluted. Nice clean output.

Little Problems On The Way

When adding point, I ran into the problem that there is not only point but also burmese point and mink point. Those are alleles on the same spot as the point allele. The problem is tho, while burmese point acts the same to the wildform as point (being autosomal recessive) when burmese point and siamese point come together they are incomplete dominant to each other. It means they mix. And that is the mink point. A third, different phenotype. So far I only handled boolean-like phenotypes (they either showed the trait or didn't) but now I have to think about how to add a third into it. But I will figure that out next time.

Photo by Erik-Jan Leusink on Unsplash