From 3fcc0a58f6a4ad3f86e0e8c96b58ad8bc179b3cf Mon Sep 17 00:00:00 2001 From: Pjotr Prins Date: Sat, 29 Jun 2024 06:17:38 -0500 Subject: Using a record instead of assoc is cleaner --- scripts/precompute/list-traits-to-compute.scm | 28 +++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'scripts/precompute/list-traits-to-compute.scm') diff --git a/scripts/precompute/list-traits-to-compute.scm b/scripts/precompute/list-traits-to-compute.scm index a9e1340..199f457 100755 --- a/scripts/precompute/list-traits-to-compute.scm +++ b/scripts/precompute/list-traits-to-compute.scm @@ -78,6 +78,7 @@ When that is the case we might as well write the phenotype file because we have (json) (rnrs bytevectors) (srfi srfi-1) + (srfi srfi-9) (srfi srfi-19) ; time ) @@ -146,9 +147,8 @@ The following is produced by gemma-wrapper as metadata num)) (rest (- num count)) (hits (get-precompute-hits db prev-id count)) - (data-ids (map (lambda (hit) - (let* [(data-id (assoc-ref hit "DataId"))] - data-id)) + (data-ids (map (lambda (h) + (hit-data-id h)) hits)) (data-str-ids (map (lambda (id) (string-append "Id=" (int-to-string id))) data-ids)) (data-ids-query (string-join data-str-ids " OR ")) @@ -171,20 +171,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 hit) - (let* [(probeset-id (assoc-ref hit "ProbeSetId")) - (data-id (assoc-ref hit "DataId")) - (data-id-str (int-to-string data-id)) - (probesetfreeze-id (assoc-ref hit "ProbeSetFreezeId")) - (trait (get-trait db probeset-id)) - (trait-name (assoc-ref trait "Name")) - (name (dataset-name db probesetfreeze-id)) - ] + (for-each (lambda (r h) + ;; (let* [;; (probeset-id (assoc-ref hit "ProbeSetId")) + ;; (data-id (assoc-ref hit "DataId")) + ;; (data-id-str (int-to-string data-id)) + ;; (probesetfreeze-id (assoc-ref hit "ProbeSetFreezeId")) + ;; (trait (get-trait db probeset-id)) + ;; (trait-name (assoc-ref trait "Name")) + ;; (name (dataset-name db probesetfreeze-id)) + ;; ] (match r ((id . recs) (if (has-bxd? recs) - (write-json-ld id probeset-id recs) + (write-json-ld id (hit-probeset-id h) recs) )) - ))) nrecs hits) + )) nrecs hits) (if (> rest 0) (run-list-traits-to-compute db rest (first (reverse data-ids)))) ;; start precompute ))) -- cgit v1.2.3