aboutsummaryrefslogtreecommitdiff
path: root/gn/runner/gemma.scm
diff options
context:
space:
mode:
Diffstat (limited to 'gn/runner/gemma.scm')
-rw-r--r--gn/runner/gemma.scm39
1 files changed, 23 insertions, 16 deletions
diff --git a/gn/runner/gemma.scm b/gn/runner/gemma.scm
index bcb4c36..2edb7b2 100644
--- a/gn/runner/gemma.scm
+++ b/gn/runner/gemma.scm
@@ -21,32 +21,39 @@
(display traits)
(newline)
;; ---- write phenotype file
- (let* [(port (mkstemp "pheno.txt-XXXXXX"))
- (pheno-fn (port-filename port))]
- (for-each (lambda (ind)
- (begin
- (let* [(value (assoc-ref traits ind))
- (outvalue (if value
- value
- "NA"))]
- (display outvalue)
- (newline)
- (display outvalue port)
- (newline port))))
- bxd-inds)
- (close port)
+ (let* [(sys-tmpdir (getenv "TMPDIR"))
+ (tmpdir (mkdtemp (string-append sys-tmpdir "/run-gemma-XXXXXX")))
+ (pheno-fn (string-append tmpdir "/pheno.txt"))
+ (k-json-fn (string-append tmpdir "/K.json"))
+ (gwa-json-fn (string-append tmpdir "/GWA.json"))]
+ (call-with-output-file pheno-fn
+ (lambda (port)
+ (for-each (lambda (ind)
+ (begin
+ (let* [(value (assoc-ref traits ind))
+ (outvalue (if value
+ value
+ "NA"))]
+ (display outvalue)
+ (newline)
+ (display outvalue port)
+ (newline port))))
+ bxd-inds)))
;; set up with ./.guix-shell -- guile -L . -s ./scripts/precompute/precompute-hits.scm
;; ---- to start GEMMA precompute inside container
;; env TMPDIR=. LD_LIBRARY_PATH=$GUIX_ENVIRONMENT/lib/ guile -L . -s ./scripts/precompute/precompute-hits.scm
;; --- First we compute K - control output goes to K.json
- (let [(err (system (string-append "env GEMMA_COMMAND=gemma /gemma-wrapper/bin/gemma-wrapper --population \"" population "\" --name \"" name "\" --trait \"" trait-name "\" --verbose --loco --json --debug --parallel -- -gk -g BXD.8_geno.txt.gz -p " pheno-fn " -a BXD.8_snps.txt > K.json" )))]
+ (let [(err (system (string-append "env GEMMA_COMMAND=gemma /gemma-wrapper/bin/gemma-wrapper --population \"" population "\" --name \"" name "\" --trait \"" trait-name "\" --verbose --loco --json --debug --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 "env GEMMA_COMMAND=gemma /gemma-wrapper/bin/gemma-wrapper --population \"" population "\" --name \"" name "\" --trait \"" trait-name "\" --verbose --loco --json --debug --parallel --input K.json -- -g BXD.8_geno.txt.gz -p " pheno-fn " -a BXD.8_snps.txt -lmm 2 -maf 0.1 > GWA.json")))]
+ (let [(err (system (string-append "env GEMMA_COMMAND=gemma /gemma-wrapper/bin/gemma-wrapper --population \"" population "\" --name \"" name "\" --trait \"" trait-name "\" --verbose --loco --json --debug --parallel --input " k-json-fn " -- -g BXD.8_geno.txt.gz -p " pheno-fn " -a BXD.8_snps.txt -lmm 2 -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)
)
)