about summary refs log tree commit diff
path: root/scripts/precompute/run-gemma.scm
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/precompute/run-gemma.scm')
-rwxr-xr-xscripts/precompute/run-gemma.scm42
1 files changed, 27 insertions, 15 deletions
diff --git a/scripts/precompute/run-gemma.scm b/scripts/precompute/run-gemma.scm
index e6a4e26..4952834 100755
--- a/scripts/precompute/run-gemma.scm
+++ b/scripts/precompute/run-gemma.scm
@@ -9,7 +9,7 @@ Run from base dir with
 
 and with some extra paths (for gemma)
 
-~/opt/guix-pull/bin/guix shell -C -F xz tar time parallel coreutils-minimal guile guile-dbi guile-json ruby --expose=/home/wrk/iwrk/opensource/code/genetics/gemma-wrapper/=/gemma-wrapper --expose=/home/wrk/iwrk/opensource/code/genetics/gemma/=/gemma -- env TMPDIR=tmp GEMMA_COMMAND=/gemma/bin/gemma-0.98.5-linux-static-debug  guile -L . -e main -s ./scripts/precompute/run-gemma.scm
+~/opt/guix-pull/bin/guix shell -C -F xz python python-lmdb tar time parallel coreutils-minimal guile guile-dbi guile-json ruby --expose=/home/wrk/iwrk/opensource/code/genetics/gemma-wrapper/=/gemma-wrapper --expose=/home/wrk/iwrk/opensource/code/genetics/gemma/=/gemma -- env TMPDIR=tmp GEMMA_COMMAND=/gemma/bin/gemma-0.98.5-linux-static-debug  guile -L . -e main -s ./scripts/precompute/run-gemma.scm --id 21529
 
 !#
 
@@ -30,24 +30,36 @@ and with some extra paths (for gemma)
   ;; (write args)
   (let* [
          (option-spec '( (version (single-char #\v) (value #f))
+                         (id      (value #t))
                          (help    (single-char #\h) (value #f))))
          (options (getopt-long args option-spec))
+         (show-version (option-ref options 'version #f))
          (help-wanted (option-ref options 'help #f))]
-    (display "RUNNING")
+    (if show-version
+        (begin
+          (display "run-gemma version 1.0\n")
+          (exit)))
     (if help-wanted
-        (format #t "list-traits-to-compute writes JSON traits files from the GN DB
-Usage: list-traits-to-compute [options...]
-  -h, --help          Display this help
-"))
-    (let [(trait-name "115475")]
-      (call-with-input-file "115475.json"
+        (format #t "run-gemma
+Usage: run-gemma [options...] filename(s)
+  --id               Run on identifier
+  -v --version       Display version
+  -h --help          Display this help
+")
+        (let* [(trait-id (option-ref options 'id "0"))
+          (trait-fn (string-append trait-id ".json"))
+          ]
+
+      (call-with-input-file trait-fn
         (lambda (port)
           (let* [(json (json->scm port))
-                 (dataset (assoc-ref json "traits"))
-                 (dataset-name (car (car dataset)))
-                 (traits (assoc-ref dataset dataset-name))
+                 (dataset (car (assoc-ref json "data")))
+                 (data (cdr dataset))
+                 (dataset-name (assoc-ref data "name"))
+                 (trait-name (assoc-ref data "trait-name"))
+                 (traits (assoc-ref data "traits"))
+                 (pheno-fn (string-append trait-id "-pheno.txt"))
                  ]
-            (display dataset)
-            (write-pheno-file "pheno.txt" traits)
-            (invoke-gemma-wrapper-loco dataset-name trait-name "pheno.txt")
-          ))))))
+            (write-pheno-file pheno-fn traits)
+            (invoke-gemma-wrapper-loco dataset-name trait-name trait-fn pheno-fn "BXD.8_geno.txt.gz")
+            )))))))