#note Population Genetics A Concise Guide (4)

Page 12

Problem 1.2 Calculate the frequency of the three alkaline phosphatase alleles in the English population.

GenotypeNumberFrequencyExpected
SS1410.42470.4096
SF1110.33430.3507
FF280.08430.0751
SI320.09640.1101
FI150.04520.0471
II50.01510.0074
Total3321.00001.0000
Table 1.2: The frequencies of alkaline phosphatase genotypes in a sample from the English people. The expected Hardy-Weinberg frequencies are given in the fourth column. The data are from Harris (1966).

Note:

This can be calculated by using the formula:

    \[p_{i} = x_{ii} + \frac{1}{2}\sum_{j=1}^{i-1}x_{ji} + \frac{1}{2}\sum_{j=i+1}^{n}x_{ij}\]

So,

    \[p_{S} =0.4247+0.3343/2+0.0964/2= 0.64005\]

    \[p_{F} =0.0843+0.3343/2+0.0452/2= 0.27405\]

    \[p_{I} =0.0151+0.0964/2+0.0452/2= 0.0859\]

Validation:

    \[p_{S}+p_{F}+p_{I}=0.64005+0.27405+0.0859=1\]

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

2 thoughts on “#note Population Genetics A Concise Guide (4)”

  1. Pingback: #note Population Genetics A Concise Guide (8) - Yan’s Notebook

  2. Pingback: #note Population Genetics A Concise Guide (17) - Yan’s Notebook

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top