aboutsummaryrefslogtreecommitdiff
path: root/gn/runner
diff options
context:
space:
mode:
Diffstat (limited to 'gn/runner')
-rw-r--r--gn/runner/gemma.scm29
1 files changed, 26 insertions, 3 deletions
diff --git a/gn/runner/gemma.scm b/gn/runner/gemma.scm
index 4c1c374..ec2a4d6 100644
--- a/gn/runner/gemma.scm
+++ b/gn/runner/gemma.scm
@@ -11,6 +11,7 @@
#:export (
write-pheno-file
+ invoke-gemma-wrapper-loco
run-gemma
))
@@ -27,8 +28,10 @@
(outvalue (if value
value
"NA"))]
- (format #t "~s ~s" ind outvalue)
- (newline)
+ (if value
+ (begin
+ (format #t "~s ~s" ind outvalue)
+ (newline)))
(display outvalue port)
(newline port))))
bxd-inds)
@@ -36,6 +39,27 @@
))
)
+(define (invoke-gemma-wrapper-loco name trait-name pheno-fn)
+ "Create a tmpdir and invoke gemma-wrapper using parallel LOCO. Note that at this point we use a number of defaults for BXD"
+ (let* [(population "BXD")
+ (sys-tmpdir (getenv "TMPDIR"))
+ (tmpdir (mkdtemp (string-append sys-tmpdir "/run-gemma-XXXXXX")))
+ (k-json-fn (string-append tmpdir "/K.json"))
+ (gwa-json-fn (string-append tmpdir "/GWA.json"))]
+ ;; --- First we compute K - control output goes to K.json
+ (let [(err (system (string-append "gemma-wrapper --verbose --population \"" population "\" --name \"" name "\" --trait \"" trait-name "\" --verbose --loco --json --parallel -- -gk -g BXD.8_geno.txt.gz -p " pheno-fn " -a BXD.8_snps.txt > " k-json-fn )))]
+ (if (not (= err 0))
+ (exit err)))
+ (let [(err (system (string-append "gemma-wrapper --population \"" population "\" --name \"" name "\" --id \"" trait-name "\" --trait \"" trait-name "\" --verbose --loco --json --input " k-json-fn " -- -g BXD.8_geno.txt.gz -p " pheno-fn " -a BXD.8_snps.txt -lmm 9 -maf 0.1 > " gwa-json-fn)))]
+ (if (not (= err 0))
+ (exit err)))
+ ;; (delete-file pheno-fn)
+ ;; (delete-file gwa-json-fn)
+ ;; (delete-file k-json-fn)
+ ;; (rmdir tmpdir)
+ )
+ )
+
(define (run-gemma population data-id probeset-id probesetfreeze-id name trait-name traits)
"Run gemma-wrapper to compute GRM and GWA. On failure the run will stop(!)"
(define ids (string-append (int-to-string data-id) ","
@@ -46,7 +70,6 @@
(display ids)
(display traits)
(newline)
- ;; ---- write phenotype file
(let* [(sys-tmpdir (getenv "TMPDIR"))
(tmpdir (mkdtemp (string-append sys-tmpdir "/run-gemma-XXXXXX")))
(pheno-fn (string-append tmpdir "/pheno.txt"))