Friday, June 7, 2019

Calculating allele frequencies

Generally when working with the H-W equation, you are given the information on your population and then must calculate the required values. The first set of values you are likely to need are the allele frequencies (p for the dominant, q for the recessive). To determine these values you will be given the number of individuals in a population for each genotype. From this you can calculate the values directly. For example, if you have a population with 252 AA, 640 Aa, and 382 aa. What are the values of p and q for this population? Because p and q represent the allele frequencies in the gene pool, you need to determine how many alleles are in the entire gene pool. For this you take the total number of individuals and multiply by 2 (because the individuals are diploid). Thus:

252 + 640 + 382 = 1274 individuals.

1274 x 2 = 2548 alleles

To calculate an allele's frequency you need to take into account how many total copies are present for that allele in the entire gene pool. This means you need to take into account two different types of individuals: heterozygotes and one type of homozygous individual. If you are calculating p, then you would count all the homozygous dominant individuals and the heterozygotes. However, you have to take into account the fact that a homozygous dominant individual has two dominant alleles while heterozygotes have only one. So in order to calculate p, you need to take

 (equation 1)

Replacing the generic equation listed above with the actual values we get 

 (equation 2)

This means that p = 0.449 (your number may vary slightly due to different number of decimal places). This means you know that q must be 0.551, because p + q = 1. You can also calculate q directly as a way to check your math (always a good idea!). You would use equation 2, but replace 252 with 382.

This is an important skill to cultivate - pretty much every other calculation you need for the Hardy-Weinberg equation requires that you know what the allele frequencies are!

Thursday, June 6, 2019

Calculating genotype frequencies

Once you know the allele frequencies you can calculate the expected genotype frequencies using those values (the values given here for p and q are from the topic on calculating allele frequencies).

Frequency of homozygous dominant = p2 = 0.4492  0.202

Frequency of heterozygous = 2pq = 2 x 0.449 x 0.551 = 0.495

Frequency of homozygous recessive = q2 = 0.5512 = 0.304

We often find that genetic diseases are recessive, and only expressed in the homozygous recessive form. In such a case, the heterozygous individuals would be called "carriers" because they can pass the disease gene to their offspring, but they usually don't have the disease. These genotype frequencies are going to be worthwhile in their own right, but mostly because they can be used for the calculations to see if the H-W equation applies to a particular population.

Wednesday, June 5, 2019

Calculating number of individuals of each genotype.

Once you have calculated the genotype frequencies that you expect if the H-W equation is true, you need to calculate how many individuals that corresponds to. To do this you multiply each genotype frequency times the size of the population. For our starting example this means:

Expected homozygous dominant (AA) individuals = p2 x 1274 (number of individuals in the population). This is 0.202 x 1274 = 257.4

Expected heterozygous (Aa) individuals = 2pq x 1274 = 0.495 x 1274 = 630.6

Expected homozygous recessive (aa) individuals = qx 1274 = 0.304 x 1274 = 387.3

NOTE: your expected values will typically not be whole numbers, which seems a little odd, because you cannot have fractions of an individual. However, for the purposes of the statistical test we're going to be using, fractional answers are reasonable. You can check to see if your numbers are reasonable by adding up your expected values. They may be off slightly due to round effects, but they should be close to the 1274 population size you are working with. If there is a large difference check your work - there may be an error in there somewhere!

Now that you have your expected genotype numbers, you can move on to perform the statistical test that will let you determine if the population meets the Hardy-Weinberg requirements or not.

Tuesday, June 4, 2019

Calculating if the population meets the Hardy-Weinberg requirements

Once you have your expected values you can compare them to the observed ones, but doing so based on your intuition isn't reliable. Instead, you need to perform a statistical test that allows us to determine if our values are too far apart to be correct. The test we use is called the chi-square goodness of fit test (abbreviated as χ2). This test is calculated by taking the difference between the actual number of individuals in each genotype in the population and the numbers of each genotype that you expected if the Hardy-Weinberg equation is true. You compare those numbers using this formula:


