about summary refs log tree commit diff
path: root/scripts/precompute
diff options
context:
space:
mode:
authorPjotr Prins2024-05-09 10:33:53 +0200
committerPjotr Prins2024-05-09 10:33:53 +0200
commit8e8263c374f84fb9cbd6c3a0da7b7f17e6e06c72 (patch)
treebe3058f7185311cc867f4a371fa41b741f967edd /scripts/precompute
parentbac78b1607851096cdf48c46bbd1e5dd9c31fe96 (diff)
downloadgn-guile-8e8263c374f84fb9cbd6c3a0da7b7f17e6e06c72.tar.gz
Full test for whether a data-id belongs to the BXD
Diffstat (limited to 'scripts/precompute')
-rwxr-xr-xscripts/precompute/list-traits-to-compute.scm27
1 files changed, 7 insertions, 20 deletions
diff --git a/scripts/precompute/list-traits-to-compute.scm b/scripts/precompute/list-traits-to-compute.scm
index 1fadb4a..e954b14 100755
--- a/scripts/precompute/list-traits-to-compute.scm
+++ b/scripts/precompute/list-traits-to-compute.scm
@@ -70,25 +70,11 @@ When that is the case we might as well write the phenotype file because we have
              (srfi srfi-1)
              )
 
-(define (is-bxd? trait-values)
-  (display "HEY")
-  (display trait-values)
-  (newline)
-  (match trait-values
-    [(trait . rest) (begin
-                      (display "PARSE")
-                      (display trait)
-                      (match trait
-                        [(strain . value) (if (= strain 5)
-                                              #f
-                                              (is-bxd? rest))])
-                      (newline))]
-    [() #f]))
 
 (call-with-db
  (lambda (db)
    (begin
-     (let [(bxd-strains (bxd-strain-id-names #:used-for-mapping? #t))]
+     (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))
                 (data-ids (map (lambda (hit)
@@ -101,7 +87,7 @@ When that is the case we might as well write the phenotype file because we have
                 (data-ids-query (string-join data-str-ids " OR "))
                 (query (string-append "SELECT Id,StrainId,value FROM ProbeSetData WHERE " data-ids-query))
                 ]
-           (display query)
+           ;; (display query)
            (dbi-query db query)
            (let [(id-traits (get-rows db '()))
                  (nrecs '())]
@@ -114,15 +100,16 @@ When that is the case we might as well write the phenotype file because we have
                                    (acons strain-id value has-lst)
                                    '())
                                )]
-                      ;; (display lst)
                       (set! nrecs (assoc-set! nrecs data-id lst))))
                        id-traits)
              (for-each (lambda (r)
-                         (if (is-bxd? (cdr r))
-                             (display r)
+                         (if (has-bxd? (cdr r))
+                             (begin
+                               (display (car r))
+                               (newline))
                          )) nrecs)
              ; (display nrecs)
            )))
-       (run-list-traits-to-compute db 0 5) ;; start precompute
+       (run-list-traits-to-compute db 0 1000) ;; start precompute
        ;; (write bxd-strains)
        ))))