aboutsummaryrefslogtreecommitdiff
path: root/gn/past/genenetwork1.scm
blob: c557ee71184df5e78ef3896d04e00fa6bf79ce66 (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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
;; Bioinformatics module

(define-module (gn past genenetwork1)
  #:use-module ((guix licenses) #:prefix license:)
  #:use-module (guix packages)
  #:use-module (guix utils)
  #:use-module (guix download)
  #:use-module (guix git-download)
  #:use-module (guix build-system cargo)
  #:use-module (guix build-system gnu)
  #:use-module (guix build-system python)
  #:use-module (guix build-system trivial)
  #:use-module (guix graph)
  #:use-module (guix scripts graph)
  #:use-module (guix store)
  #:use-module (guix gexp)
  #:use-module (gnu packages)
  #:use-module (gnu packages base)
  #:use-module (gnu packages bioconductor)
  #:use-module (gnu packages bioinformatics)
  #:use-module (gnu packages bootstrap)
  #:use-module (gnu packages check)
  #:use-module (gnu packages cran)
  #:use-module (gnu packages crates-io)
  #:use-module (gnu packages compression)
  #:use-module (gnu packages databases)
  #:use-module (gnu packages ghostscript)
  #:use-module (gnu packages graphviz)
  #:use-module (gnu packages parallel)
  #:use-module (gnu packages python)
  #:use-module (gnu packages python-check)
  #:use-module (gnu packages python-crypto)
  #:use-module (gnu packages python-science)
  #:use-module (gnu packages python-web)
  #:use-module (gnu packages python-xyz)
  #:use-module (gnu packages rdf)
  #:use-module (gnu packages scheme)
  #:use-module (gnu packages statistics)
  #:use-module (gnu packages version-control)
  #:use-module (gnu packages vim)
  #:use-module (gnu packages web)
  #:use-module (gnu packages wget)
  #:use-module (gnu packages xml)
  #:use-module (past packages python)
  #:use-module (past packages web)
  #:use-module (gn packages bioinformatics)
  #:use-module (gn packages twint)
  #:use-module (gn packages databases)
  #:use-module (gn packages elixir)
  #:use-module (gn packages gemma)
  #:use-module (gn packages javascript)
  #:use-module (gn packages phewas)
  #:use-module (gn packages python)
  #:use-module (gn packages python24)
  #:use-module (gn packages statistics)
  #:use-module (gn packages web)
  #:use-module (srfi srfi-1))


(define-public python2-qtlreaper
  (let ((commit "442c217b90393380a8634ff8636b44992f5c53dd"))
  (package
    (name "python2-qtlreaper")
    (version (string-append "1.11-gn2-" (string-take commit 7) ))
    (source (origin
             (method git-fetch)
             (uri (git-reference
                   ;; (url "https://github.com/genenetwork/genenetwork2.git")
                   (url "https://github.com/pjotrp/QTLreaper.git")
                   (commit commit)))
             (file-name (string-append name "-" (string-take commit 7)))
             (sha256
              (base32
               "1rrbm1ap2zzyjxmrs9aa1d18sgiba5dhj1fmkl7wmab06jv3j1hm"))))
    (build-system python-build-system)
    (arguments
     `(#:python ,python-2
       #:tests? #f))   ; no 'setup.py test' really!
    (home-page "http://qtlreaper.sourceforge.net/")
    (synopsis "Scan expression data for QTLs")
    (description
     "Batch-oriented version of WebQTL. It requires, as input,
expression data from members of a set of recombinant inbred lines and
genotype information for the same lines.  It searches for an
association between each expression trait and all genotypes and
evaluates that association by a permutation test.  For the permutation
test, it performs only as many permutations as are necessary to define
the empirical P-value to a reasonable precision. It also performs
bootstrap resampling to estimate the confidence region for the
location of a putative QTL.")
    (license license:gpl2+))))

(define-public python24-qtlreaper
  (let ((commit "442c217b90393380a8634ff8636b44992f5c53dd"))
    (package
      (name "python24-qtlreaper")
      (version (git-version "1.11" "gn1" commit))
      (source (origin
                (method git-fetch)
                (uri (git-reference
                       ;; (url "https://github.com/genenetwork/genenetwork2.git")
                       (url "https://github.com/pjotrp/QTLreaper.git")
                       (commit commit)))
                (file-name (git-file-name name version))
                (sha256
                 (base32
                  "1rrbm1ap2zzyjxmrs9aa1d18sgiba5dhj1fmkl7wmab06jv3j1hm"))))
      (build-system python-build-system)
      (arguments
       `(#:python ,python-2.4
         #:phases
         (modify-phases %standard-phases
           (add-after 'unpack 'make-max-markername-size-larger
             (lambda _
               (substitute* "Src/dataset.c"
                 (("512") "2048"))
               #t))
           (replace 'check
             (lambda* (#:key inputs outputs #:allow-other-keys)
               (add-installed-pythonpath inputs outputs)
               (invoke "python" "test/runtest.py"))))))
      (native-inputs
       `(("python24-setuptools" ,python24-setuptools)))
      (home-page "http://qtlreaper.sourceforge.net/")
      (synopsis "Scan expression data for QTLs")
      (description
       "Batch-oriented version of WebQTL. It requires, as input,
expression data from members of a set of recombinant inbred lines and
genotype information for the same lines.  It searches for an
association between each expression trait and all genotypes and
evaluates that association by a permutation test.  For the permutation
test, it performs only as many permutations as are necessary to define
the empirical P-value to a reasonable precision. It also performs
bootstrap resampling to estimate the confidence region for the
location of a putative QTL.")
      (license license:gpl2+))))

(define-public genenetwork1
  (let ((commit "acf65ac9ae4be395c07c1629758f7408bf4eab5f") ; June 3, 2020
        (revision "2"))
    (package
      (name "genenetwork1")
      (version (git-version "0.0.0" revision commit))
      (source (origin
        (method git-fetch)
        (uri (git-reference
               (url "https://github.com/genenetwork/genenetwork1.git")
               (commit commit)))
        (file-name (git-file-name name version))
        (sha256
         (base32
          "0xmmmjyvh80yd8b0cjrwpdmxl8k9zj5ly65r2g9aygx74njsp4fi"))))
      (build-system gnu-build-system)
      (native-inputs
       `(("ghostscript" ,ghostscript)
         ("graphviz" ,graphviz)
         ("wget" ,wget)))
      (propagated-inputs
       `(("python" ,python-2.4)
         ("httpd-with-mod-python" ,httpd22-with-mod-python)
         ("python-direct" ,python24-direct-gn)
         ("python-htmlgen-GN1" ,python24-htmlgen-GN1)
         ("python-json-GN1" ,python24-json-GN1)
         ("python-mysqlclient" ,python24-mysqlclient)
         ("python-numarray" ,python24-numarray)
         ("python-piddle" ,python24-piddle)
         ("python-pp-GN1" ,python24-pp-GN1)
         ("python-pyx" ,python24-pyx)
         ("python-pyxlwriter" ,python24-pyxlwriter)
         ("python-qtlreaper" ,python24-qtlreaper)
         ("python-rpy2" ,python24-rpy2)
         ("python-svg-GN1" ,python24-svg-GN1)))
      (arguments
       `(#:tests? #f ; no tests
         #:phases
         (modify-phases %standard-phases
           (delete 'configure)
           (delete 'build)
           (add-after 'patch-generated-file-shebangs 'patch-more-files
             (lambda* (#:key inputs #:allow-other-keys)
               (let ((piddle (assoc-ref inputs "python-piddle")))
                 (substitute* "web/webqtl/networkGraph/networkGraphUtils.py"
                   (("/usr/local/bin/neato") (which "neato"))
                   (("/usr/local/bin/circo") (which "circo"))
                   (("/usr/local/bin/twopi") (which "twopi"))
                   (("/usr/local/bin/fdp") (which "fdp"))
                   (("ps2pdf") (which "ps2pdf")))
                 (substitute* "web/webqtl/maintainance/addRif.py"
                   (("rm ") (string-append (which "rm") " "))
                   (("wget ") (string-append (which "wget") " "))
                   (("gunzip") (which "gunzip")))
                 (substitute* "web/webqtl/misc/editHtmlPage.py"
                   (("/bin/cp") (which "cp")))
                 (substitute* "web/webqtl/geneWiki/AddGeneRIFPage.py"
                   (("touch") (which "touch")))
                 (substitute* '("web/webqtl/maintainance/addRif.py"
                                "web/webqtl/networkGraph/networkGraphPage.py"
                                "web/webqtl/utility/svg.py")
                   (("/usr/bin/(env )?python") (which "python")))
                 (substitute* "web/webqtl/base/webqtlConfigLocal.py"
                   (("PythonPath.*")
                    (string-append "PythonPath = '" (which "python") "'\n"))
                   (("PIDDLE_FONT_PATH.*/lib")
                    (string-append "PIDDLE_FONT_PATH = '" piddle "/lib"))))
               #t))
           (add-after 'patch-generated-file-shebangs 'changes-for-deployed-service
             (lambda* (#:key outputs #:allow-other-keys)
               (let ((out    (assoc-ref outputs "out")))
                 (substitute* "web/webqtl/base/webqtlConfigLocal.py"
                   ;; Where GN1 is located: (GNROOT)
                   (("/gnshare/gn") out)
                   ;; Where the database is located: (sql_host)
                   (("tux01.uthsc.edu") "127.0.0.1"))
                   (substitute* '("web/webqtl/maintainance/QTL_Reaper_cal_lrs.py")
                     (("128\\.169\\.5\\.59") "localhost"))
                 ;; This directory (TMPDIR) is expected to be writable by apache.
                 ;; /tmp is private inside the container.
                 (symlink "/tmp" "web/tmp")
                 ;; IMGDIR is expected to be writable.
                 (symlink "/tmp" "web/image")
                 (system "chmod 0777 web/tmp")
                 ;; More writable locations:
                 (substitute* (list "web/webqtl/collection/ExportSelectionDetailInfoPage.py"
                                    "web/webqtl/pairScan/DirectPlotPage.py"
                                    "web/webqtl/updateTrait/DataUpdatePage.py"
                                    "web/webqtl/utility/Plot.py")
                   (("/gnshare/gn/web/debug_file.txt") "/tmp/debug_file.txt"))
                 ;; We mount the genotypes folder (GENODIR) in the OS-config and
                 ;; provide the symlink to that location from the package.
                 ;; And now the directory is magically available!
                 (symlink "/gnshare/gn/web/genotypes" "web/genotypes")
                 (substitute* "web/webqtl/base/webqtlConfig.py"
                   (("http://www.genenetwork.org") "http://gn1-test.genenetwork.org"))
                 ;; Inside the gn1 container, there's some conflict when
                 ;; importing the user module, therefore, as a hack, rename
                 ;; user to useralt
                 (mkdir "web/webqtl/useralt")
                 (copy-recursively "web/webqtl/user" "web/webqtl/useralt")
                 (substitute* '("web/webqtl/main.py")
                   (("from user import") "from useralt import"))
                 #t)))
           (add-after 'unpack 'use-local-links
             (lambda _
               (substitute* '("web/javascript/menu_items.js"
                              "web/webqtl/maintainance/updateMenuJS.py")
                 (("http://(www|gn1).genenetwork.org") ""))

               ;; Move this file out of the way while patching files.
               (rename-file "web/infoshare/manager/MDB-Free/index.html"
                            "web/infoshare/manager/MDB-Free/index.htm")
               (substitute* (cons*
                              "web/webqtl/base/indexBody.py"
                              "web/webqtl/submitTrait/BatchSubmitPage.py"
                              (find-files "web" "\\.html"))
                 ((".*base href.*") "")
                 (("(HREF|href)=\\\"http://(www.)?genenetwork.org")
                  "href=\""))
               ;; Move this file back to its original location.
               (rename-file "web/infoshare/manager/MDB-Free/index.htm"
                            "web/infoshare/manager/MDB-Free/index.html")

               (substitute* (cons*
                              "web/humanCross.html"
                              "web/webqtl/base/indexBody.py"
                              "web/whats_new.html"
                              (find-files "web/dbdoc" "\\.html"))
                 (("src=\\\"http://www.genenetwork.org") "src=\""))
               #t))
           (replace 'install
             (lambda* (#:key outputs #:allow-other-keys)
               (copy-recursively "." (assoc-ref outputs "out"))
               #t)))))
      (home-page "http://www.genenetwork.org/webqtl/main.py")
      (synopsis
       "Combined database and data analysis software resource for systems genetics")
      (description "GeneNetwork is a group of linked data sets and tools used to
study complex networks of genes, molecules, and higher order gene function and
phenotypes.  GeneNetwork combines more than 25 years of legacy data generated by
hundreds of scientists together with sequence data (SNPs) and massive
transcriptome data sets (expression genetic or eQTL data sets).  The
@dfn{quantitative trait locus} (QTL) mapping module that is built into GN is
optimized for fast on-line analysis of traits that are controlled by
combinations of gene
variants and environmental factors.  GeneNetwork can be used to study humans,
mice (BXD, AXB, LXS, etc.), rats (HXB), Drosophila, and plant species (barley
and Arabidopsis).  Most of these population data sets are linked with dense
genetic maps (genotypes) that can be used to locate the genetic modifiers that
cause differences in expression and phenotypes, including disease susceptibility.")
      (license license:agpl3+))))