about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPjotr Prins2025-12-01 08:20:24 +0100
committerPjotr Prins2025-12-01 08:20:24 +0100
commite233c0d2b6b9744005c009af6b78683a24137a00 (patch)
treed9e17aa5b5a6e089ed1e59676fec80a790f85c57
parentdc63e81e9df26f607b0f83b86a7118f73a3d2cfa (diff)
downloadpangemma-e233c0d2b6b9744005c009af6b78683a24137a00.tar.gz
Added test
-rwxr-xr-xtest/test-mdb-integration.scm27
1 files changed, 27 insertions, 0 deletions
diff --git a/test/test-mdb-integration.scm b/test/test-mdb-integration.scm
index 69faea5..006c241 100755
--- a/test/test-mdb-integration.scm
+++ b/test/test-mdb-integration.scm
@@ -22,3 +22,30 @@ exec guile --debug -s "$0" "$@"
   (test-eqv 0 err))
 
 (test-end "uvlmm-mdb-kinship-run")
+
+(test-begin "uvlmm-mdb-gwa-run")
+
+(when (file-exists? gwa-fn)
+  (delete-file gwa-fn))
+;; The following integration test runs gemma uvlmm and adds up the output column as a check.
+;; It uses the kinship-run matrix from the earlier test
+(let [(err (system (string-append "./build/bin/Debug/gemma -g ./example/mouse_hs1940.geno.mdb -p ./example/mouse_hs1940.pheno.txt -n 1 -a ./example/mouse_hs1940.anno.txt -k " kinship-fn " -o mouse_hs1940 -lmm 9 -debug")))]
+  (test-eqv 0 err))
+(call-with-input-file gwa-fn
+  (lambda (port)
+    (read-line port)  ; skip first line
+    (let* ((fields (string-split (read-line port) #\tab))
+           (last-field (last fields)))
+      (test-eqv 208.0 (truncate (* 1000 (string->number last-field)))))
+    (test-eqv 5720672.0
+      (let loop ((line (read-line port))
+                 (sum 208.0))
+        (if (eof-object? line)
+            sum
+            (let* ((fields (string-split line #\tab))
+                   (last-field (last fields))
+                   (value (string->number last-field)))
+              (loop (read-line port)
+                    (+ sum (truncate (* 1000 value))))))))))
+
+(test-end "uvlmm-mdb-gwa-run")