HP Forums
A small biological program (Hardy-Weinberg equation) - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html)
+--- Forum: General Forum (/forum-4.html)
+--- Thread: A small biological program (Hardy-Weinberg equation) (/thread-13976.html)



A small biological program (Hardy-Weinberg equation) - Trond - 11-11-2019 03:43 AM

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.


RE: A small biological program (Hardy-Weinberg equation) - PedroLeiva - 12-14-2019 06:21 PM

Thanks for your nice program. I loaded with HP67 code and is working perfect. Any more genetic or BIO programming to share?
Pedro