aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/precompute/list-traits-to-compute.scm34
1 files changed, 20 insertions, 14 deletions
diff --git a/scripts/precompute/list-traits-to-compute.scm b/scripts/precompute/list-traits-to-compute.scm
index 199f457..9a548b7 100755
--- a/scripts/precompute/list-traits-to-compute.scm
+++ b/scripts/precompute/list-traits-to-compute.scm
@@ -108,17 +108,20 @@ The following is produced by gemma-wrapper as metadata
!#
-(define (write-json-ld id dataset-id recs)
+(define (write-json-ld id name trait trait-name probeset-id recs)
;; see also https://www.w3.org/2018/jsonld-cg-reports/json-ld/
(display id)
(display ":")
- (display dataset-id)
+ (display name)
+ (display ":")
+ (display trait-name)
(newline)
(let* [(traits (map (lambda (r)
(match r
[(strain-id . value) (cons (bxd-name strain-id) value)]
))
(reverse recs)))
+ (uri (format #f "https://genenetwork.org/show_trait?trait_id=~a&dataset=~a" trait-name name))
(sha256 (sha-256->string (sha-256 (string->utf8 (scm->json-string traits)))))
(json-data `(("@context" . "https://genenetwork.org/resource")
(type . traits)
@@ -128,8 +131,11 @@ The following is produced by gemma-wrapper as metadata
(time . ,(date->string (time-utc->date (current-time))))))
(data .
((,id .
- ((dataset . ,dataset-id)
- (traits . ,traits)))))))]
+ ((probeset-id . ,probeset-id)
+ (name . ,name)
+ (trait-name . ,trait-name)
+ (traits . ,traits)
+ (uri . ,uri)))))))]
(call-with-output-file (string-append (number->string id) ".json")
(lambda (port)
(put-string port (scm->json-string json-data))))
@@ -172,19 +178,19 @@ The following is produced by gemma-wrapper as metadata
id-traits)
;; --- create the json output as a file
(for-each (lambda (r h)
- ;; (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))
- ;; ]
+ (let* [
+ (probeset-id (hit-probeset-id h))
+ ;; (data-id-str (int-to-string id))
+ (probesetfreeze-id (hit-probesetfreeze-id h))
+ (name (dataset-name db probesetfreeze-id))
+ (trait (get-trait db probeset-id))
+ (trait-name (assoc-ref trait "Name"))
+ ]
(match r
((id . recs) (if (has-bxd? recs)
- (write-json-ld id (hit-probeset-id h) recs)
+ (write-json-ld id name trait trait-name probeset-id recs)
))
- )) nrecs hits)
+ ))) nrecs hits)
(if (> rest 0)
(run-list-traits-to-compute db rest (first (reverse data-ids)))) ;; start precompute
)))