aboutsummaryrefslogtreecommitdiff
path: root/gn
diff options
context:
space:
mode:
authorPjotr Prins2024-01-05 09:27:39 +0100
committerPjotr Prins2024-01-05 09:27:39 +0100
commit162b4c5cfb49766c66d274f9ddb414f6bd4d087e (patch)
treee8c2306d788ac7d59d99b8233262f1f78bb64c62 /gn
parent6fa4d04cf954bc374a8532d285496760f2283f38 (diff)
downloadgn-guile-162b4c5cfb49766c66d274f9ddb414f6bd4d087e.tar.gz
Precompute will run gemma and update the DB status
Diffstat (limited to 'gn')
-rw-r--r--gn/data/hits.scm13
-rw-r--r--gn/runner/gemma.scm8
2 files changed, 18 insertions, 3 deletions
diff --git a/gn/data/hits.scm b/gn/data/hits.scm
index 5108bd0..29d377b 100644
--- a/gn/data/hits.scm
+++ b/gn/data/hits.scm
@@ -15,6 +15,7 @@
#:export (
get-precompute-hit
set-precompute-hit-status!
+ update-precompute!
))
(define (get-precompute-hit db prev-id)
@@ -22,9 +23,19 @@
(get-row db))
(define (set-precompute-hit-status! db data-id-str status-str)
- "Set status of precompute record - typically 'RUN' or 'NON-BXD'.
+ "Set status of precompute record - typically from NULL to 'GEMMA-START' or 'NON-BXD'.
+On completion it is set to 'GEMMA-DONE'.
This is a temporary measure to get precompute going.
Note we are counting on automated MariaDB transactions to not compete."
(dbi-query db (string-append "UPDATE ProbeSetXRef SET Locus_old=\"" status-str "\" WHERE DataId=" data-id-str " AND Locus_old is NULL"))
(ensure db)
)
+
+;; MariaDB [db_webqtl]> UPDATE ProbeSetXRef SET Locus_old=Locus,LRS_old=LRS,Locus="new",LRS=9.9,pValue=1.0,additive=1.0 WHERE ProbeSetFreezeId=1 AND DataId=2 AND Locus_old="GEMMA-START" ;
+
+(define (update-precompute! db data-id-str status-str locus lrs pvalue, additive)
+ "Once precompute is run we can update the table moving old values and plugging in the new.
+"
+ (dbi-query db (string-append "UPDATE ProbeSetXRef SET Locus_old=Locus,LRS_old=LRS,Locus=\"" locus "\",LRS=" lrs ",pValue=" pvalue ",additive=" additive " WHERE DataId=" data-id-str " AND Locus_old is \"GEMMA-START\""))
+ (ensure db)
+ )
diff --git a/gn/runner/gemma.scm b/gn/runner/gemma.scm
index 2edb7b2..a31846a 100644
--- a/gn/runner/gemma.scm
+++ b/gn/runner/gemma.scm
@@ -13,10 +13,11 @@
))
(define (run-gemma population data-id name trait-name traits)
+ "Run gemma-wrapper to compute GRM and GWA. On failure the run will stop(!)"
(define bxd-inds (geno-inds-bxd "BXD.json"))
(assert (= 235 (length bxd-inds)))
(if name
- (display (string-append "WE HAVE OUR BXD DATASET " name " and trait " trait-name " for precompute!\n")))
+ (display (string-append "WE HAVE OUR " population " DATASET " name " and trait " trait-name " for precompute!\n")))
(display data-id)
(display traits)
(newline)
@@ -38,7 +39,9 @@
(newline)
(display outvalue port)
(newline port))))
- bxd-inds)))
+ bxd-inds)
+ (close port)
+ ))
;; set up with ./.guix-shell -- guile -L . -s ./scripts/precompute/precompute-hits.scm
@@ -56,4 +59,5 @@
(delete-file k-json-fn)
(rmdir tmpdir)
)
+ #t
)