aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xscripts/precompute/list-traits-to-compute.scm19
1 files changed, 12 insertions, 7 deletions
diff --git a/scripts/precompute/list-traits-to-compute.scm b/scripts/precompute/list-traits-to-compute.scm
index 0bcef3e..3f59863 100755
--- a/scripts/precompute/list-traits-to-compute.scm
+++ b/scripts/precompute/list-traits-to-compute.scm
@@ -73,13 +73,17 @@ When that is the case we might as well write the phenotype file because we have
)
-(define (write-phenotypes first-id count)
+(define (write-phenotypes first-id num batch-size)
(call-with-db
(lambda (db)
(begin
(let [(bxd-strains (memo-bxd-strain-id-names #:used-for-mapping? #t))]
- (define (run-list-traits-to-compute db prev-id count)
- (let* [(hits (get-precompute-hits db prev-id count))
+ (define (run-list-traits-to-compute db num2 prev-id)
+ (let* [(count (if (< batch-size num2)
+ batch-size
+ num2))
+ (rest (- num2 count))
+ (hits (get-precompute-hits db prev-id count))
(data-ids (map (lambda (hit)
(let* [(data-id (assoc-ref hit "DataId"))
; (data-id-str (int-to-string data-id))
@@ -110,10 +114,11 @@ When that is the case we might as well write the phenotype file because we have
(begin
(display (car r))
(newline))
- )) nrecs)
- ; (display nrecs)
+ )) nrecs)
+ (if (> rest 0)
+ (run-list-traits-to-compute db rest (first (reverse data-ids)))) ;; start precompute
)))
- (run-list-traits-to-compute db first-id count) ;; start precompute
+ (run-list-traits-to-compute db num first-id) ;; start precompute
;; (write bxd-strains)
)))))
@@ -135,5 +140,5 @@ Usage: list-traits-to-compute [options...]
-n, --next count In batches of count size (default 5)
-h, --help Display this help
")
- (write-phenotypes start-id next)
+ (write-phenotypes start-id next 10)
)))