aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-x[-rw-r--r--].guix-shell (renamed from scripts/precompute/.guix-shell)5
-rw-r--r--gn/db/mysql.scm15
-rw-r--r--scripts/precompute/README.md4
-rwxr-xr-xscripts/precompute/precompute-hits.scm20
4 files changed, 40 insertions, 4 deletions
diff --git a/scripts/precompute/.guix-shell b/.guix-shell
index 08c74f9..645b8c6 100644..100755
--- a/scripts/precompute/.guix-shell
+++ b/.guix-shell
@@ -1,10 +1,7 @@
#!/bin/bash
#
-# run with options '-- ./webserver.scm 8091' e.g.
-# . .guix-shell -- guile -L .. --fresh-auto-compile --listen=1970 -e main ./webserver.scm 8091
+# . .guix-shell -- guile -L .. --fresh-auto-compile --listen=1970
echo "Create a shell to run tools. In the container"
-echo "mkdir /usr/bin -p"
-echo "ln -s \$GUIX_ENVIRONMENT/bin/env /usr/bin/env"
guix shell -C -F --network coreutils guile guile-dbi guile-dbd-mysql guile-fibers guile-json guile-gnutls guile-readline guile-redis openssl nss-certs $*
diff --git a/gn/db/mysql.scm b/gn/db/mysql.scm
new file mode 100644
index 0000000..c84605d
--- /dev/null
+++ b/gn/db/mysql.scm
@@ -0,0 +1,15 @@
+(define-module (gn db mysql)
+ #:use-module (json)
+ #:use-module (ice-9 match)
+ #:use-module (ice-9 format)
+ #:use-module (ice-9 iconv)
+ #:use-module (ice-9 receive)
+ #:use-module (ice-9 string-fun)
+
+ #:export (
+ open-db
+ )
+)
+
+(define open-db
+ #t)
diff --git a/scripts/precompute/README.md b/scripts/precompute/README.md
index 53f846e..c1f2efc 100644
--- a/scripts/precompute/README.md
+++ b/scripts/precompute/README.md
@@ -1,3 +1,7 @@
# Precompute
Some work on precompute is documented [here](https://issues.genenetwork.org/topics/systems/mariadb/precompute-mapping-input-data). This is WIP.
+
+# Install and run
+
+See the header of [precompute-hits.scm](precompute-hits.scm).
diff --git a/scripts/precompute/precompute-hits.scm b/scripts/precompute/precompute-hits.scm
new file mode 100755
index 0000000..7986f6a
--- /dev/null
+++ b/scripts/precompute/precompute-hits.scm
@@ -0,0 +1,20 @@
+#! Run from base dir with
+
+. .guix-shell -- guile -L . -s ./scripts/precompute/precompute-hits.scm
+
+!#
+
+(use-modules (dbi dbi)
+ (gn db mysql)
+ )
+
+;; potentially you want to test connection with mysql client:
+;;
+;; mysql -uwebqtlout -pwebqtlout -A -h 127.0.0.1 -P 3306
+;;
+(define db_webqtl (dbi-open "mysql" "webqtlout:webqtlout:db_webqtl:tcp:127.0.0.1:3306"))
+(dbi-query db_webqtl "SELECT * FROM ProbeSetXRef LIMIT 3")
+(display (dbi-get_status db_webqtl))
+(let [(row (dbi-get_row db_webqtl))]
+ (display row)
+)