aboutsummaryrefslogtreecommitdiff
path: root/gn/packages/ratspub.scm
blob: 339459252357aad944182bc17cb7ef039c220138 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
(define-module (gn packages ratspub)
  #:use-module ((guix licenses) #:prefix license:)
  #: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 (gn packages javascript)
  #:use-module (gnu packages time)
  #:use-module (gnu packages python-crypto)
  #:use-module (gnu packages python-web)
  #:use-module (gnu packages python-xyz)
  #:use-module (gn packages web))

(define-public ratspub
  (let ((commit "1b516ee692248f4cd75570d9750b14f78554b41f")
        (revision "1"))
    (package
      (name "ratspub")
      (version (git-version "0.2" revision commit))
      (source (origin
                (method git-fetch)
                (uri (git-reference
                       (url "https://github.com/chen42/ratspub.git")
                       (commit commit)))
                (file-name (git-file-name name version))
                (sha256
                 (base32
                  "16zr89993h1idkazradivm9yjgl695wdr34d2qbwj4nmaxfrg8dy"))))
      (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* (#:key inputs outputs #:allow-other-keys)
               (let ((out       (assoc-ref outputs "out"))
                     (inetutils (assoc-ref inputs "inetutils")))
                 (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/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/poppler.js\"></script>\n"))
                 (substitute* "ratspub.py"
                   (("hostname") (string-append inetutils "/bin/hostname"))))
               #t))
           (replace 'install
             (lambda* (#:key outputs #:allow-other-keys)
               (let ((out (assoc-ref outputs "out")))
                 (copy-recursively "." out))
               #t))
           (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"))
                     (jquery    (assoc-ref inputs "jquery"))
                     (js-poppler (assoc-ref inputs "js-poppler")))
                 (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 jquery
                                         "/share/web/jquery/jquery.slim.min.js")
                          (string-append out "/static/jquery.slim.min.js"))
                 (symlink (string-append js-poppler
                                         "/share/web/poppler/poppler.min.js")
                          (string-append out "/static/poppler.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"))
                                                     ,(dirname (which "dirname"))
                                                     ,(dirname (which "grep"))
                                                     ,(dirname (which "sed"))))
                               `("PYTHONPATH" ":" prefix (,path))))
               #t)))))
      (inputs
       `(("edirect" ,edirect-gn)
         ("inetutils" ,inetutils)
         ("python-bcrypt" ,python-bcrypt)
         ("python-flask" ,python-flask)
         ("python-flask-sqlalchemy" ,python-flask-sqlalchemy)
         ("python-nltk" ,python-nltk)
         ("python-pytz" ,python-pytz)))
      (native-inputs
       `(("bootstrap" ,web-bootstrap)
         ("cytoscape" ,javascript-cytoscape)
         ("font-awesome" ,web-font-awesome)
         ("jquery" ,web-jquery)
         ("js-poppler" ,js-poppler)))
      (home-page "http://rats.pub/")
      (synopsis "Relationship with Addiction Through Searches of PubMed")
      (description
       "RatsPub searches PubMed to find sentences that contain the query terms
(i.e., gene symbols) and drug addiction-related keywords.  These gene-keyword
relationships are presented as an interactive graph that can efficiently answer
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))))