Package org.snpeff.probablility
Class Hypergeometric
- java.lang.Object
-
- org.snpeff.probablility.Hypergeometric
-
public class Hypergeometric extends java.lang.Object
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 Modifier and Type Field Description static double
EPSILON
A small number
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
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
main(java.lang.String[] args)
java.lang.String
toR(int k, int N, int D, int n)
Convert values to 'R' command
-
-
-
Method Detail
-
get
public static Hypergeometric get()
-
main
public static void main(java.lang.String[] args)
-
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
public java.lang.String toR(int k, int N, int D, int n)
Convert values to 'R' command- Returns:
-
-