Package org.snpeff.probablility
Class Hypergeometric
java.lang.Object
org.snpeff.probablility.Hypergeometric
Calculate hypergeometric distribution using an optimized algorithm
that avoids problems with big factorials.
Also calculated Fisher's exact test
In general everything is expressed in a 2x2 'contingency' table
form sequence of 'n' draws from a finite population without
replacement
drawn not drawn | total
defective k D - k | D
nondefective n - k N + k - n - D | N - D
----------------------------+----------
total n N - n | N
This can be viewed as if we have a bag of N marbles
having D white marbles, and we take a sample of n
marbles(without replacement)
N : Total marbles
D : White marbles => N-D : Black marbles
n : marbles drawn => N-n : not drawn
k : white marbles drawn
- Author:
- pcingola
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionboolean
checkHypergeometricParams
(int k, int N, int D, int n) Check if hypergeometric paramters are correctstatic Hypergeometric
get()
double
hypergeometric
(int k, int N, int D, int n) See http://en.wikipedia.org/wiki/Hypergeometric_distributionstatic void
toR
(int k, int N, int D, int n) Convert values to 'R' command
-
Field Details
-
EPSILON
public static double EPSILONA small number
-
-
Method Details
-
get
-
main
-
checkHypergeometricParams
public boolean checkHypergeometricParams(int k, int N, int D, int n) Check if hypergeometric paramters are correct- Parameters:
k
-N
-D
-n
-- Returns:
-
hypergeometric
public double hypergeometric(int k, int N, int D, int n) See http://en.wikipedia.org/wiki/Hypergeometric_distribution- Parameters:
k
- : white marbles drawnN
- : Total marblesD
- : White marbles => N-D : Black marblesn
- : marbles drawn => N-n : not drawn- Returns:
- Hypergeometric distribution References: http://en.wikipedia.org/wiki/Fisher%27s_exact_test http://en.wikipedia.org/wiki/Hypergeometric_distribution
-
toR
Convert values to 'R' command- Returns:
-