Package pal.popgen

Class LinkageDisequilibrium

java.lang.Object
java.lang.Thread
pal.popgen.LinkageDisequilibrium
All Implemented Interfaces:
Serializable, Runnable, TableReport

public class LinkageDisequilibrium extends Thread implements Serializable, TableReport
This class calculates D' and r^2 estimates of linkage disequilibrium. It also calculates the significance of the LD by either Fisher Exact or the multinomial permutation test. This class can work with either normal alignments of annotated alignments. The alignments should be stripped of invariable sites. 2 state estimates of D' and r^2 can be found reviewed and discussed in Weir 1996 multi-state loci (>=3) require an averaging approach. These should not be used for popgen parameter estimates, unless you know specifically that it works for multistate loci. The estimate of D' is the approach used by Farnir 2000 Genome Research 10:220-227 that follows Hedrick 1987. r^2 was estimated in a similar way.
Version:
$Id: LinkageDisequilibrium.java,v 1
Author:
Ed Buckler
See Also:
  • Field Details

  • Constructor Details

    • LinkageDisequilibrium

      public LinkageDisequilibrium(Alignment alignment)
      compute LD based on an alignment. The default is to used used rapid permutations that provides slightly biased P-values, and 1000 permutations to evaluate P-values.
      Parameters:
      alignment - Alignment or AnnotationAlignment (this should only contain polymorphic sites)
    • LinkageDisequilibrium

      public LinkageDisequilibrium(Alignment alignment, boolean rapidPermute, int numberOfPermutations)
      compute LD based on an alignment
      Parameters:
      alignment - Alignment or AnnotationAlignment (this should only contain polymorphic sites)
      rapidPermute - Use a rapid approach to P-value estimation (see Contigency Table)
      numberOfPermutations - The number of permutations to determine P values
  • Method Details

    • run

      public void run()
      starts the thread to calculate LD
      Specified by:
      run in interface Runnable
      Overrides:
      run in class Thread
    • getP

      public double getP(int r, int c)
      Returns P-value estimate for a given pair of sites. If there were only 2 alleles at each locus, then the Fisher Exact P-value (one-tail) is returned. If more states then the permutaed Monte Carlo test is used.
      Parameters:
      r - is site 1
      c - is site 2
      Returns:
      P-value
    • getN

      public int getN(int r, int c)
      Get number of gametes included in LD calculations (after missing data was excluded)
      Parameters:
      r - is site 1
      c - is site 2
      Returns:
      number of gametes
    • getDPrime

      public double getDPrime(int r, int c)
      Returns D' estimate for a given pair of sites
      Parameters:
      r - is site 1
      c - is site 2
      Returns:
      D'
    • getRSqr

      public double getRSqr(int r, int c)
      Returns r^2 estimate for a given pair of sites
      Parameters:
      r - is site 1
      c - is site 2
      Returns:
      D'
    • getSiteCount

      public int getSiteCount()
      Returns the counts of the sites in the alignment
    • getAnnotatedAlignment

      public AnnotationAlignment getAnnotatedAlignment()
      Returns an annotated aligment if one was used for this LD this could be used to access information of locus position
    • toString

      public String toString()
      returns representation of the LD results as a string
      Overrides:
      toString in class Thread
    • print

      public void print(LinkageDisequilibrium ld, PrintWriter out)
      print the LD to the PrintWrite
    • getTableColumnNames

      public Object[] getTableColumnNames()
      Description copied from interface: TableReport
      get the names of the columns
      Specified by:
      getTableColumnNames in interface TableReport
      Returns:
      column names for the table
    • getTableData

      public Object[][] getTableData()
      Description copied from interface: TableReport
      get the data elements
      Specified by:
      getTableData in interface TableReport
      Returns:
      data for the table
    • getTableTitle

      public String getTableTitle()
      Description copied from interface: TableReport
      get the title of the table
      Specified by:
      getTableTitle in interface TableReport
      Returns:
      the title of the table