#! Run from base dir with .guix-shell -- guile -L . -s ./scripts/precompute/precompute-hits.scm !# (use-modules (dbi dbi) (gn db mysql) (gn data strains) (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 db_webqtl -e "show tables;" ;; (call-with-db (lambda (db) (begin ;(newline) ; (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;") ; (let [(row (get-row db))] ; (display row) ; ) ;(let [(result (get-rows-apply db (lambda (r) `(,(assoc-ref r "StrainId") . ,(assoc-ref r "Name"))) '()))] ; (display (car result))) ;(newline) (define bxd-strains (bxd-strain-id-names #:map? #t)) (display (assoc 64728 bxd-strains)) (newline) ;(newline) ;(dbi-query db "SELECT * FROM ProbeSetXRef LIMIT 3") ;(let [(row (get-row db))] ; (display row) ; ) ;(db-check2 db) ;(newline) ;; get first dataset for precompute (dbi-query db "select ProbeSetId, Locus, DataId from ProbeSetXRef where Locus_old is NULL LIMIT 1") (display (get-row db)) (newline) )))