diff options
-rwxr-xr-x | scripts/precompute/list-traits-to-compute.scm | 35 |
1 files changed, 29 insertions, 6 deletions
diff --git a/scripts/precompute/list-traits-to-compute.scm b/scripts/precompute/list-traits-to-compute.scm index 08ed48d..5c3dfa3 100755 --- a/scripts/precompute/list-traits-to-compute.scm +++ b/scripts/precompute/list-traits-to-compute.scm @@ -81,6 +81,26 @@ When that is the case we might as well write the phenotype file because we have (srfi srfi-19) ; time ) +#! + +The following is produced by gemma-wrapper as metadata + + "meta": { + "type": "gemma-wrapper", + "version": "0.99.7-pre1", + "population": "BXD", + "name": "HC_U_0304_R", + "trait": "101500_at", + "url": "https://genenetwork.org/show_trait?trait_id=101500_at&dataset=HC_U_0304_R", + "archive_GRM": "46bfba373fe8c19e68be6156cad3750120280e2e-gemma-cXX.tar.xz", + "archive_GWA": "779a54a59e4cd03608178db4068791db4ca44ab3-gemma-GWA.tar.xz", + "dataid": 75629, + "probesetid": 1097, + "probesetfreezeid": 7 + } + +!# + (define (write-json-ld id dataset-id recs) ;; see also https://www.w3.org/2018/jsonld-cg-reports/json-ld/ @@ -131,6 +151,7 @@ When that is the case we might as well write the phenotype file because we have ] (display query) (dbi-query db query) + ;; ---- Walk each resulting trait (let [(id-traits (get-rows db '())) (nrecs '())] (for-each (lambda (r) @@ -144,12 +165,14 @@ When that is the case we might as well write the phenotype file because we have )] (set! nrecs (assoc-set! nrecs data-id lst)))) id-traits) - (for-each (lambda (r) - (match r - ((id . recs) (if (has-bxd? recs) - (write-json-ld id (findit data-ids) recs) - )) - )) nrecs) + ;; --- create the json output as a file + (for-each (lambda (r hit) + (let [(probeset-id (assoc-ref hit "ProbeSetId"))] + (match r + ((id . recs) (if (has-bxd? recs) + (write-json-ld id probeset-id recs) + )) + ))) nrecs hits) (if (> rest 0) (run-list-traits-to-compute db rest (first (reverse data-ids)))) ;; start precompute ))) |