Package pal.popgen
Class LinkageDisequilibrium
java.lang.Object
java.lang.Thread
pal.popgen.LinkageDisequilibrium
- All Implemented Interfaces:
Serializable
,Runnable
,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:
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Thread
Thread.Builder, Thread.State, Thread.UncaughtExceptionHandler
-
Field Summary
FieldsFields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
-
Constructor Summary
ConstructorsConstructorDescriptionLinkageDisequilibrium
(Alignment alignment) compute LD based on an alignment.LinkageDisequilibrium
(Alignment alignment, boolean rapidPermute, int numberOfPermutations) compute LD based on an alignment -
Method Summary
Modifier and TypeMethodDescriptionReturns 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
Returns the counts of the sites in the alignmentObject[]
get the names of the columnsObject[][]
get the data elementsget the title of the tablevoid
print
(LinkageDisequilibrium ld, PrintWriter out) print the LD to the PrintWritevoid
run()
starts the thread to calculate LDtoString()
returns representation of the LD results as a stringMethods 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, isVirtual, join, join, join, join, ofPlatform, ofVirtual, onSpinWait, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, sleep, start, startVirtualThread, stop, suspend, threadId, yield
-
Field Details
-
theAlignment
-
theAnnotationAlignment
-
-
Constructor Details
-
LinkageDisequilibrium
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
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 -
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
Returns an annotated aligment if one was used for this LD this could be used to access information of locus position -
toString
returns representation of the LD results as a string -
print
print the LD to the PrintWrite -
getTableColumnNames
Description copied from interface:TableReport
get the names of the columns- Specified by:
getTableColumnNames
in interfaceTableReport
- Returns:
- column names for the table
-
getTableData
Description copied from interface:TableReport
get the data elements- Specified by:
getTableData
in interfaceTableReport
- Returns:
- data for the table
-
getTableTitle
Description copied from interface:TableReport
get the title of the table- Specified by:
getTableTitle
in interfaceTableReport
- Returns:
- the title of the table
-