aboutsummaryrefslogtreecommitdiff
path: root/scripts/precompute
diff options
context:
space:
mode:
authorPjotr Prins2023-11-15 07:46:12 +0100
committerPjotr Prins2023-11-15 07:46:12 +0100
commit58acb7ccf46881708f7552ad303fb156603c29d2 (patch)
tree3138cc8484d6e934bc901110f2580bc041574668 /scripts/precompute
parent12e43794a12a94e45c25cadf5d167697c16c4f5f (diff)
downloadgn-guile-58acb7ccf46881708f7552ad303fb156603c29d2.tar.gz
Return list of BXD
Diffstat (limited to 'scripts/precompute')
-rw-r--r--scripts/precompute/README.md4
-rwxr-xr-xscripts/precompute/precompute-hits.scm34
2 files changed, 31 insertions, 7 deletions
diff --git a/scripts/precompute/README.md b/scripts/precompute/README.md
index c1f2efc..4c4dc87 100644
--- a/scripts/precompute/README.md
+++ b/scripts/precompute/README.md
@@ -5,3 +5,7 @@ Some work on precompute is documented [here](https://issues.genenetwork.org/topi
# Install and run
See the header of [precompute-hits.scm](precompute-hits.scm).
+
+# Development
+
+My preferred way of developing is tunneling mysql from a remote, running guile3 in a separate guix shell and geiser-connect from emacs. See my [guix-shell](../../.guix-shell).
diff --git a/scripts/precompute/precompute-hits.scm b/scripts/precompute/precompute-hits.scm
index 7986f6a..fed05ba 100755
--- a/scripts/precompute/precompute-hits.scm
+++ b/scripts/precompute/precompute-hits.scm
@@ -1,20 +1,40 @@
#! Run from base dir with
-. .guix-shell -- guile -L . -s ./scripts/precompute/precompute-hits.scm
+.guix-shell -- guile -L . -s ./scripts/precompute/precompute-hits.scm
!#
(use-modules (dbi dbi)
(gn db mysql)
+ (rnrs base)
+ (ice-9 match)
)
;; potentially you want to test connection with mysql client:
;;
-;; mysql -uwebqtlout -pwebqtlout -A -h 127.0.0.1 -P 3306
+;; mysql -uwebqtlout -pwebqtlout -A -h 127.0.0.1 -P 3306 db_webqtl -e "show tables;"
;;
-(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))]
+(define db (dbi-open "mysql" "webqtlout:webqtlout:db_webqtl:tcp:127.0.0.1:3306"))
+(db-check db)
+(dbi-query db "SELECT * FROM ProbeSetXRef LIMIT 3")
+(db-check db)
+; (display (dbi-get_status db_webqtl))
+(let [(row (dbi-get_row db))]
(display row)
-)
+ )
+
+(dbi-query db "SELECT StrainId,Strain.Name FROM Strain, StrainXRef WHERE StrainXRef.StrainId = Strain.Id AND StrainXRef.InbredSetId = 1 AND Used_for_mapping='Y' ORDER BY StrainId;")
+(db-check db)
+
+(define (get-rows db)
+ (let [(row (dbi-get_row db))]
+ (if row
+ (begin
+ (display row)
+ (get-rows db)
+ )
+ #f
+ )
+ ))
+
+(get-rows db)