about summary refs log tree commit diff
path: root/scripts/precompute
diff options
context:
space:
mode:
authorPjotr Prins2024-06-26 04:45:13 -0500
committerPjotr Prins2024-06-26 04:45:13 -0500
commite4775ccc0c24351e1ee428cddb0f320022509137 (patch)
tree868406d4c55b988a46bbd97e4c7fda543dcd2bc0 /scripts/precompute
parent41735d8fbf4fbd0d137224f25b20cda6556ad484 (diff)
downloadgn-guile-e4775ccc0c24351e1ee428cddb0f320022509137.tar.gz
Read pheno JSON file and write out pheno file for gemma
Diffstat (limited to 'scripts/precompute')
-rwxr-xr-xscripts/precompute/precompute-hits.scm6
-rwxr-xr-xscripts/precompute/run-gemma.scm21
2 files changed, 19 insertions, 8 deletions
diff --git a/scripts/precompute/precompute-hits.scm b/scripts/precompute/precompute-hits.scm
index a18b33d..203dfbb 100755
--- a/scripts/precompute/precompute-hits.scm
+++ b/scripts/precompute/precompute-hits.scm
@@ -1,8 +1,8 @@
 #! Precompute hits
 
-This is the obsolete script to compute GEMMA directly from the DB. We have split out
-this step into fetching traits and running gemma without DB. This allows scaling up
-on HPC etc.
+This is the *obsolete* script to compute GEMMA directly from the DB. We have split out
+this step into separate steps for (1) fetching traits and (2) running gemma without DB.
+This allows scaling up on HPC etc.
 
 Run from base dir with
 
diff --git a/scripts/precompute/run-gemma.scm b/scripts/precompute/run-gemma.scm
index b14927a..36edf8b 100755
--- a/scripts/precompute/run-gemma.scm
+++ b/scripts/precompute/run-gemma.scm
@@ -5,9 +5,9 @@ GEMMA on those.
 
 Run from base dir with
 
-guix shell guile guile-dbi -- guile -L ../.. -s run-gemma.scm --help
+ ~/opt/guix-pull/bin/guix shell guile guile-dbi guile-json -- guile -L . -e main -s scripts/precompute/run-gemma.scm 115476.json
 
-and with some extra paths
+and with some extra paths (for gemma)
 
 . .guix-shell ruby --expose=/home/wrk/iwrk/opensource/code/genetics/gemma-wrapper/=/gemma-wrapper --expose=/home/wrk/iwrk/opensource/code/genetics/gemma/=/gemma -- env TMPDIR=tmp guile -L . -s ./scripts/precompute/run-gemma.scm
 
@@ -33,10 +33,21 @@ and with some extra paths
                          (help    (single-char #\h) (value #f))))
          (options (getopt-long args option-spec))
          (help-wanted (option-ref options 'help #f))]
+    (display "RUNNING")
     (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
-")
-  (display "gemma-run")
-)))
+"))
+    (let [(trait-name "115475")]
+      (call-with-input-file "115475.json"
+        (lambda (port)
+          (let* [(json (json->scm port))
+                 (dataset (assoc-ref json "traits"))
+                 (dataset-name (car (car dataset)))
+                 (traits (assoc-ref dataset dataset-name))
+                 ]
+            (display dataset)
+            (write-pheno-file "pheno.txt" traits)
+                                        ; (run-gemma "BXD" data-id probeset-id probesetfreeze-id name trait-name traits)))
+          ))))))