For a H-W test, you will calculate three values (one for each genotype) and sum them together to determine the χ2 value. You then compare this value to a critical value to see if there is a significant difference, or if the differences between the observed and expected are just due to random noise. Normally, you need to have a statistical table to see if your value is significant or not, but that isn't necessary for us. For reasons we don't need to address here, the comparison value for H-W tests is always 3.841. Note: a common misunderstanding is to use a value of 5.991. This is based on an incorrect interpretation of how the χ2 test is done (see this website for more explanation). If the χ2 value is greater than 3.841, then we would say that the differences between the observed and expected are large enough to say that the H-W equation probably doesn't apply to that population. In other words, this would mean the population is evolving for this gene because at least one of the H-W assumptions is not correct. Further work would be needed to determine which assumption(s) are being violated.

For the example data we have been using recall that there were 252 AA, 640, Aa, and 382 aa individuals. These are the observed values. If the H-W equation is true, we expect 257.4, 630.6, and 387.3 for each genotype. This gives the following calculations


 Solving for each equation gives us

So the total is χ2 = 0.326.

Because this value is less than 3.841, there is no significant difference between the expected and observed values, leading us to conclude that this population is not evolving for this gene because it meets all the assumptions required by the H-W equation.

Monday, June 3, 2019

Instructions - introduction to the H-W Quiz App







When you start the app, you should see this screen. The "Make pop." button will randomly choose one of the question types that you have selected (check the Settings on the menu to see which types of questions are available) and generate a population that will be used for the numbers for the problem. The menu at the top right gives access to a number of options (discussed in separate items on this website). The hint button will activate the hint system, where the app will guide you through the calculations to get to the correct answer. This is discussed in more detail on this site. If you need general instructions for the app, you can access them by clicking on the menu and choosing "Instructions". Once you have generated a population you will see details on the population (number of individuals of each genotype) and a place to answer the question. There are two types of questions the app can ask: multiple-choice, where the app gives you a list of choices to answer the question being asked. The other type are fill-in questions where you have to provide a number you calculated to answer the question. Once you have made your choice or entered your answer, you will click on the check answer button and learn if your answer was correct or not. For the multiple-choice questions, the specific answer will be among the options. For the fill-in questions, the app permits some deviation from the correct answer. This is to take into account rounding issues. Depending on the type of question, the number of decimal points you should use in your answer will be indicated. The amount of "wiggle room" you have varies based on the type of question but it isn't very large in any type. You aren't required to use that many, but if you do, you're more likely to be within the acceptable limits for that type of question.

Based on providing correct answers quickly enough, you will earn points that can be used to increase your rank from its starting point (Novice) all the way up to the maximum value (Ph.D.). Answers that aren't given quickly enough will not earn points (but won't cost you any). Wrong answers will cost you points, so be sure you have the correct answer before you select it! See the section on the rankings for more information on this aspect.


Sunday, June 2, 2019

Instructions - selecting options from the menu

The app menu lets you select several options that will affect how the program functions as well as providing more information about it. Settings lets you control how the app works, rankings lets you view the rank you have earned for each question type, achievements lets you see the milestones you have earned in the app, instructions takes you to the instructions built into the app, online help takes you to this website, reset stats will erase all stored data (including your ranks), and about will display information on the version and date of the app.


Saturday, June 1, 2019

Instructions - the settings dialog

On the settings menu you can choose which types of question(s) the app will quiz you on as well as turning the sounds on or off. Select any question type you want to work on. You can choose any combination of question types (both multiple-choice and fill in) as long as at least one type is selected. The sounds are played after you select an answer to indicate if you are correct or incorrect. There are separate sound that play when you earn an achievement, a new rank (due to answering questions correctly), lose a rank (due to answering too many incorrectly), skip questions, or use the hint system.