aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPjotr Prins2024-01-01 17:47:34 +0100
committerPjotr Prins2024-01-01 17:47:34 +0100
commit691eed969ac4bb9fa43358b9a8e0d1ea43accbea (patch)
tree69a38708a10b8f525b465332796e636aac9d52e6
parent0799806735942cc3d44626c3c8b54402343a47f5 (diff)
downloadgn-guile-691eed969ac4bb9fa43358b9a8e0d1ea43accbea.tar.gz
Run gemma-wrapper with metadata
-rw-r--r--.gitignore2
-rwxr-xr-x.guix-shell2
-rw-r--r--gn/data/dataset.scm11
-rw-r--r--gn/data/genotype.scm2
-rw-r--r--gn/runner/gemma.scm5
-rwxr-xr-xscripts/precompute/precompute-hits.scm11
6 files changed, 18 insertions, 15 deletions
diff --git a/.gitignore b/.gitignore
index fb840e4..55bfd36 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,4 @@
BXD.*
pheno.txt
+GWA.json
+K.json
diff --git a/.guix-shell b/.guix-shell
index 0eb387b..6e68054 100755
--- a/.guix-shell
+++ b/.guix-shell
@@ -4,4 +4,4 @@
echo "Create a shell to run tools."
-guix shell -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 $*
+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 $*
diff --git a/gn/data/dataset.scm b/gn/data/dataset.scm
index 3d96663..c28cf25 100644
--- a/gn/data/dataset.scm
+++ b/gn/data/dataset.scm
@@ -1,11 +1,9 @@
(define-module (gn data dataset)
- ;; #: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 db mysql)
#:use-module (gn data group)
@@ -16,8 +14,11 @@
dataset-name
))
-(define (dataset-name db probesetfreeze-id)
+(define (get-dataset db probesetfreeze-id)
(dbi-query db
(string-append
- "select Name2 from ProbeSetFreeze where Id=" (int-to-string probesetfreeze-id) " limit 1;"))
- (assoc-ref (get-row db) "Name2"))
+ "select Name,Name2,FullName from ProbeSetFreeze where Id=" (int-to-string probesetfreeze-id) " limit 1;"))
+ (get-row db))
+
+(define (dataset-name db probesetfreeze-id)
+ (assoc-ref (get-dataset db probesetfreeze-id) "Name"))
diff --git a/gn/data/genotype.scm b/gn/data/genotype.scm
index a12deee..c7cb63c 100644
--- a/gn/data/genotype.scm
+++ b/gn/data/genotype.scm
@@ -1,5 +1,5 @@
(define-module (gn data genotype)
- ;; #:use-module (json)
+ #:use-module (json)
#:use-module (ice-9 match)
#:use-module (ice-9 format)
#:use-module (ice-9 iconv)
diff --git a/gn/runner/gemma.scm b/gn/runner/gemma.scm
index ff70f57..067800e 100644
--- a/gn/runner/gemma.scm
+++ b/gn/runner/gemma.scm
@@ -39,6 +39,7 @@
;; ---- 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
- (system (string-append "env GEMMA_COMMAND=gemma /gemma-wrapper/bin/gemma-wrapper --verbose --loco --json --debug --parallel -- -gk -g BXD.8_geno.txt.gz -p pheno.txt -a BXD.8_snps.txt" ))
+ ;; --- 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"))
)
diff --git a/scripts/precompute/precompute-hits.scm b/scripts/precompute/precompute-hits.scm
index 8588061..2036adc 100755
--- a/scripts/precompute/precompute-hits.scm
+++ b/scripts/precompute/precompute-hits.scm
@@ -1,10 +1,10 @@
#! Run from base dir with
-.guix-shell -- guile -L . -s ./scripts/precompute/precompute-hits.scm
+. .guix-shell -- guile -L . -s ./scripts/precompute/precompute-hits.scm
and with some extra paths
-.guix-shell ruby --expose=/home/wrk/iwrk/opensource/code/genetics/gemma-wrapper/=/gemma-wrapper --expose=/home/wrk/iwrk/opensource/code/genetics/gemma/=/gemma -- guile -L . -s ./scripts/precompute/precompute-hits.scm
+. .guix-shell ruby --expose=/home/wrk/iwrk/opensource/code/genetics/gemma-wrapper/=/gemma-wrapper --expose=/home/wrk/iwrk/opensource/code/genetics/gemma/=/gemma -- env TMPDIR=tmp guile -L . -s ./scripts/precompute/precompute-hits.scm
You may want to forward a mysql port if there is no DB locally
@@ -25,7 +25,6 @@ ssh -L 3306:127.0.0.1:3306 -f -N tux02.genenetwork.org
)
-
;; potentially you want to test connection with mysql client:
;;
;; mysql -uwebqtlout -pwebqtlout -A -h 127.0.0.1 -P 3306 db_webqtl -e "show tables;"
@@ -59,8 +58,8 @@ ssh -L 3306:127.0.0.1:3306 -f -N tux02.genenetwork.org
;; ---- get first available dataset for precompute:
;; @@ order by dataid - recurse
- (define (get-trait-name db probeset-id)
- (dbi-query db (string-append "select Name,Symbol from ProbeSet where Id=" (int-to-string probeset-id) " limit 1"))
+ (define (get-trait db probeset-id)
+ (dbi-query db (string-append "select Id,Chr,Mb,Name,Symbol,description from ProbeSet where Id=" (int-to-string probeset-id) " limit 1"))
(get-row db)
)
@@ -70,7 +69,7 @@ ssh -L 3306:127.0.0.1:3306 -f -N tux02.genenetwork.org
(data-id-str (int-to-string data-id))
(probesetfreeze-id (assoc-ref hit "ProbeSetFreezeId"))
(probeset-id (assoc-ref hit "ProbeSetId"))
- (trait (get-trait-name db probeset-id))
+ (trait (get-trait db probeset-id))
(trait-name (assoc-ref trait "Name"))
(name (dataset-name db probesetfreeze-id))
]