From 191a98261ad8336c51a59655c2bf3a3b282f00fe Mon Sep 17 00:00:00 2001 From: Pjotr Prins Date: Sat, 29 Jun 2024 04:34:18 -0500 Subject: Get trait features - now need to refactor --- scripts/precompute/list-traits-to-compute.scm | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'scripts/precompute/list-traits-to-compute.scm') diff --git a/scripts/precompute/list-traits-to-compute.scm b/scripts/precompute/list-traits-to-compute.scm index 3e2acb3..a9e1340 100755 --- a/scripts/precompute/list-traits-to-compute.scm +++ b/scripts/precompute/list-traits-to-compute.scm @@ -81,6 +81,11 @@ When that is the case we might as well write the phenotype file because we have (srfi srfi-19) ; time ) +(define (get-trait db probeset-id) + (dbi-query db (string-append "select Id,Chr,Mb,Name,Symbol,description from ProbeSet where Id=" (int-to-string probeset-id) " limit 1")) + (get-row db) + ) + #! The following is produced by gemma-wrapper as metadata @@ -167,14 +172,13 @@ The following is produced by gemma-wrapper as metadata id-traits) ;; --- create the json output as a file (for-each (lambda (r hit) - (let [(probeset-id (assoc-ref hit "ProbeSetId")) - (data-id (assoc-ref hit "DataId")) - (data-id-str (int-to-string data-id)) - (probesetfreeze-id (assoc-ref hit "ProbeSetFreezeId")) - (probeset-id (assoc-ref hit "ProbeSetId")) - (trait (get-trait db probeset-id)) - (trait-name (assoc-ref trait "Name")) - (name (dataset-name db probesetfreeze-id)) + (let* [(probeset-id (assoc-ref hit "ProbeSetId")) + (data-id (assoc-ref hit "DataId")) + (data-id-str (int-to-string data-id)) + (probesetfreeze-id (assoc-ref hit "ProbeSetFreezeId")) + (trait (get-trait db probeset-id)) + (trait-name (assoc-ref trait "Name")) + (name (dataset-name db probesetfreeze-id)) ] (match r ((id . recs) (if (has-bxd? recs) -- cgit v1.2.3