From 51ef360166bccd2981fc82fdb157b950820fbd67 Mon Sep 17 00:00:00 2001
From: Brent Pedersen <bpederse@gmail.com>
Date: Wed, 8 Oct 2014 15:11:33 -0600
Subject: [PATCH] fix #117 by re-ordering contingency table. thanks
 @thomasgilgenast for a clear report

---
 docs/content/tools/fisher.rst | 4 ++--
 src/fisher/Fisher.cpp         | 6 +++---
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/docs/content/tools/fisher.rst b/docs/content/tools/fisher.rst
index efc6814a..239328dd 100644
--- a/docs/content/tools/fisher.rst
+++ b/docs/content/tools/fisher.rst
@@ -43,8 +43,8 @@ can do this with ``fisher`` as:
     # Contingency Table
     #_________________________________________
     #           | not in -b    | in -b        |
-    # not in -a | 475          | 15           |
-    #     in -a | 5            | 5            |
+    # not in -a | 475          | 5           |
+    #     in -a | 15           | 5            |
     #_________________________________________
     # p-values for fisher's exact test
     left    right   two-tail    ratio
diff --git a/src/fisher/Fisher.cpp b/src/fisher/Fisher.cpp
index 38eb23b4..874da58b 100644
--- a/src/fisher/Fisher.cpp
+++ b/src/fisher/Fisher.cpp
@@ -38,10 +38,10 @@ bool Fisher::calculate() {
     long long genomeSize = _context->getGenomeFile()->getGenomeSize();
     // bases covered by neither a nor b
     long long n11 = genomeSize - _queryLen - _dbLen + _intersectionVal;
-    // bases covered only by -a
-    long long n12 = _queryLen - _intersectionVal;
     // bases covered only by -b
-    long long n21 = _dbLen - _intersectionVal;
+    long long n12 = _dbLen - _intersectionVal;
+    // bases covered only by -a
+    long long n21 = _queryLen - _intersectionVal;
     // bases covered by both
     long long n22 = _intersectionVal;
 
-- 
GitLab