diff options
Diffstat (limited to 'scripts/precompute')
-rwxr-xr-x | scripts/precompute/precompute-hits.scm | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/scripts/precompute/precompute-hits.scm b/scripts/precompute/precompute-hits.scm index b9dd746..8762a6a 100755 --- a/scripts/precompute/precompute-hits.scm +++ b/scripts/precompute/precompute-hits.scm @@ -11,7 +11,7 @@ (gn data strains) (gn util convert) (gn runner gemma) - (rnrs base) + ; (rnrs base) (ice-9 match) (srfi srfi-1) ) @@ -64,26 +64,34 @@ (probeset-id (assoc-ref hit "ProbeSetId")) (trait (get-trait-name db probeset-id)) (trait-name (assoc-ref trait "Name")) + (name (dataset-name db probesetfreeze-id)) ] (display hit) (display data-id) (newline) - (define name (dataset-name db probesetfreeze-id)) ;; ---- Get strains and phenotypes for this dataset (dbi-query db (string-append "SELECT StrainId,value from ProbeSetData WHERE Id=" data-id-str)) - (define traits (get-rows-apply db + (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)]) - (if (assoc id bxd-strains) + (let* [(id (car strain)) + (name (assoc id bxd-strains))] + (if name lst - (append lst `(,id))))) + (append lst `(,name))))) '() - traits)) + id_traits)) + (define traits (map + (lambda (t) + (match t + ((id . value) (cons (assoc-ref bxd-strains id) value) + ))) + id_traits)) + (display traits) ;; (if (= 0 (length non-bxd)) (if (eq? non-bxd '()) (begin |