aboutsummaryrefslogtreecommitdiff
path: root/gn
diff options
context:
space:
mode:
authorPjotr Prins2024-06-29 06:17:38 -0500
committerPjotr Prins2024-06-29 06:17:38 -0500
commit3fcc0a58f6a4ad3f86e0e8c96b58ad8bc179b3cf (patch)
treedfb19fba52071d6a7222eeac3caa9cbbc8de41a7 /gn
parent191a98261ad8336c51a59655c2bf3a3b282f00fe (diff)
downloadgn-guile-3fcc0a58f6a4ad3f86e0e8c96b58ad8bc179b3cf.tar.gz
Using a record instead of assoc is cleaner
Diffstat (limited to 'gn')
-rw-r--r--gn/data/hits.scm20
1 files changed, 17 insertions, 3 deletions
diff --git a/gn/data/hits.scm b/gn/data/hits.scm
index f7ce49e..88dee11 100644
--- a/gn/data/hits.scm
+++ b/gn/data/hits.scm
@@ -5,6 +5,7 @@
#:use-module (ice-9 iconv)
#:use-module (ice-9 receive)
#:use-module (ice-9 string-fun)
+ #:use-module (srfi srfi-9)
;; #:use-module (gn db sparql)
#:use-module (dbi dbi)
#:use-module (gn db mysql)
@@ -17,11 +18,24 @@
get-precompute-hit
set-precompute-hit-status!
update-precompute!
+ hit-data-id
+ hit-probeset-id
))
-(define (get-precompute-hits db prev-id num)
- (dbi-query db (string-append "select Locus, DataId, ProbeSetId, ProbeSetFreezeId from ProbeSetXRef where DataId>" (int-to-string prev-id) " AND Locus_old is NULL ORDER BY DataId LIMIT " (format #f "~d" num)))
- (get-rows db '()))
+
+(define-record-type <hit>
+ (make-hit data-id probeset-id)
+ hit?
+ (data-id hit-data-id)
+ (probeset-id hit-probeset-id)
+ )
+
+(define (get-precompute-hits db first-id num)
+ (dbi-query db (string-append "select Locus, DataId, ProbeSetId, ProbeSetFreezeId from ProbeSetXRef where DataId>" (int-to-string first-id) " AND Locus_old is NULL ORDER BY DataId LIMIT " (format #f "~d" num)))
+ (map (lambda (r)
+ (make-hit (assoc-ref r "DataId") (assoc-ref r "ProbeSetId")))
+ (get-rows db '())
+ ))
(define (get-precompute-hit db prev-id)
(car (get-precompute-hits db prev-id 1)))