From b1c2e3a1d5e7756c774515cc3bc55447591e8cf1 Mon Sep 17 00:00:00 2001 From: Pjotr Prins Date: Thu, 16 May 2024 03:43:49 -0500 Subject: Write json file for traits --- README.md | 2 ++ scripts/precompute/list-traits-to-compute.scm | 18 ++++++++++++------ 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 7c5a47c..6005264 100644 --- a/README.md +++ b/README.md @@ -18,10 +18,12 @@ GNU Guile allows you to develop against a live running web server using emacs-ge ```sh cd web +unset GUIX_PROFILE . .guix-shell -- guile --listen=1970 -e main ./webserver.scm 8091 ``` Note the leading dot. The .guix-shell is defined in `genenetwork3/gn3-guile/web` and loads required packages using GNU Guix. +If you are on Debian you may need to unset GUIX_PROFILE first. Next fire up emacs with `emacs-geiser-guile` and connect to the running web server with `M-x geiser-connect` and the port `1970`. Now you can not only inspect procedures, but also update any prodedure on the live server using `C-M-x` and get updated output from the webserver! diff --git a/scripts/precompute/list-traits-to-compute.scm b/scripts/precompute/list-traits-to-compute.scm index ea3a013..75e121a 100755 --- a/scripts/precompute/list-traits-to-compute.scm +++ b/scripts/precompute/list-traits-to-compute.scm @@ -19,6 +19,10 @@ test connection with mysql client: mysql -uwebqtlout -pwebqtlout -A -h 127.0.0.1 -P 3306 db_webqtl -e "show tables;" +you can ignore the IPv6 message: + + bind [::1]:3306: Cannot assign requested address + to create a clean slate, for now, update Locus_old with update ProbeSetXRef set Locus_old=NULL; @@ -69,6 +73,7 @@ When that is the case we might as well write the phenotype file because we have ; (rnrs base) (ice-9 getopt-long) (ice-9 match) + (ice-9 textual-ports) (json) (srfi srfi-1) ) @@ -77,12 +82,13 @@ When that is the case we might as well write the phenotype file because we have (define (write-json id recs) (display id) (newline) - (write (scm->json-string (map (lambda (r) - (match (pk r) - [(strain-id . value) (cons (bxd-name strain-id) value)] - )) - (reverse recs)))) - (newline) + (call-with-output-file (string-append (number->string id) ".json") + (lambda (port) + (put-string port (scm->json-string (map (lambda (r) + (match r + [(strain-id . value) (cons (bxd-name strain-id) value)] + )) + (reverse recs)))))) ) (define (write-phenotypes first-id num batch-size) -- cgit v1.2.3