Package pal.popgen
Class LinkageDisequilibrium
- java.lang.Object
-
- java.lang.Thread
-
- pal.popgen.LinkageDisequilibrium
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Runnable
,TableReport
public class LinkageDisequilibrium extends java.lang.Thread implements java.io.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:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected Alignment
theAlignment
protected AnnotationAlignment
theAnnotationAlignment
-
Constructor Summary
Constructors Constructor Description LinkageDisequilibrium(Alignment alignment)
compute LD based on an alignment.LinkageDisequilibrium(Alignment alignment, boolean rapidPermute, int numberOfPermutations)
compute LD based on an alignment
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AnnotationAlignment
getAnnotatedAlignment()
Returns an annotated aligment if one was used for this LD this could be used to access information of locus positiondouble
getDPrime(int r, int c)
Returns D' estimate for a given pair of sitesint
getN(int r, int c)
Get number of gametes included in LD calculations (after missing data was excluded)double
getP(int r, int c)
Returns P-value estimate for a given pair of sites.double
getRSqr(int r, int c)
Returns r^2 estimate for a given pair of sitesint
getSiteCount()
Returns the counts of the sites in the alignmentjava.lang.Object[]
getTableColumnNames()
get the names of the columnsjava.lang.Object[][]
getTableData()
get the data elementsjava.lang.String
getTableTitle()
get the title of the tablevoid
print(LinkageDisequilibrium ld, java.io.PrintWriter out)
print the LD to the PrintWritevoid
run()
starts the thread to calculate LDjava.lang.String
toString()
returns representation of the LD results as a string-
Methods inherited from class java.lang.Thread
activeCount, checkAccess, clone, countStackFrames, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, onSpinWait, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, suspend, yield
-
-
-
-
Field Detail
-
theAlignment
protected Alignment theAlignment
-
theAnnotationAlignment
protected AnnotationAlignment theAnnotationAlignment
-
-
Constructor Detail
-
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 Detail
-
run
public void run()
starts the thread to calculate LD- Specified by:
run
in interfacejava.lang.Runnable
- Overrides:
run
in classjava.lang.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 1c
- 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 1c
- 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 1c
- 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 1c
- 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 java.lang.String toString()
returns representation of the LD results as a string- Overrides:
toString
in classjava.lang.Thread
-
print
public void print(LinkageDisequilibrium ld, java.io.PrintWriter out)
print the LD to the PrintWrite
-
getTableColumnNames
public java.lang.Object[] getTableColumnNames()
Description copied from interface:TableReport
get the names of the columns- Specified by:
getTableColumnNames
in interfaceTableReport
- Returns:
- column names for the table
-
getTableData
public java.lang.Object[][] getTableData()
Description copied from interface:TableReport
get the data elements- Specified by:
getTableData
in interfaceTableReport
- Returns:
- data for the table
-
getTableTitle
public java.lang.String getTableTitle()
Description copied from interface:TableReport
get the title of the table- Specified by:
getTableTitle
in interfaceTableReport
- Returns:
- the title of the table
-
-