about summary refs log tree commit diff
path: root/test
diff options
context:
space:
mode:
authorPjotr Prins2017-08-14 09:59:42 +0000
committerPjotr Prins2017-08-14 10:21:25 +0000
commitd9556d0aa21a084bd39f0188c88c8c3f09f71ab4 (patch)
tree435d53ad9fad4a43ad55e15f76a8897e91f851b5 /test
parentff1252fe3db1ba639fe148f45b0408a4f182da0d (diff)
downloadpangemma-d9556d0aa21a084bd39f0188c88c8c3f09f71ab4.tar.gz
Issue 58, add tests for GSLv2 NaN's showing up with covariates
https://github.com/genetics-statistics/GEMMA/issues/58
Diffstat (limited to 'test')
-rwxr-xr-xtest/test_suite.sh31
1 files changed, 31 insertions, 0 deletions
diff --git a/test/test_suite.sh b/test/test_suite.sh
index 625298e..71901d7 100755
--- a/test/test_suite.sh
+++ b/test/test_suite.sh
@@ -80,6 +80,37 @@ testMultivariateLinearMixedModel() {
     assertEquals "139867" `wc -w < $outfn`
     assertEquals "4029037056.54" `perl -nle 'foreach $x (split(/\s+/,$_)) { $sum += sprintf("%.2f",(substr($x,,0,6))) } END { printf "%.2f",$sum }' $outfn`
 }
+
+testPlinkStandardRelatednessMatrixK() {
+    testname=testPlinkStandardRelatednessMatrixK
+    datadir=../example
+    outfn=output/$testname.sXX.txt
+    rm -f $outfn
+    $gemma -bfile $datadir/HLC \
+           -gk 2 -o $testname
+    assertEquals 0 $?
+    assertEquals 0 $?
+    assertEquals "427" `wc -l < $outfn`
+    assertEquals "-358.07" `perl -nle 'foreach $x (split(/\s+/,$_)) { $sum += sprintf("%.2f",(substr($x,,0,6))) } END { printf "%.2f",$sum }' $outfn`
+}
+
+# Test for https://github.com/genetics-statistics/GEMMA/issues/58
+# fixed GSLv2 NaN's that appeared with covariates.
+testPlinkMultivariateLinearMixedModel() {
+    testname=testPlinkMultivariateLinearMixedModel
+    datadir=../example
+    $gemma -bfile $datadir/HLC \
+           -k output/testPlinkStandardRelatednessMatrixK.sXX.txt \
+           -lmm 1 \
+           -maf 0.1 \
+           -c $datadir/HLC_covariates.txt \
+           -o $testname
+    assertEquals 0 $?
+    outfn=output/$testname.assoc.txt
+    assertEquals "223243" `wc -l < $outfn`
+    assertEquals "89756559859.06" `perl -nle 'foreach $x (split(/\s+/,$_)) { $sum += sprintf("%.2f",(substr($x,,0,6))) } END { printf "%.2f",$sum }' $outfn`
+}
+
 shunit2=`which shunit2`
 
 if [ -x "$shunit2" ]; then