about summary refs log tree commit diff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rwxr-xr-xtest/dev_test_suite.sh2
-rw-r--r--test/dev_tests.rb34
-rwxr-xr-xtest/lengthy_test_suite.sh2
-rw-r--r--test/lib/test-helpers.rb14
-rwxr-xr-xtest/test_suite.sh2
5 files changed, 42 insertions, 12 deletions
diff --git a/test/dev_test_suite.sh b/test/dev_test_suite.sh
index 676e0b3..a5ec3f4 100755
--- a/test/dev_test_suite.sh
+++ b/test/dev_test_suite.sh
@@ -1,5 +1,7 @@
 #!/bin/sh
 
+echo "WARNING: THIS TEST SUITE IS NO LONGER USED"
+
 gemma=../bin/gemma
 # gemmaopts="-debug -strict"
 gemmaopts="-debug -check"
diff --git a/test/dev_tests.rb b/test/dev_tests.rb
index fb3fecf..fc2f7bb 100644
--- a/test/dev_tests.rb
+++ b/test/dev_tests.rb
@@ -10,7 +10,7 @@ class TestQuick < MiniTest::Test
   end
 
   def test_linear_model
-    assert gemma("-g ./example/mouse_hs1940.geno.txt.gz \
+    gemma("-g ./example/mouse_hs1940.geno.txt.gz \
            -p ./example/mouse_hs1940.pheno.txt \
            -n 1 \
            -a ./example/mouse_hs1940.anno.txt \
@@ -23,14 +23,14 @@ class TestQuick < MiniTest::Test
   end
 
   def test_BXD
-    assert gemma("-g ./example/BXD_geno.txt.gz \
+    gemma("-g ./example/BXD_geno.txt.gz \
            -p ./example/BXD_pheno.txt \
            -c ./example/BXD_covariates2.txt \
            -a ./example/BXD_snps.txt \
            -gk \
            -o BXD")
 
-    assert gemma("-g ./example/BXD_geno.txt.gz \
+    gemma("-g ./example/BXD_geno.txt.gz \
            -p ./example/BXD_pheno.txt \
            -c ./example/BXD_covariates2.txt \
            -a ./example/BXD_snps.txt \
@@ -39,18 +39,18 @@ class TestQuick < MiniTest::Test
            -o BXDLMM")
 
     expect("output/BXDLMM.assoc.txt",[[2,9,"1.234747e-01"],
-                                      [:max,9,"9.997119e-01"]])
+                                      [:max,"p_lrt","9.997119e-01"]])
   end
 
   def test_mouse_hs1940_loco
-    assert gemma("-g ./example/mouse_hs1940.geno.txt.gz \
+    gemma("-g ./example/mouse_hs1940.geno.txt.gz \
            -p ./example/mouse_hs1940.pheno.txt \
            -a ./example/mouse_hs1940.anno.txt \
            -snps ./example/mouse_hs1940_snps.txt \
            -nind 400 -loco 1 -gk \
            -o mouse_hs1940_loco")
 
-    assert gemma("-g ./example/mouse_hs1940.geno.txt.gz \
+    gemma("-g ./example/mouse_hs1940.geno.txt.gz \
            -p ./example/mouse_hs1940.pheno.txt \
 	   -n 1 \
 	   -loco 1 \
@@ -61,6 +61,26 @@ class TestQuick < MiniTest::Test
 	   -nind 400 -no-check \
            -o mouse_hs1940_loco")
     expect("output/mouse_hs1940_loco.assoc.txt",[[2,9,"-3.073643e+02"],
-                                                 [:max,11,"9.716047e-01"]])
+                                                 [:max,"p_wald","9.716047e-01"]])
   end
+
+  # Test for https://github.com/genetics-statistics/GEMMA/issues/58
+  # fixed GSLv2 NaN's that appeared with covariates.
+  def test_plink_covariates_lmm
+    gemma("-bfile example/HLC -gk 2 -o testPlinkStandardRelatednessMatrixK")
+
+    gemma("-bfile example/HLC \
+           -k output/testPlinkStandardRelatednessMatrixK.sXX.txt \
+           -lmm 1 \
+           -maf 0.1 \
+           -c example/HLC_covariates.txt \
+           -no-check \
+           -o plink_lmm1_cov")
+    expect("output/plink_lmm1_cov.assoc.txt",[[100,"p_wald","5.189953e-01"],
+                                              [:max,"logl_H1","279.2689"],
+                                              [:max,"l_remle","1.686062"],
+                                              [:max,"p_wald","0.9999996"]])
+  end
+
+
 end
diff --git a/test/lengthy_test_suite.sh b/test/lengthy_test_suite.sh
index 6e93220..6e11793 100755
--- a/test/lengthy_test_suite.sh
+++ b/test/lengthy_test_suite.sh
@@ -2,6 +2,8 @@
 #
 # Long running tests go here
 
+echo "WARNING: THIS TEST SUITE IS NO LONGER USED"
+
 gemma=../bin/gemma
 export GSL_RNG_SEED=100
 
diff --git a/test/lib/test-helpers.rb b/test/lib/test-helpers.rb
index d2989e0..672a2c2 100644
--- a/test/lib/test-helpers.rb
+++ b/test/lib/test-helpers.rb
@@ -2,7 +2,7 @@ module TestHelpers
 
   # Runs gemma and returns true if successful
   def gemma(opts)
-    system("./bin/gemma #{opts}")
+    assert system("./bin/gemma #{opts}")
   end
 
   def read(fn, line=0)
@@ -18,11 +18,15 @@ module TestHelpers
     lines = lines.map { |l| l.split("\t") } # avoid this for large files
     list.each do | l |
       line,colnum,value = l
-      if line == :max
-        cols = lines.max_by {|a| a[colnum].to_f}
-      else
-        cols = lines[line]
+      if colnum.is_a? String
+        colnum = lines[0].index(colnum)
       end
+      cols =
+        if line == :max
+          lines.max_by {|a| a[colnum].to_f}
+        else
+          lines[line]
+        end
       # assert_equal value,cols[colnum]
       assert_in_delta value.to_f,cols[colnum].to_f, 0.001
     end
diff --git a/test/test_suite.sh b/test/test_suite.sh
index cc244c0..38671be 100755
--- a/test/test_suite.sh
+++ b/test/test_suite.sh
@@ -1,5 +1,7 @@
 #!/bin/sh
 
+echo "WARNING: THIS TEST SUITE IS NO LONGER USED"
+
 gemma=../bin/gemma
 gemmaopts="-debug"
 export GSL_RNG_SEED=10