aboutsummaryrefslogtreecommitdiff
path: root/gn
diff options
context:
space:
mode:
authorPjotr Prins2024-01-04 12:51:45 +0100
committerPjotr Prins2024-01-04 12:51:45 +0100
commit0721d15f275ce9abd55e60955265997f0e39db3d (patch)
tree31a7e79c2c4697f4d5ecadb8f391b9380c944942 /gn
parent691eed969ac4bb9fa43358b9a8e0d1ea43accbea (diff)
downloadgn-guile-0721d15f275ce9abd55e60955265997f0e39db3d.tar.gz
Call precompute with population name - BXD only, for now
Diffstat (limited to 'gn')
-rw-r--r--gn/data/population.scm28
-rw-r--r--gn/runner/gemma.scm11
2 files changed, 35 insertions, 4 deletions
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))))