From 08fa74f000c55d42f6e39d9125015ff07cf44d38 Mon Sep 17 00:00:00 2001 From: Pjotr Prins Date: Wed, 8 May 2024 09:16:16 +0200 Subject: Collate trait values --- scripts/precompute/list-traits-to-compute.scm | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/scripts/precompute/list-traits-to-compute.scm b/scripts/precompute/list-traits-to-compute.scm index 6e9dcb3..c87b005 100755 --- a/scripts/precompute/list-traits-to-compute.scm +++ b/scripts/precompute/list-traits-to-compute.scm @@ -88,15 +88,24 @@ When that is the case we might as well write the phenotype file because we have ] (display query) (dbi-query db query) - (let [(id-traits (get-rows-apply db - (lambda (r) - (let [(id (assoc-ref r "Id")) + (let [(id-traits (get-rows db '())) + (nrecs '())] + (for-each (lambda (r) + (let* [(data-id (assoc-ref r "Id")) (strain-id (assoc-ref r "StrainId")) - (value (assoc-ref r "value"))] - `(,id ,strain-id ,value))) - '()))] - (display id-traits)) - )) + (value (assoc-ref r "value")) + (has-lst (assoc-ref nrecs data-id)) + (lst (if has-lst + (acons strain-id value has-lst) + '()) + )] + ;; (display lst) + (set! nrecs (assoc-set! nrecs data-id lst)))) + id-traits) + (for-each (lambda (r) + (write r) (newline)) nrecs) + ; (display nrecs) + ))) (run-list-traits-to-compute db 0 5) ;; start precompute ;; (write bxd-strains) )))) -- cgit v1.2.3