Page 12
Problem 1.2 Calculate the frequency of the three alkaline phosphatase alleles in the English population.
Genotype | Number | Frequency | Expected |
---|---|---|---|
SS | 141 | 0.4247 | 0.4096 |
SF | 111 | 0.3343 | 0.3507 |
FF | 28 | 0.0843 | 0.0751 |
SI | 32 | 0.0964 | 0.1101 |
FI | 15 | 0.0452 | 0.0471 |
II | 5 | 0.0151 | 0.0074 |
Total | 332 | 1.0000 | 1.0000 |
Note:
This can be calculated by using the formula:
So,
Validation:
Use Java to calculate the frequency:
package de.yanzhou;
public class Genotype {
public Genotype(String type, double frequency){
this.type = type;
this.frequency = frequency;
}
private String type;
private double frequency;
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public double getFrequency() {
return frequency;
}
public void setFrequency(double frequency) {
this.frequency = frequency;
}
}
package de.yanzhou;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class Calculation {
public static void main(String[] args){
List<Genotype> listOfGenotypes= Arrays.asList(
new Genotype("SS",0.4247),
new Genotype("SF",0.3343),
new Genotype("FF",0.0843),
new Genotype("SI",0.0964),
new Genotype("FI",0.0452),
new Genotype("II",0.0151));
Map<Character, Double> result = calculateFrequency(listOfGenotypes);
result.forEach((genotype, frequency) -> System.out.println(genotype + " " + frequency));
}
private static Map<Character, Double> calculateFrequency(List<Genotype> listOfGenotypes){
Map<Character,Double> result = new HashMap<>();
for (Genotype genotype : listOfGenotypes) {
int lengthOfAllele = genotype.getType().length();
for (int j = 0; j < lengthOfAllele; j++) {
char c = genotype.getType().charAt(j);
double frequency = result.containsKey(c) ?
genotype.getFrequency() / lengthOfAllele + result.get(c) : genotype.getFrequency() / lengthOfAllele;
result.put(c,frequency);
}
}
return result;
}
}
Output:
S 0.64005
F 0.27405
I 0.0859
Pingback: #note Population Genetics A Concise Guide (8) - Yan’s Notebook
Pingback: #note Population Genetics A Concise Guide (17) - Yan’s Notebook