aboutsummaryrefslogtreecommitdiff
path: root/scripts/precompute
diff options
context:
space:
mode:
authorPjotr Prins2024-07-07 15:17:48 +0200
committerPjotr Prins2024-07-07 15:17:48 +0200
commitf2e8c637307146a6796c56b0d654427f9c567aa8 (patch)
tree71aface07bcb2e749711235570f5805f51a37ae2 /scripts/precompute
parentc82e6ce80fd26146f6187b9babbba561f3b65973 (diff)
downloadgn-guile-f2e8c637307146a6796c56b0d654427f9c567aa8.tar.gz
precompute: making sure order is correct - validating results
Diffstat (limited to 'scripts/precompute')
-rwxr-xr-xscripts/precompute/list-traits-to-compute.scm19
1 files changed, 10 insertions, 9 deletions
diff --git a/scripts/precompute/list-traits-to-compute.scm b/scripts/precompute/list-traits-to-compute.scm
index 61ce755..fbe89a6 100755
--- a/scripts/precompute/list-traits-to-compute.scm
+++ b/scripts/precompute/list-traits-to-compute.scm
@@ -131,7 +131,8 @@ The following is produced by gemma-wrapper as metadata
(time . ,(date->string (time-utc->date (current-time))))))
(data .
((,id .
- ((probesetfreeze-id . ,probesetfreeze-id)
+ ((group . "BXD")
+ (probesetfreeze-id . ,probesetfreeze-id)
(probeset-id . ,probeset-id)
(name . ,name)
(trait-name . ,trait-name)
@@ -150,6 +151,7 @@ The following is produced by gemma-wrapper as metadata
;; (let [(bxd-strains (memo-bxd-strain-id-names #:used-for-mapping? #t))]
(display "writing-phenotypes...")
(define (run-list-traits-to-compute db num prev-id)
+ ;; ---- Build a query to collect num traits
(let* [(count (if (< batch-size num)
batch-size
num))
@@ -164,7 +166,7 @@ The following is produced by gemma-wrapper as metadata
]
(display query)
(dbi-query db query)
- ;; ---- Walk each resulting trait
+ ;; ---- Walk each resulting trait and build a hash of data-id and list of trait values
(let [(id-traits (get-rows db '()))
(nrecs '())]
(for-each (lambda (r)
@@ -178,21 +180,20 @@ The following is produced by gemma-wrapper as metadata
)]
(set! nrecs (assoc-set! nrecs data-id lst))))
id-traits)
- ;; --- create the json output as a file
- (for-each (lambda (r h)
+ ;; --- create the json output as a file by walking traits and hits
+ (for-each (lambda (h)
(let* [
+ (id (hit-data-id h))
(probeset-id (hit-probeset-id h))
- ;; (data-id-str (int-to-string id))
(probesetfreeze-id (hit-probesetfreeze-id h))
(name (dataset-name db probesetfreeze-id))
(trait (get-trait db probeset-id))
(trait-name (assoc-ref trait "Name"))
+ (recs (assoc-ref nrecs id))
]
- (match r
- ((id . recs) (if (has-bxd? recs)
+ (if (has-bxd? recs)
(write-json-ld id name trait trait-name probesetfreeze-id probeset-id recs)
- ))
- ))) nrecs hits)
+ ))) hits)
(if (> rest 0)
(run-list-traits-to-compute db rest (first (reverse data-ids)))) ;; start precompute
)))