aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEfraim Flashner2019-12-24 03:28:49 -0600
committerEfraim Flashner2019-12-24 03:28:49 -0600
commitca7beb74e1aae5c1f9e44d5da9f44143467d253b (patch)
tree00862658352883b95f7c5db5489ecef5546604d6
parent49415a72997507597342f8e9ca2281042d3cba3b (diff)
downloadguix-bioinformatics-ca7beb74e1aae5c1f9e44d5da9f44143467d253b.tar.gz
update BNW and service
-rw-r--r--gn/packages/bnw.scm92
-rw-r--r--gn/services/bnw-container.scm12
-rw-r--r--gn/services/bnw.service2
3 files changed, 60 insertions, 46 deletions
diff --git a/gn/packages/bnw.scm b/gn/packages/bnw.scm
index 5b7131b..5c97eab 100644
--- a/gn/packages/bnw.scm
+++ b/gn/packages/bnw.scm
@@ -14,7 +14,7 @@
(define-public bnw
(let ((commit "eb6b002b924694808384f1a8d7c6d1121806ae04")
- (revision "4"))
+ (revision "5"))
(package
(name "bnw")
(version (git-version "1.22" revision commit)) ; June 28, 2019
@@ -38,7 +38,8 @@
(substitute* "index.html"
(("url=home.php") "url=sourcecodes/home.php"))
(substitute* "home.php"
- (("http://bnw.genenetwork.org/BNW_1.22") "http://bnw-test.genenetwork.org"))
+ (("http://bnw.genenetwork.org/BNW_1.22")
+ "http://bnw-test.genenetwork.org"))
(substitute* "sourcecodes/header_batchsearch.inc"
(("my_style.css") "my_new_style.css"))
(substitute* (find-files "." "\\.php")
@@ -50,48 +51,58 @@
#t))
(add-after 'patch-source-shebangs 'patch-more-shebangs
(lambda* (#:key inputs #:allow-other-keys)
- (let* ((bash (assoc-ref inputs "bash"))
- (graphviz (assoc-ref inputs "graphviz"))
- (octave (assoc-ref inputs "octave"))
- (python (assoc-ref inputs "python"))
- (rmath (assoc-ref inputs "rmath"))
- (jquery (assoc-ref inputs "jquery"))
- (awesome (assoc-ref inputs "awesome"))
- (cyto (assoc-ref inputs "cytoscape"))
- (cyto2 (assoc-ref inputs "cytoscape-2"))
- (cs-dagre (assoc-ref inputs "cyto-dagre"))
- (d3js (assoc-ref inputs "d3js"))
- (d3js-multi (assoc-ref inputs "d3js-multi"))
- (dagre (assoc-ref inputs "dagre"))
- (lodash (assoc-ref inputs "lodash"))
- (canvas-toblob (assoc-ref inputs "canvas-toblob"))
- (filesaver (assoc-ref inputs "filesaver"))
- (panzoom (assoc-ref inputs "panzoom"))
- (js-path "/share/genenetwork2/javascript/"))
+ (let ((bash (assoc-ref inputs "bash"))
+ (graphviz (assoc-ref inputs "graphviz"))
+ (octave (assoc-ref inputs "octave"))
+ (python (assoc-ref inputs "python"))
+ (rmath (assoc-ref inputs "rmath")))
(for-each (lambda (file)
(patch-shebang file
(list (string-append bash "/bin")
(string-append octave "/bin")
(string-append python "/bin"))))
(find-files "." ".*"))
- (substitute* '("sourcecodes/examplefilecopy.sh"
- "sourcecodes/filecopy.sh")
- (("^rm") (which "rm"))
- (("\\ cp") (string-append " " (which "cp"))))
(substitute* (find-files "sourcecodes" "(^run|py$)")
- (("/home/jziebart/python/Python-2.7.15/python") (which "python2")))
+ (("/home/jziebart/python/Python-2.7.15/python")
+ (which "python2")))
(substitute*
(append (find-files "sourcecodes" ".php")
(find-files "sourcecodes/run_scripts" ".*"))
(("/usr/bin/dot") (string-append graphviz "/bin/dot")))
(substitute* '("sourcecodes/build.sh"
"downloads/BNW/src/build.sh")
- (("./localscore/libRmath.so") (string-append rmath "/lib/libRmath.so")))
- (substitute* "sourcecodes/run.sh"
- (("rm ") (string-append (which "rm") " "))
- (("rmdir ") (string-append (which "rmdir") " "))
+ (("./localscore/libRmath.so")
+ (string-append rmath "/lib/libRmath.so")))
+ (substitute* (find-files "." "\\.sh$")
+ (("cat ") (string-append (which "cat") " "))
+ (("\\ cp") (string-append " " (which "cp")))
+ (("date ") (string-append (which "date") " "))
+ (("dirname \\$0") (string-append (which "dirname")" $0"))
+ (("dirname \"\\$0") (string-append (which "dirname")" \"$0"))
+ (("expr ") (string-append (which "expr") " "))
+ (("head ") (string-append (which "head") " "))
(("mkdir ") (string-append (which "mkdir") " "))
- (("dirname ") (string-append (which "dirname")" ")))
+ (("^rm ") (string-append (which "rm") " "))
+ (("rmdir ") (string-append (which "rmdir") " "))
+ (("wc ") (string-append (which "wc") " ")))
+ #t)))
+ ;(add-after 'patch-source-shebangs 'replace-javascript
+ ; (lambda* (#:key inputs #:allow-other-keys)
+ ; (let (
+ ; (jquery (assoc-ref inputs "jquery"))
+ ; (awesome (assoc-ref inputs "awesome"))
+ ; (cyto (assoc-ref inputs "cytoscape"))
+ ; (cyto2 (assoc-ref inputs "cytoscape-2"))
+ ; (cs-dagre (assoc-ref inputs "cyto-dagre"))
+ ; (d3js (assoc-ref inputs "d3js"))
+ ; (d3js-multi (assoc-ref inputs "d3js-multi"))
+ ; (dagre (assoc-ref inputs "dagre"))
+ ; (lodash (assoc-ref inputs "lodash"))
+ ; (canvas-toblob (assoc-ref inputs "canvas-toblob"))
+ ; (filesaver (assoc-ref inputs "filesaver"))
+ ; (panzoom (assoc-ref inputs "panzoom"))
+ ; (js-path "/share/genenetwork2/javascript/")
+ ; )
;(substitute* "sourcecodes/layout_cyto.php"
; (("https://cdnjs.cloudflare.com/ajax/libs/cytoscape/3.7.1/cytoscape.min.js")
; (string-append cyto js-path "cytoscape/cytoscape.min.js"))
@@ -121,8 +132,8 @@
; (string-append canvas-toblob js-path "canvas-toBlob/canvas-toBlob.js"))
; (("https://cdn.rawgit.com/eligrey/FileSaver.js/e9d941381475b5df8b7d7691013401e171014e89/FileSaver.min.js")
; (string-append filesaver js-path "filesaver/filesaver.js")))
- )
- #t))
+ ; )
+ ; #t))
(replace 'install
(lambda* (#:key outputs #:allow-other-keys)
(let ((out (assoc-ref outputs "out")))
@@ -136,7 +147,8 @@
(chmod file #o555))
(append (find-files out "\\.(sh|py)$")
(find-files (string-append out "/sourcecodes/run_scripts/" "."))))
- (chmod (string-append out "/sourcecodes/data") #o777) ; needs to be writable
+ ;; This folder needs to be writable.
+ (chmod (string-append out "/sourcecodes/data") #o777)
#t)))
(replace 'build
(lambda _
@@ -155,26 +167,28 @@
(inputs
`(("graphviz" ,graphviz-2.26)
("octave" ,octave-3.4.3)
- ("python" ,python-2)
("plotly" ,python2-plotly-3.2.1)
+ ("python" ,python-2)
("rmath" ,rmath-standalone)
- ("jquery" ,web-jquery)
+ ;; the javascript libraries:
("awesome" ,web-font-awesome)
+ ("canvas-toblob" ,javascript-canvas-toblob)
+ ("cyto-dagre" ,javascript-cytoscape-dagre)
("cytoscape" ,javascript-cytoscape)
("cytoscape-2" ,javascript-cytoscape-2)
("d3js" ,javascript-d3js-4)
("d3js-multi" ,javascript-d3js-multi)
("dagre" ,javascript-dagre)
- ("lodash" ,javascript-lodash)
- ("canvas-toblob" ,javascript-canvas-toblob)
("filesaver" ,javascript-filesaver)
- ("cyto-dagre" ,javascript-cytoscape-dagre)
+ ("jquery" ,web-jquery)
+ ("lodash" ,javascript-lodash)
("panzoom" ,javascript-cytoscape-panzoom)))
(native-inputs
`(("gcc" ,gcc-5)))
(home-page "http://compbio.uthsc.edu/BNW/")
(synopsis "Bayesian Network Webserver")
- (description "This contains the code for the @dfn{Bayesian Network Webserver} (BNW).")
+ (description
+ "This contains the code for the @dfn{Bayesian Network Webserver} (BNW).")
(license (list license:gpl2
license:gpl2+
license:lgpl2.1+)))))
diff --git a/gn/services/bnw-container.scm b/gn/services/bnw-container.scm
index 2e5e521..c896020 100644
--- a/gn/services/bnw-container.scm
+++ b/gn/services/bnw-container.scm
@@ -13,7 +13,7 @@
(package bnw-configuration-package ; package
(default bnw))
(deploy-directory bnw-deploy-directory ; string
- (default "/home/bnw/server"))
+ (default "/srv/http"))
(port bnw-configuration-port ; list of strings
(default '("8880"))))
@@ -23,11 +23,12 @@
#~(begin
(use-modules (guix build utils))
(when (directory-exists? #$deploy-directory)
- (delete-file-recusively #$deploy-directory))
+ ;; Not 'delete-file-recursively' because the directory might be empty.
+ (system* "rm" "-r" #$(string-append deploy-directory "/*")))
(mkdir-p #$deploy-directory)
(copy-recursively #$package #$deploy-directory)
- (system* #$(file-append coreutils "/bin/chmod") "a+w"
- (string-append #$deploy-directory "/sourcecodes/data"))))))
+ (invoke #$(file-append coreutils "/bin/chmod") "a+w"
+ (string-append #$deploy-directory "/sourcecodes/data"))))))
(define bnw-nginx-config
(match-lambda
@@ -37,7 +38,7 @@
(server-name '("Bayesian Network"))
(listen port)
;(root package)
- (root "/srv/http")
+ (root deploy-directory)
(locations
(list
(nginx-php-location)
@@ -81,6 +82,5 @@
(service bnw-service-type
;; The following is for testing:
;(bnw-configuration
- ; (deploy-directory "/home/efraimf/bnw")
; (port '("8888")))
))))
diff --git a/gn/services/bnw.service b/gn/services/bnw.service
index ec7b3f8..5ba8f3f 100644
--- a/gn/services/bnw.service
+++ b/gn/services/bnw.service
@@ -3,7 +3,7 @@ Description=BNW web server
Wants=guix-daemon.service
[Service]
-Environment="BNW_COMMAND=$(/bin/su -l bnw -c '/var/guix/profiles/per-user/bnw/current-guix/bin/guix system container /home/bnw/guix-bioinformatics/gn/services/bnw-container.scm --share=/home/bnw/server=/srv/http --network')"
+Environment="BNW_COMMAND=$(/bin/su -l bnw -c '/var/guix/profiles/per-user/bnw/current-guix/bin/guix system container /home/bnw/guix-bioinformatics/gn/services/bnw-container.scm --share=/home/bnw/server=/srv/http --share=/home/bnw/server/var-log=/var/log --network')"
ExecStart=/bin/bash -c '${BNW_COMMAND}'
[Install]