Class VcfHwe


  • public class VcfHwe
    extends java.lang.Object
    Calculate Hardy-Weimberg equilibrium and goodness of fit. References: "Principles of population genetics", Hartl & Clark "A Note on Exact test of Hardy Weinbeg Equilibrium", G. Abecasis et. al. Note: This is only for two alleles in diploid individuals. We should extend this to more alleles and N-ploid species.
    Author:
    pablocingolani
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static boolean debug  
    • Constructor Summary

      Constructors 
      Constructor Description
      VcfHwe()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      double hwe​(org.snpeff.vcf.VcfEntry vcfEntry, boolean addInfo)
      Calculate Hardy-Weimberg equilibrium and add data to vcfEntry (INFO fields)
      double hweLogPn12​(int n1, int n2, int n12)
      Calculate exact log of "P[ n12 | n1, n2]" References: "Principles of population genetics", Hartl & Clark, page 58 (formula 2.5) "A Note on Exact test of Hardy Weinbeg Equilibrium", G.
      double hweP​(int n1, int n2, int n12star)
      Calculate goodness of fit for n1, n2 combination.
      double hwePchi2​(int n1, int n2, int n12)
      Calculate goodness of fit using Chi square approximation
      double hwePn12​(int n1, int n2, int n12)
      Calculate exact probability of "P[ n12 | n1, n2]" References: "Principles of population genetics", Hartl & Clark, page 58 (formula 2.5) "A Note on Exact test of Hardy Weinbeg Equilibrium", G.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • debug

        public static boolean debug
    • Constructor Detail

      • VcfHwe

        public VcfHwe()
    • Method Detail

      • hwe

        public double hwe​(org.snpeff.vcf.VcfEntry vcfEntry,
                          boolean addInfo)
        Calculate Hardy-Weimberg equilibrium and add data to vcfEntry (INFO fields)
        Parameters:
        addInfo - : If true, 'HWE' and 'HWEP' INFO tags are added to this entry
      • hweLogPn12

        public double hweLogPn12​(int n1,
                                 int n2,
                                 int n12)
        Calculate exact log of "P[ n12 | n1, n2]" References: "Principles of population genetics", Hartl & Clark, page 58 (formula 2.5) "A Note on Exact test of Hardy Weinbeg Equilibrium", G. Abecasis et. al. (formula 1)
        Parameters:
        n1 - : Number of 'A' alleles
        n2 - : Number of 'B' alleles
        n12 - : Number of 'AB' individuals Note: Total number of individuals (assuming they are diploid) is N = (n1 + n2) / 2
        Returns:
        Log of pValue using exact test
      • hweP

        public double hweP​(int n1,
                           int n2,
                           int n12star)
        Calculate goodness of fit for n1, n2 combination. References: "Principles of population genetics", Hartl & Clark, page 58 WARNING: The formula P_{HWE} in page 2 of "A Note on Exact test of Hardy Weinbeg Equilibrium", seems to have two mistakes (probably typos?)
      • hwePchi2

        public double hwePchi2​(int n1,
                               int n2,
                               int n12)
        Calculate goodness of fit using Chi square approximation
      • hwePn12

        public double hwePn12​(int n1,
                              int n2,
                              int n12)
        Calculate exact probability of "P[ n12 | n1, n2]" References: "Principles of population genetics", Hartl & Clark, page 58 (formula 2.5) "A Note on Exact test of Hardy Weinbeg Equilibrium", G. Abecasis et. al. (formula 1)
        Parameters:
        n1 - : Number of 'A' alleles
        n2 - : Number of 'B' alleles
        n12 - : Number of 'AB' individuals Note: Total number of individuals (assuming they are diploid) is N = (n1 + n2) / 2
        Returns:
        pValue using exact test