diff options
author | Pjotr Prins | 2024-01-04 15:29:21 +0100 |
---|---|---|
committer | Pjotr Prins | 2024-01-04 15:29:21 +0100 |
commit | 5600deccdd446cd8f1c287479051590236fb2959 (patch) | |
tree | ff864c2b5016dd56a6017b952e55d43f48ac96d0 /gn | |
parent | 0721d15f275ce9abd55e60955265997f0e39db3d (diff) | |
download | gn-guile-5600deccdd446cd8f1c287479051590236fb2959.tar.gz |
Use tmpfn for pheno output
Diffstat (limited to 'gn')
-rw-r--r-- | gn/runner/gemma.scm | 50 |
1 files changed, 27 insertions, 23 deletions
diff --git a/gn/runner/gemma.scm b/gn/runner/gemma.scm index d6b08f2..bcb4c36 100644 --- a/gn/runner/gemma.scm +++ b/gn/runner/gemma.scm @@ -21,28 +21,32 @@ (display traits) (newline) ;; ---- write phenotype file - (call-with-output-file "pheno.txt" - (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))) + (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) - ;; set up with ./.guix-shell -- guile -L . -s ./scripts/precompute/precompute-hits.scm + ;; 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.txt -a BXD.8_snps.txt > K.json" )))] - (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.txt -a BXD.8_snps.txt -lmm 2 -maf 0.1 > GWA.json")))] - (if (not (= err 0)) - (exit err)))) + ;; ---- 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" )))] + (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")))] + (if (not (= err 0)) + (exit err))) + (delete-file pheno-fn) + ) + ) |