aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-x.guix-shell2
-rw-r--r--gn/data/population.scm28
-rw-r--r--gn/runner/gemma.scm11
-rwxr-xr-xscripts/precompute/precompute-hits.scm6
4 files changed, 39 insertions, 8 deletions
diff --git a/.guix-shell b/.guix-shell
index 6e68054..d5e9c38 100755
--- a/.guix-shell
+++ b/.guix-shell
@@ -4,4 +4,4 @@
echo "Create a shell to run tools."
-guix shell -L ~/guix-bioinformatics -C -D -F --network coreutils guile guile-dbi guile-dbd-mysql guile-fibers guile-json guile-gnutls guile-readline guile-redis openssl nss-certs gemma parallel tar xz python python-lmdb python-cffi gemma-gn2 $*
+guix shell -L ~/guix-bioinformatics -C -D -F --network coreutils guile guile-dbi guile-dbd-mysql guile-fibers guile-json guile-gnutls guile-readline guile-redis openssl nss-certs gemma parallel tar xz python python-lmdb python-cffi time gemma-gn2 $*
diff --git a/gn/data/population.scm b/gn/data/population.scm
new file mode 100644
index 0000000..46ef04c
--- /dev/null
+++ b/gn/data/population.scm
@@ -0,0 +1,28 @@
+(define-module (gn data population)
+ #:use-module (json)
+ #:use-module (ice-9 match)
+ #:use-module (ice-9 format)
+ #:use-module (ice-9 iconv)
+ #:use-module (ice-9 receive)
+ #:use-module (ice-9 string-fun)
+ ;; #:use-module (gn db sparql)
+ #:use-module (dbi dbi)
+ #:use-module (gn data group)
+ #:use-module (gn db mysql)
+ #:use-module (gn util convert)
+ #:use-module (web gn-uri)
+
+ #:export (
+ population-info
+ ))
+
+(define* (population-info id)
+ "
+Return population (InbredSet) info by GN ID
+"
+ (call-with-db
+ (lambda (db)
+ (dbi-query db (string-append
+ "SELECT InbredSetId,InbredSetName,Name,SpeciesId,FullName WHERE"
+ (int-to-string id) " LIMIT 1"))
+ (get-row db))))
diff --git a/gn/runner/gemma.scm b/gn/runner/gemma.scm
index 067800e..d6b08f2 100644
--- a/gn/runner/gemma.scm
+++ b/gn/runner/gemma.scm
@@ -12,7 +12,7 @@
run-gemma
))
-(define (run-gemma data-id name trait-name traits)
+(define (run-gemma population data-id name trait-name traits)
(define bxd-inds (geno-inds-bxd "BXD.json"))
(assert (= 235 (length bxd-inds)))
(if name
@@ -40,6 +40,9 @@
;; ---- 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
- (system (string-append "env GEMMA_COMMAND=gemma /gemma-wrapper/bin/gemma-wrapper --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" ))
- (system (string-append "env GEMMA_COMMAND=gemma /gemma-wrapper/bin/gemma-wrapper --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"))
- )
+ (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))))
diff --git a/scripts/precompute/precompute-hits.scm b/scripts/precompute/precompute-hits.scm
index 2036adc..0fabe8f 100755
--- a/scripts/precompute/precompute-hits.scm
+++ b/scripts/precompute/precompute-hits.scm
@@ -44,9 +44,9 @@ ssh -L 3306:127.0.0.1:3306 -f -N tux02.genenetwork.org
;(let [(result (get-rows-apply db (lambda (r) `(,(assoc-ref r "StrainId") . ,(assoc-ref r "Name"))) '()))]
; (display (car result)))
- ;(newline)
+ ;; ---- fetch all known BXD sample/individual/strain names
(define bxd-strains (bxd-strain-id-names #:map? #t))
- ;(display (assoc 64728 bxd-strains))
+ ;(display (assoc 64728 bxd-strains))
;(newline)
;(newline)
;(dbi-query db "SELECT * FROM ProbeSetXRef LIMIT 3")
@@ -103,7 +103,7 @@ ssh -L 3306:127.0.0.1:3306 -f -N tux02.genenetwork.org
(if (eq? non-bxd '())
(begin
(set-precompute-hit-status! db data-id-str "GEMMA-START")
- (run-gemma data-id name trait-name traits)))
+ (run-gemma "BXD" data-id name trait-name traits)))
;; disable precompute if non-bxd, for now, so it won't try again
(set-precompute-hit-status! db data-id-str "NON-BXD")
;;(run-precompute db data-id)