HP Forums

Full Version: A small biological program (Hardy-Weinberg equation)
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
This program was written on my HP 34C and calculates allele frequencies and genotype frequencies, based on the assumptions of two alleles and Hardy-Weinberg equilibrium. It could be of interest to e.g. biology teachers.


LBL A
X><Y
÷
STO 5

STO 2
1
-
CHS
STO 1
X^2
STO 3
RCL 1
RCL 2
*
2
*
STO 4
RCL 2
RCL 1
RTN

Start off with entering the sample size (i.e. number of individuals studied) in the Y register and number of homozygous recessive individuals (e.g. individuals showing expression of a rare recessive genetic variant) in the X register.

E.g. if 100 individuals were investigated for a recessive genetic variant (allele), such as the inability to taste bitter substances, and this recessive trait was found in 15 individuals, you would key in 100 ENTER 15, and then run the program. The program places the dominant allele frequency (p) in the X register and in R1, and recessive allele frequency (q) in Y and in R2, homozygous dominant genotype frequency in R3, heterozygous in R4, and homozygous recessive genotype in R5. In the example above p=0.61 and q=0.39, heterozygous individuals carrying both alleles but not showing the recessive trait has frequency 0.47, or almost half the population. Frequency of individuals with dominant alleles only is in this case 0.38.
Thanks for your nice program. I loaded with HP67 code and is working perfect. Any more genetic or BIO programming to share?
Pedro
Reference URL's