diff options
author | Pjotr Prins | 2024-05-16 04:12:58 -0500 |
---|---|---|
committer | Pjotr Prins | 2024-05-16 04:12:58 -0500 |
commit | c49852be64533ad5deccfaf64a52017ba3744823 (patch) | |
tree | 412af62446215491e5f9726b114f0aba73c05a03 /scripts/precompute | |
parent | b1c2e3a1d5e7756c774515cc3bc55447591e8cf1 (diff) | |
download | gn-guile-c49852be64533ad5deccfaf64a52017ba3744823.tar.gz |
Add json meta record
Diffstat (limited to 'scripts/precompute')
-rwxr-xr-x | scripts/precompute/list-traits-to-compute.scm | 16 |
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 |