I'm working on this project to calculate genes inheritance and the chance of getting a specific outcome.
Each male and female have 2 blocks that represent the gene mutation.
There are 2 types of gene mutations, Dominant(D) and Recessives(R) beside the Standard (W).
For the dominants ones to show, you only require 1 of the 2 blocks to be in the child genes. If 1 block is present, you have a Single Factor, if 2 then Double factor
For the recessives to show, you require both blocks to be in the child genes to make the mutation visual.
If only 1 block is present, the child is split for that mutation. On 2 blocks, the mutation is visual.
On paper I am able to calculate the percentages, however I can't figure out how to write it to code.
Let's say we have a male RR, where each R is a block and stands for recessive. And we have a female WW where each W is a block and stands for standard.
if you would combine 1 block of the male and 1 block of the female, then all blocks will be RW. Which means the child will be 100% split to the mutation.
Next example: in case the female is split to the mutation and the male is fully mutated, the children would have 50% chance of being exactly the same as daddy and 50% change of being exactly the same as mommy.
(2 times RR and 2 times RW.
Total is 4. 2 out of 4 is 50%)
Additionally the following: Male is RW and female is RW.
The output on this would be 25% RR (visual Mutation) 50% Split and 25% standard. Problem is that WR and RW is basicly the same.
Anyone a idea on a logic approach?
Each male and female have 2 blocks that represent the gene mutation.
There are 2 types of gene mutations, Dominant(D) and Recessives(R) beside the Standard (W).
For the dominants ones to show, you only require 1 of the 2 blocks to be in the child genes. If 1 block is present, you have a Single Factor, if 2 then Double factor
For the recessives to show, you require both blocks to be in the child genes to make the mutation visual.
If only 1 block is present, the child is split for that mutation. On 2 blocks, the mutation is visual.
On paper I am able to calculate the percentages, however I can't figure out how to write it to code.
Let's say we have a male RR, where each R is a block and stands for recessive. And we have a female WW where each W is a block and stands for standard.
if you would combine 1 block of the male and 1 block of the female, then all blocks will be RW. Which means the child will be 100% split to the mutation.
B4X:
female w w
male
R RW RW
R RW RW
Next example: in case the female is split to the mutation and the male is fully mutated, the children would have 50% chance of being exactly the same as daddy and 50% change of being exactly the same as mommy.
(2 times RR and 2 times RW.
Total is 4. 2 out of 4 is 50%)
B4X:
female R w
male R RR RW
male R RR RW
Additionally the following: Male is RW and female is RW.
The output on this would be 25% RR (visual Mutation) 50% Split and 25% standard. Problem is that WR and RW is basicly the same.
B4X:
female R w
male
R RR RW
w WR WW
Anyone a idea on a logic approach?