aboutsummaryrefslogtreecommitdiff
path: root/scripts/precompute
diff options
context:
space:
mode:
authorPjotr Prins2023-11-16 10:16:35 +0100
committerPjotr Prins2023-11-16 10:16:35 +0100
commitd0761ae4837e15419bda1faf1b19ee6823335f3f (patch)
tree5bce395adfc6be1adc1f3f0f6a14bc6b5e519b4b /scripts/precompute
parent58acb7ccf46881708f7552ad303fb156603c29d2 (diff)
downloadgn-guile-d0761ae4837e15419bda1faf1b19ee6823335f3f.tar.gz
Transform SQL output
Diffstat (limited to 'scripts/precompute')
-rwxr-xr-xscripts/precompute/precompute-hits.scm20
1 files changed, 18 insertions, 2 deletions
diff --git a/scripts/precompute/precompute-hits.scm b/scripts/precompute/precompute-hits.scm
index fed05ba..22bf2d7 100755
--- a/scripts/precompute/precompute-hits.scm
+++ b/scripts/precompute/precompute-hits.scm
@@ -26,7 +26,7 @@
(dbi-query db "SELECT StrainId,Strain.Name FROM Strain, StrainXRef WHERE StrainXRef.StrainId = Strain.Id AND StrainXRef.InbredSetId = 1 AND Used_for_mapping='Y' ORDER BY StrainId;")
(db-check db)
-(define (get-rows db)
+(define (display-rows db)
(let [(row (dbi-get_row db))]
(if row
(begin
@@ -37,4 +37,20 @@
)
))
-(get-rows db)
+(define (get-rows db list)
+ (let [(row (dbi-get_row db))]
+ (if row
+ (get-rows db (append list `(,row)))
+ list
+ )))
+
+(define (get-rows-apply db func list)
+ (let [(row (dbi-get_row db))]
+ (if row
+ (get-rows-apply db func (append list `(,(func row))))
+ list
+ )))
+
+; (display (get-rows db '()))
+
+(display (get-rows-apply db (lambda (r) `(,(assoc-ref r "StrainId") . ,(assoc-ref r "Name"))) '()))