aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gn/runner/gemma.scm17
-rwxr-xr-xscripts/precompute/run-gemma.scm21
2 files changed, 23 insertions, 15 deletions
diff --git a/gn/runner/gemma.scm b/gn/runner/gemma.scm
index 69991dd..9207316 100644
--- a/gn/runner/gemma.scm
+++ b/gn/runner/gemma.scm
@@ -39,24 +39,27 @@
))
)
-(define (invoke-gemma-wrapper-loco name trait-name pheno-fn)
+(define (invoke-gemma-wrapper-loco name trait-name trait-fn 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"))]
+ (gwa-json-fn (string-append tmpdir "/GWA.json"))
+ (trait-json-fn (string-append tmpdir "/" trait-fn))]
+ (copy-file trait-fn trait-json-fn)
;; --- First we compute K - control output goes to K.json
(let [(err (system (string-append "/gemma-wrapper/bin/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/bin/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)))]
+ (let [(err (system (string-append "/gemma-wrapper/bin/gemma-wrapper --meta \"" trait-json-fn "\" --population \"" population "\" --name \"" name "\" --id \"" trait-name "\" --trait \"" trait-name "\" --verbose --loco --json --lmdb --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)
+ (delete-file pheno-fn)
+ (delete-file gwa-json-fn)
+ (delete-file k-json-fn)
+ (delete-file trait-json-fn)
+ (rmdir tmpdir)
)
)
diff --git a/scripts/precompute/run-gemma.scm b/scripts/precompute/run-gemma.scm
index e6a4e26..9a7bba2 100755
--- a/scripts/precompute/run-gemma.scm
+++ b/scripts/precompute/run-gemma.scm
@@ -39,15 +39,20 @@ and with some extra paths (for gemma)
Usage: list-traits-to-compute [options...]
-h, --help Display this help
"))
- (let [(trait-name "115475")]
- (call-with-input-file "115475.json"
+ (let [(trait-id "115475")
+ (trait-fn "115475.json")
+ ]
+
+ (call-with-input-file trait-fn
(lambda (port)
(let* [(json (json->scm port))
- (dataset (assoc-ref json "traits"))
- (dataset-name (car (car dataset)))
- (traits (assoc-ref dataset dataset-name))
+ (dataset (car (assoc-ref json "data")))
+ (data (cdr dataset))
+ (dataset-name (assoc-ref data "name"))
+ (trait-name (assoc-ref data "trait-name"))
+ (traits (assoc-ref data "traits"))
+ (pheno-fn (string-append trait-id "-pheno.txt"))
]
- (display dataset)
- (write-pheno-file "pheno.txt" traits)
- (invoke-gemma-wrapper-loco dataset-name trait-name "pheno.txt")
+ (write-pheno-file pheno-fn traits)
+ (invoke-gemma-wrapper-loco dataset-name trait-name trait-fn pheno-fn)
))))))