aboutsummaryrefslogtreecommitdiff
path: root/gn/packages/ratspub.scm
diff options
context:
space:
mode:
authorpjotrp2020-05-06 09:16:01 -0500
committerpjotrp2020-05-06 09:16:01 -0500
commita26d7f7eacefcd4c3b2339f81d99218f4b36dc69 (patch)
tree1d6a1d6b8afea9d4bb935cc0a3911d3fe9771c3e /gn/packages/ratspub.scm
parent52ba4c45ddf6fcb811e88c5efb12dca200c0bd7e (diff)
parent5390e28c3308d0f9ce7ee2b96c9c4f31e3a7861b (diff)
downloadguix-bioinformatics-a26d7f7eacefcd4c3b2339f81d99218f4b36dc69.tar.gz
Merge branch 'master' of http://git.genenetwork.org/guix-bioinformatics/guix-bioinformatics
Diffstat (limited to 'gn/packages/ratspub.scm')
-rw-r--r--gn/packages/ratspub.scm213
1 files changed, 187 insertions, 26 deletions
diff --git a/gn/packages/ratspub.scm b/gn/packages/ratspub.scm
index 29e1313..b664799 100644
--- a/gn/packages/ratspub.scm
+++ b/gn/packages/ratspub.scm
@@ -1,11 +1,16 @@
(define-module (gn packages ratspub)
#:use-module ((guix licenses) #:prefix license:)
+ #:use-module (guix utils)
+ #:use-module (gnu packages)
#:use-module (guix packages)
#:use-module (guix git-download)
#:use-module (guix build-system python)
#:use-module (gnu packages admin)
- #:use-module (gn packages bioinformatics)
+ #:use-module (gnu packages bioinformatics)
#:use-module (gn packages javascript)
+ #:use-module (gnu packages machine-learning)
+ #:use-module (gnu packages python)
+ #:use-module (gnu packages python-crypto)
#:use-module (gnu packages python-web)
#:use-module (gnu packages python-xyz)
#:use-module (gn packages web))
@@ -13,19 +18,27 @@
(define-public ratspub
(package
(name "ratspub")
- (version "0.1")
+ (version "0.3.1")
(source (origin
- (method git-fetch)
- (uri (git-reference
- (url "https://github.com/chen42/ratspub.git")
- (commit (string-append "v" version))))
- (file-name (git-file-name name version))
- (sha256
- (base32
- "0cm9g38fxpa52458mdmhzhghj5c7b8l3k1b764zs9hdrki5s7wi7"))))
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/chen42/ratspub.git")
+ (commit (string-append "v" version))))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32
+ "1ii3721mqd3dbpjkhqi7yqjd9bqcf0g19kdbb8265pmbfjjsg164"))
+ (modules '((guix build utils)))
+ (snippet
+ '(begin (substitute* "server.py"
+ ;; Keep the service running on port 4200
+ (("4201") "4200")
+ ;; Backport to python-keras-2.2.4
+ (("learning_rate") "lr") )
+ #t))))
(build-system python-build-system)
(arguments
- `(#:tests? #f ; no test suite
+ `(#:tests? #f ; no test suite
#:phases
(modify-phases %standard-phases
(delete 'configure)
@@ -34,12 +47,24 @@
(lambda* (#:key inputs outputs #:allow-other-keys)
(let ((out (assoc-ref outputs "out"))
(inetutils (assoc-ref inputs "inetutils")))
- (substitute* "templates/cytoscape.html"
+ (substitute* '("templates/cytoscape.html"
+ "templates/tableview.html"
+ "templates/tableview0.html"
+ "templates/userarchive.html")
(("script src=.*")
"script src=\"/static/cytoscape.min.js\"></script>\n"))
(substitute* "templates/layout.html"
- (("https://stackpath.bootstrapcdn.com/bootstrap/.*")
- "/static/bootstrap.min.css\">\n"))
+ (("https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css.*")
+ "/static/bootstrap.min.css\">\n")
+ (("https://.*.bootstrapcdn.com/bootstrap/4.*/js/bootstrap.min.js.*")
+ "/static/bootstrap.min.js\"></script>\n")
+ (("https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css")
+ "/static/font-awesome.min.css")
+ (("https://code.jquery.com/jquery-3.2.1.slim.min.js.*")
+ "/static/jquery.slim.min.js\"></script>\n")
+ ;(("https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js.*")
+ ; "/static/popper.min.js\"></script>\n")
+ )
(substitute* "ratspub.py"
(("hostname") (string-append inetutils "/bin/hostname"))))
#t))
@@ -51,31 +76,58 @@
(add-after 'install 'install-javascript
(lambda* (#:key inputs outputs #:allow-other-keys)
(let ((out (assoc-ref outputs "out"))
+ (awesome (assoc-ref inputs "font-awesome"))
+ (bootstrap (assoc-ref inputs "bootstrap"))
(cytoscape (assoc-ref inputs "cytoscape"))
- (bootstrap (assoc-ref inputs "bootstrap")))
+ (jquery (assoc-ref inputs "jquery"))
+ ;(js-popper (assoc-ref inputs "js-popper"))
+ )
+ (symlink (string-append awesome
+ "/share/web/font-awesomecss/font-awesome.min.css")
+ (string-append out "/static/font-awesome.min.css"))
+ (symlink (string-append bootstrap
+ "/share/web/bootstrap/css/bootstrap.min.css")
+ (string-append out "/static/bootstrap.min.css"))
+ (symlink (string-append bootstrap
+ "/share/web/bootstrap/js/bootstrap.min.js")
+ (string-append out "/static/bootstrap.min.js"))
(symlink (string-append cytoscape
"/share/genenetwork2/javascript/cytoscape/cytoscape.min.js")
(string-append out "/static/cytoscape.min.js"))
- (symlink (string-append bootstrap
- "/share/web/bootstrap/css/bootstrap.min.css")
- (string-append out "/static/bootstrap.min.css")))
+ (symlink (string-append jquery
+ "/share/web/jquery/jquery.slim.min.js")
+ (string-append out "/static/jquery.slim.min.js"))
+ ;(symlink (string-append js-popper
+ ; "/share/web/popper/popper.min.js")
+ ; (string-append out "/static/popper.min.js"))
+ )
#t))
(add-after 'install 'wrap-executable
(lambda* (#:key inputs outputs #:allow-other-keys)
(let ((out (assoc-ref outputs "out"))
(path (getenv "PYTHONPATH")))
(wrap-program (string-append out "/server.py")
- `("PATH" ":" prefix (,(dirname (which "edirect.pl"))))
- `("PYTHONPATH" ":" prefix (,path))))
+ `("PATH" ":" prefix (,(dirname (which "edirect.pl"))
+ ,(dirname (which "dirname"))
+ ,(dirname (which "grep"))
+ ,(dirname (which "sed"))))
+ `("PYTHONPATH" ":" prefix (,path))))
#t)))))
(inputs
- `(("edirect" ,edirect-gn)
+ `(("edirect" ,edirect)
("inetutils" ,inetutils)
- ("python-flask" ,python-flask)
- ("python-nltk" ,python-nltk)))
+ ("python-bcrypt" ,python-bcrypt)
+ ("python-flask-sqlalchemy" ,python-flask-sqlalchemy)
+ ("python-keras" ,python-keras-for-ratspub)
+ ("python-nltk" ,python-nltk)
+ ("tensorflow" ,tensorflow)))
(native-inputs
- `(("cytoscape" ,javascript-cytoscape)
- ("bootstrap" ,web-bootstrap)))
+ `(("bootstrap" ,web-bootstrap)
+ ("cytoscape" ,javascript-cytoscape)
+ ("font-awesome" ,web-font-awesome)
+ ("jquery" ,web-jquery)
+ ;("js-popper" ,js-popper) ; empty output
+ ))
(home-page "http://rats.pub/")
(synopsis "Relationship with Addiction Through Searches of PubMed")
(description
@@ -86,4 +138,113 @@ the question \"What do we know about these genes and addiction?\". Data from
@acronym{EBI GWAS, European Bioinformatics Institute Genome-Wide Association
Studies} catalog are also included in the search to better answer this
question.")
- (license #f)))
+ (license license:expat)))
+
+;; We want a copy of python-keras with the AUC optimizer backported.
+;; We skip the tests because we "test in production".
+;; That's a lie. The test suite just takes a long time to run.
+(define-public python-keras-for-ratspub
+ (hidden-package
+ (package
+ (inherit python-keras)
+ (source
+ (origin
+ (inherit (package-source python-keras))
+ (patches (search-patches "keras-auc-optimizer.patch"))))
+ (arguments
+ (substitute-keyword-arguments (package-arguments python-keras)
+ ((#:phases phases)
+ `(modify-phases ,phases
+ (delete 'check))))))))
+
+(define-public hrdp-project
+ (package
+ (name "hrdp-project")
+ (version "0.1")
+ (source (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/noderboarder/hrdp-project")
+ (commit (string-append "v" version))))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32
+ "1ag7jm43p35yh0cqcn53wg4iw7sgfypw10mxq5klxvhgj3r6cf7i"))))
+ (build-system python-build-system)
+ (arguments
+ `(#:tests? #f ; no test suite
+ #:phases
+ (modify-phases %standard-phases
+ (delete 'configure)
+ (delete 'build)
+ (add-after 'unpack 'patch-sources
+ (lambda _
+ (substitute* "./app/templates/layout.html"
+ (("https://.*.bootstrapcdn.com/bootstrap/4.*/css/bootstrap.min.css.*")
+ "/static/bootstrap.min.css\">\n")
+ (("https://.*.bootstrapcdn.com/bootstrap/4.*/js/bootstrap.min.js.*")
+ "/static/bootstrap.min.js\"></script>\n")
+ (("https://code.jquery.com/jquery-3.*.slim.min.js.*")
+ "/static/jquery.slim.min.js\"></script>\n")
+ ;(("https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js.*")
+ ; "/static/popper.min.js\"></script>\n")
+ )
+ #t))
+ (replace 'install
+ (lambda* (#:key inputs outputs #:allow-other-keys)
+ (let ((out (assoc-ref outputs "out"))
+ (python (assoc-ref inputs "python")))
+ (delete-file "main.py")
+ (with-output-to-file "main.py"
+ (lambda ()
+ (format #t "#!~a/bin/python
+from app import create_app
+
+app = create_app()
+
+if __name__ == '__main__':
+ app.run(debug=True, port=4222)~%"
+ python)))
+ (chmod "main.py" #o555)
+ (copy-recursively "." out))
+ #t))
+ (add-after 'install 'install-javascript
+ (lambda* (#:key inputs outputs #:allow-other-keys)
+ (let ((out (assoc-ref outputs "out"))
+ (bootstrap (assoc-ref inputs "bootstrap"))
+ (jquery (assoc-ref inputs "jquery"))
+ ;(js-popper (assoc-ref inputs "js-popper"))
+ )
+ (symlink (string-append bootstrap
+ "/share/web/bootstrap/css/bootstrap.min.css")
+ (string-append out "/app/static/bootstrap.min.css"))
+ (symlink (string-append bootstrap
+ "/share/web/bootstrap/js/bootstrap.min.js")
+ (string-append out "/app/static/bootstrap.min.js"))
+ (symlink (string-append jquery
+ "/share/web/jquery/jquery.slim.min.js")
+ (string-append out "/app/static/jquery.slim.min.js"))
+ ;(symlink (string-append js-popper
+ ; "/share/web/popper/popper.min.js")
+ ; (string-append out "/static/popper.min.js"))
+ )
+ #t))
+ (add-after 'install 'wrap-executable
+ (lambda* (#:key inputs outputs #:allow-other-keys)
+ (let ((out (assoc-ref outputs "out"))
+ (path (getenv "PYTHONPATH")))
+ (wrap-program (string-append out "/main.py")
+ `("PYTHONPATH" ":" prefix (,path))))
+ #t)))))
+ (inputs
+ `(("python" ,python)
+ ("python-flask-sqlalchemy" ,python-flask-sqlalchemy)))
+ (native-inputs
+ `(("bootstrap" ,web-bootstrap)
+ ("jquery" ,web-jquery)
+ ;("js-popper" ,js-popper) ; empty output
+ ))
+ (home-page "https://github.com/noderboarder/hrdp-project")
+ (synopsis "")
+ (description "")
+ (license license:expat)))