aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorPjotr Prins2024-05-13 11:21:52 +0200
committerPjotr Prins2024-05-13 11:21:52 +0200
commit0668cbe51f9f5f691351ee95e6d4d6567ef50003 (patch)
tree554bbfbc1ac28c43280b1368191ce68915396c25 /scripts
parent88b3327e37c1c99e7cca48b718ff5d2992e2cd1e (diff)
downloadgn-guile-0668cbe51f9f5f691351ee95e6d4d6567ef50003.tar.gz
Batch run getting traits
Diffstat (limited to 'scripts')
-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)
)))