From 0668cbe51f9f5f691351ee95e6d4d6567ef50003 Mon Sep 17 00:00:00 2001 From: Pjotr Prins Date: Mon, 13 May 2024 11:21:52 +0200 Subject: Batch run getting traits --- scripts/precompute/list-traits-to-compute.scm | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'scripts') 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) ))) -- cgit v1.2.3