Skip to content
This repository was archived by the owner on May 22, 2026. It is now read-only.

Commit a0a5dde

Browse files
committed
Added docs for fisher test (MLE algorithm).
Added version of VarDict to expected files in integration test.
1 parent a2c4846 commit a0a5dde

3 files changed

Lines changed: 11 additions & 0 deletions

File tree

src/main/java/com/astrazeneca/vardict/data/fishertest/FisherExact.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ public FisherExact(int refFwd, int refRev, int altFwd, int altRev) {
5454
calculatePValue();
5555
}
5656

57+
// Density of the central hypergeometric distribution on its support: store for once as this is needed quite a bit.
5758
private List<Double> logdcDhyper(int m, int n, int k) {
5859
List<Double> logdc = new ArrayList<>();
5960

@@ -73,6 +74,14 @@ private List<Double> logdcDhyper(int m, int n, int k) {
7374
return logdc;
7475
}
7576

77+
// Determine the MLE for ncp by solving E(X) = x, where the expectation is with respect to H.
78+
// Note that in general the conditional distribution of x given the marginals is a non-central hypergeometric
79+
// distribution H with non-centrality parameter ncp, the odds ratio.
80+
// The null conditional independence is equivalent to the hypothesis that the odds ratio equals one. `Exact`
81+
// inference can be based on observing that in general, given all marginal totals fixed, the first element of the
82+
// contingency table has a non-central hypergeometric distribution with non-centrality parameter given by odds
83+
// ratio (Fisher, 1935). The alternative for a one-sided test is based on the odds ratio, so alternative =
84+
// 'greater' is a test of the odds ratio being bigger than or = 1.
7685
private Double mle(double x) {
7786
double eps = Math.ulp(1.0);
7887
if (x == lo) return 0.0;

tests/integration/expected/vardict.paired.vcf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
##fileformat=VCFv4.3
2+
##source=VarDict_v1.8.0
23
##INFO=<ID=SAMPLE,Number=1,Type=String,Description="Sample name (with whitespace translated to underscores)">
34
##INFO=<ID=TYPE,Number=1,Type=String,Description="Variant Type: SNV Insertion Deletion Complex">
45
##INFO=<ID=DP,Number=1,Type=Integer,Description="Total Depth">

tests/integration/expected/vardict.simple.vcf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
##fileformat=VCFv4.3
2+
##source=VarDict_v1.8.0
23
##INFO=<ID=SAMPLE,Number=1,Type=String,Description="Sample name (with whitespace translated to underscores)">
34
##INFO=<ID=TYPE,Number=1,Type=String,Description="Variant Type: SNV Insertion Deletion Complex">
45
##INFO=<ID=DP,Number=1,Type=Integer,Description="Total Depth">

0 commit comments

Comments
 (0)