aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/precompute/list-traits-to-compute.scm80
1 files changed, 37 insertions, 43 deletions
diff --git a/scripts/precompute/list-traits-to-compute.scm b/scripts/precompute/list-traits-to-compute.scm
index 3cba292..68f0711 100755
--- a/scripts/precompute/list-traits-to-compute.scm
+++ b/scripts/precompute/list-traits-to-compute.scm
@@ -59,47 +59,41 @@ Now list the next 1000 trait IDs:
(dbi-query db (string-append "select Id,Chr,Mb,Name,Symbol,description from ProbeSet where Id=" (int-to-string probeset-id) " limit 1"))
(get-row db))
(define (run-list-traits-to-compute db prev-id count)
- (let [(hit (get-precompute-hit db prev-id))]
- (if hit
- (let* [(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 db probeset-id))
- (trait-name (assoc-ref trait "Name"))
- (name (dataset-name db probesetfreeze-id))
- ]
- (display hit)
- (newline)
- ;; ---- Get strains and phenotypes for this dataset
- (dbi-query db (string-append "SELECT StrainId,value from ProbeSetData WHERE Id=" data-id-str))
- (define id_traits (get-rows-apply db
- (lambda (r) `(,(assoc-ref r "StrainId") . ,(assoc-ref r "value")))
- '()))
- ;; ---- Now we need to make sure that all strains belong to BXD
- (define non-bxd (fold
- (lambda (strain lst)
- (let* [(id (car strain))
- (name (assoc id bxd-strains))]
- (if name
- lst
- (append lst `(,name)))))
-
- '()
- id_traits))
- (define traits (map
- (lambda (t)
- (match t
- ((id . value) (cons (assoc-ref bxd-strains id) value)
- )))
- id_traits))
- (if (eq? non-bxd '())
- (set-precompute-hit-status! db data-id-str "GEMMA-START")
- ;; disable precompute if non-bxd, for now, so it won't try again
- (set-precompute-hit-status! db data-id-str "NON-BXD"))
- (if (> count 0)
- (run-list-traits-to-compute db data-id (- count 1)) ;; next round
- )
- ))))
+ (let [(hits (get-precompute-hits db prev-id count))]
+ (for-each (lambda (hit)
+ (let* [(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 db probeset-id))
+ ;; (trait-name (assoc-ref trait "Name"))
+ ;; (name (dataset-name db probesetfreeze-id))
+ ]
+ (display hit)
+ (newline)
+ ;; ---- Get strains and phenotypes for this dataset
+ (dbi-query db (string-append "SELECT StrainId,value from ProbeSetData WHERE Id=" data-id-str))
+ (define id_traits (get-rows-apply db
+ (lambda (r) `(,(assoc-ref r "StrainId") . ,(assoc-ref r "value")))
+ '()))
+ ;; ---- Now we need to make sure that all strains belong to BXD
+ (define non-bxd (fold
+ (lambda (strain lst)
+ (let* [(id (car strain))
+ (name (assoc id bxd-strains))]
+ (if name
+ lst
+ (append lst `(,name)))))
+
+ '()
+ id_traits))
+ (define traits (map
+ (lambda (t)
+ (match t
+ ((id . value) (cons (assoc-ref bxd-strains id) value)
+ )))
+ id_traits))
+ #t))
+ hits)))
(run-list-traits-to-compute db 0 5) ;; start precompute
-)))
+ )))