aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorPjotr Prins2023-11-19 17:14:15 +0100
committerPjotr Prins2023-11-19 17:14:15 +0100
commitf65cada4f70d7449f38f1fef5164d7c52283a0e9 (patch)
tree2323a63a44737b5f02cdb7a3044dabc9dc1cc564 /scripts
parentcd868747703585661efac3b85a423b6dae9b71c2 (diff)
downloadgn-guile-f65cada4f70d7449f38f1fef5164d7c52283a0e9.tar.gz
Iterating through hits
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/precompute/precompute-hits.scm22
1 files changed, 18 insertions, 4 deletions
diff --git a/scripts/precompute/precompute-hits.scm b/scripts/precompute/precompute-hits.scm
index 0088431..d8170db 100755
--- a/scripts/precompute/precompute-hits.scm
+++ b/scripts/precompute/precompute-hits.scm
@@ -6,6 +6,7 @@
(use-modules (dbi dbi)
(gn db mysql)
+ (gn data dataset)
(gn data hits)
(gn data strains)
(gn util convert)
@@ -35,7 +36,7 @@
;(newline)
(define bxd-strains (bxd-strain-id-names #:map? #t))
- ;(display (assoc 64728 bxd-strains))
+ ;(display (assoc 64728 bxd-strains))
;(newline)
;(newline)
;(dbi-query db "SELECT * FROM ProbeSetXRef LIMIT 3")
@@ -47,15 +48,26 @@
;; ---- get first available dataset for precompute:
;; @@ order by dataid - recurse
+ (define (get-trait-name db probeset-id)
+ (dbi-query db (string-append "select Name,Symbol from ProbeSet where Id=" (int-to-string probeset-id) " limit 1"))
+ (get-row db)
+ )
(define (run-precompute db prev-id)
(let* [(hit (get-next-hit-for-precompute db prev-id))
- (data-id (assoc-ref hit "DataId"))]
+ (data-id (assoc-ref hit "DataId"))
+ (data-id-str (int-to-string data-id))
+ (probesetfreeze-id (assoc-ref hit "ProbeSetFreezeId"))
+ (probeset-id (assoc-ref hit "ProbeSetId"))
+ (trait (get-trait-name db probeset-id))
+ (trait-name (assoc-ref trait "Name"))
+ ]
(display hit)
(display data-id)
(newline)
+ (define name (dataset-name db probesetfreeze-id))
;; ---- Get strains and phenotypes for this dataset
- (dbi-query db (string-append "SELECT StrainId,value from ProbeSetData WHERE Id=" (int-to-string data-id)))
+ (dbi-query db (string-append "SELECT StrainId,value from ProbeSetData WHERE Id=" data-id-str))
(define traits (get-rows-apply db
(lambda (r) `(,(assoc-ref r "StrainId") . ,(assoc-ref r "value")))
'()))
@@ -71,10 +83,12 @@
traits))
(if (= 0 (length non-bxd))
(begin
- (display "WE HAVE OUR BXD DATASET for precompute!\n")
+ (if name
+ (display (string-append "WE HAVE OUR BXD DATASET " name " and trait " trait-name " for precompute!\n")))
(display data-id)
(display traits)
(newline)
+
))
(run-precompute db data-id)
))