aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPjotr Prins2024-05-16 04:12:58 -0500
committerPjotr Prins2024-05-16 04:12:58 -0500
commitc49852be64533ad5deccfaf64a52017ba3744823 (patch)
tree412af62446215491e5f9726b114f0aba73c05a03
parentb1c2e3a1d5e7756c774515cc3bc55447591e8cf1 (diff)
downloadgn-guile-c49852be64533ad5deccfaf64a52017ba3744823.tar.gz
Add json meta record
-rwxr-xr-xscripts/precompute/list-traits-to-compute.scm16
1 files changed, 11 insertions, 5 deletions
diff --git a/scripts/precompute/list-traits-to-compute.scm b/scripts/precompute/list-traits-to-compute.scm
index 75e121a..7e0660d 100755
--- a/scripts/precompute/list-traits-to-compute.scm
+++ b/scripts/precompute/list-traits-to-compute.scm
@@ -76,20 +76,26 @@ When that is the case we might as well write the phenotype file because we have
(ice-9 textual-ports)
(json)
(srfi srfi-1)
+ (srfi srfi-19) ; time
)
(define (write-json id recs)
(display id)
(newline)
- (call-with-output-file (string-append (number->string id) ".json")
- (lambda (port)
- (put-string port (scm->json-string (map (lambda (r)
+ (let* [(traits (map (lambda (r)
(match r
[(strain-id . value) (cons (bxd-name strain-id) value)]
))
- (reverse recs))))))
- )
+ (reverse recs)))
+ (json-data `((meta .
+ ((id . ,id)
+ (time . ,(date->string (time-utc->date (current-time))))))
+ (traits . ,traits)))]
+ (call-with-output-file (string-append (number->string id) ".json")
+ (lambda (port)
+ (put-string port (scm->json-string json-data))))
+ ))
(define (write-phenotypes first-id num batch-size)
(call-with-db