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
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
|
;; Bioinformatics module
(define-module (gn packages genenetwork)
#:use-module ((guix licenses) #:prefix license:)
#:use-module (guix packages)
#:use-module (guix utils)
#:use-module (guix download)
#:use-module (guix git)
#: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 (guix packages)
#:use-module (gnu packages)
#:use-module (gnu packages base)
#:use-module (gnu packages bioconductor)
#:use-module (gnu packages bioinformatics)
#: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 golang)
#:use-module (gnu packages graph)
#:use-module (gnu packages graphviz)
#:use-module (gnu packages machine-learning)
#:use-module (gnu packages parallel)
#:use-module (gnu packages python)
#:use-module (gnu packages python-build)
#: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 rust)
#:use-module (gnu packages scheme)
#:use-module (gnu packages search)
#:use-module (gnu packages statistics)
#:use-module (gnu packages textutils)
#:use-module (gnu packages version-control)
#:use-module (gnu packages web)
#:use-module (gnu packages xml)
#:use-module (gn packages bioinformatics)
#:use-module (gn packages crates-io)
#:use-module (gn packages gemma)
#:use-module (gn packages javascript)
#:use-module (gn packages python)
#:use-module (gn packages statistics)
#:use-module (gn packages web)
#:use-module (gn packages python-web)
#:use-module (srfi srfi-1))
(define-public rust-qtlreaper
(let ((commit "2e7fed6d45b0b602d80fa2a55835f96ef1cba9e3")
(revision "1"))
(package
(name "rust-qtlreaper")
(version "0.1.4")
(source
(origin
(method git-fetch)
(uri (git-reference
(url "https://github.com/chfi/rust-qtlreaper.git")
(commit commit)))
(file-name (git-file-name name version))
(sha256
(base32
"0h70aalsplmc6xn1w7ha102n3bsi3gqkbnbrjvjm2za37c07gv0g"))))
(build-system cargo-build-system)
(arguments
`(#:cargo-inputs
(("rust-rand" ,rust-rand-0.6)
("rust-structopt" ,rust-structopt-0.2)
("rust-rayon" ,rust-rayon-1)
("rust-serde" ,rust-serde-1)
("rust-serde-json" ,rust-serde-json-1)
("rust-ndarray" ,rust-ndarray-0.12))
#:phases
(modify-phases %standard-phases
;; Test results vary based on the machine running them.
(replace 'check
(lambda _
(or (assoc-ref %standard-phases 'check)
(begin
(substitute* "src/geneobject.rs"
;; array![Genotype::Unk, Genotype::Unk, Genotype::Pat]
(("0.3421367343627405") "0.3421367343627406")
;; array![Genotype::Unk, Genotype::Unk, Genotype::Unk]
(("-0.3223330030526561") "-0.32233300305265566"))
(assoc-ref %standard-phases 'check)))
#t)))))
(home-page "https://github.com/chfi/rust-qtlreaper")
(synopsis "Reimplementation of genenetwork/QTLReaper in Rust")
(description "Reimplementation of genenetwork/QTLReaper in Rust")
(license #f))))
; Tests on the upstream python-pengouin package are broken. So, we
; create this temporary workaround.
(define python-pingouin-without-tests
(package
(inherit python-pingouin)
(arguments
(substitute-keyword-arguments (package-arguments python-pingouin)
((#:tests? _ #f) #f)))))
(define-public genenetwork3
(let ((commit "6bb4a5f05c1a2c96b7da1780ae4a1d70c7cc4afb")
(revision "5"))
(package
(name "genenetwork3")
(version (git-version "0.1.0" revision commit))
(source
(origin
(method git-fetch)
(uri (git-reference
(url "https://github.com/genenetwork/genenetwork3.git")
(commit commit)))
(file-name (git-file-name name version))
(sha256
(base32
"13nvi2gwwb0shra0d9rsfhppa9ky4bhgh1zgb34790ax0g9lwa97"))))
(inputs
(list python-click))
(native-inputs
`(("python-hypothesis" ,python-hypothesis)
("python-mypy" ,python-mypy)
("python-mypy-extensions" ,python-mypy-extensions)
("python-pylint" ,python-pylint)
("python-pytest" ,python-pytest)
("python-pytest-mock" ,python-pytest-mock)))
(propagated-inputs
`(("gemma-wrapper" ,gemma-wrapper)
("python-wrapper" ,python-wrapper)
("csvdiff" ,csvdiff)
("gn-rust-correlation" ,gn-rust-correlation)
;; Replace use of bcrypt with argon below
("python-bcrypt" ,python-bcrypt)
("python-argon2-cffi" ,python-argon2-cffi)
("python-flask" ,python-flask)
("python-flask-cors" ,python-flask-cors)
;; Not working in Python > 3.8
;; python-ipfshttpclient
("python-lmdb" ,python-lmdb)
("python-mysqlclient" ,python-mysqlclient)
("python-numpy" ,python-numpy)
("python-pandas" ,python-pandas)
;; python-pingouin << build failing
("python-pingouin-without-tests" ,python-pingouin-without-tests)
("python-plotly" ,python-plotly)
("python-pyld" ,python-pyld)
("python-scikit-learn" ,python-scikit-learn)
("python-pymonad" ,python-pymonad)
("python-redis" ,python-redis)
("python-requests" ,python-requests)
("python-scipy" ,python-scipy)
("python-authlib" ,python-authlib)
("python-sparqlwrapper" ,python-sparqlwrapper)
("python-email-validator" ,python-email-validator)
("python-xapian-bindings" ,python-xapian-bindings)
("r-optparse" ,r-optparse)
("r-qtl" ,r-qtl)
("r-rjson" ,r-rjson)
("r-stringi" ,r-stringi)
("r-wgcna" ,r-wgcna)
("r-ctl" ,r-ctl)
("rust-qtlreaper" ,rust-qtlreaper)
("diffutils" ,diffutils)))
(build-system python-build-system)
(arguments
(list #:phases
#~(modify-phases %standard-phases
(replace 'check
(lambda* (#:key tests? #:allow-other-keys)
(when tests?
(invoke "pytest" "-k" "unit_test")))))))
(home-page "https://github.com/genenetwork/genenetwork3")
(synopsis "GeneNetwork3 API for data science and machine learning.")
(description "GeneNetwork3 API for data science and machine learning.")
(license license:agpl3+))))
(define-public genenetwork2
(let ((commit "b9e04ad79e0039edba25d58f8bc03e4d2a17583b")
(revision "4"))
(package
(name "genenetwork2")
(version (git-version "3.11" revision commit))
(source (origin
(method git-fetch)
(uri (git-reference
(url "https://github.com/genenetwork/genenetwork2.git")
(commit commit)))
(file-name (string-append name "-" version))
(sha256
(base32
"1ri56g5hl2n0q7cz15sbvjmrr5pmsrp274frkvvcgr9ddxjlzd9p"))))
(native-inputs
(list graphviz))
(propagated-inputs
(list genenetwork3
parallel
coreutils
git
which
grep
r
r-ctl
r-qtl
r-wgcna
redis
mariadb
gemma
gemma-wrapper
plink-ng-gn
rust-qtlreaper
gn-rust-correlation
glibc-utf8-locales
nginx
python-wrapper
python-pillow
python-coverage
python-configparser
python-flask
gunicorn
python-autopep8
python-cssselect
python-flask-debugtoolbar
python-htmlgen
python-ijson
python-jinja2
python-pytest
python-pytest-mock
python-sqlalchemy
python-setuptools
python-scipy
python-lxml
python-mysqlclient
python-mypy
python-numpy
python-pandas
python-pylint
python-pymonad
python-redis
python-requests
python-simplejson
python-markdown
python-rdflib
python-authlib
python-flask-session
python-rpy2
python-beautifulsoup4
python-xlsxwriter
javascript-twitter-post-fetcher
javascript-cytoscape
javascript-cytoscape-panzoom
javascript-cytoscape-qtip
javascript-chroma
javascript-d3-tip
javascript-jscolor
javascript-colorbox
javascript-jszip
js-jstat
js-md5
js-parsley
javascript-plotly
javascript-typeahead
js-underscore
javascript-uikit
js-smart-time-ago
javascript-nouislider
javascript-purescript-genome-browser
javascript-ckeditor
javascript-datatables
javascript-datatables-scroller
javascript-datatables-buttons
javascript-datatables-buttons-bootstrap
javascript-datatables-plugins
javascript-datatables-col-reorder
javascript-datatables-col-resize
javascript-datatables-buttons-styles
javascript-shapiro-wilk
javascript-underscore-string
javascript-htmx
javascript-qtip2
javascript-d3js
javascript-nvd3
javascript-bootstrap
javascript-jquery
javascript-zxcvbn
javascript-jquery-ui
javascript-jquery-cookie
javascript-linkify
javascript-linkify-html
; javascript-xterm -- disabled until we know what to do with it, not working on production
; javascript-xterm-style
; javascript-xterm-addon-fit
javascript-font-awesome))
(inputs
(list javascript-colorbox))
(build-system python-build-system)
(arguments
(list #:tests? #f
#:phases
#~(modify-phases %standard-phases
(delete 'reset-gzip-timestamps)
(add-after 'unpack 'fix-paths-to-static-files
(lambda* (#:key inputs outputs #:allow-other-keys)
;; Set absolute store paths to installed static files.
(substitute* "gn2/wqflask/marker_regression/display_mapping_results.py"
(("\\./gn2/wqflask/static/fonts")
(string-append (site-packages inputs outputs)
"/gn2/wqflask/static/fonts")))
(substitute* "gn2/wqflask/views.py"
(("\\./gn2/wqflask/static/gif/error")
(string-append (site-packages inputs outputs)
"/gn2/wqflask/static/gif/error")))))
(add-after 'unpack 'fix-paths-scripts
(lambda _
(substitute* "bin/genenetwork2"
(("/usr/bin/env") (which "env"))
(("python ") (string-append (which "python3") " "))
(("readlink") (which "readlink"))
(("dirname") (which "dirname"))
(("basename") (which "basename"))
(("cat") (which "cat"))
(("echo") (which "echo"))
(("redis-server") (which "redis-server"))
(("git") (which "git"))
(("grep") (which "grep"))
(("rm") (which "rm"))
(("which") (which "which")))))
(add-before 'install 'fix-paths
(lambda* (#:key inputs #:allow-other-keys)
(let* ((plink2cmd (string-append (assoc-ref inputs "plink-ng-gn") "/bin/plink2"))
(gemmacmd (string-append (assoc-ref inputs "gemma") "/bin/gemma")))
(substitute* '("gn2/default_settings.py")
(("^PLINK_COMMAND =.*") (string-append "PLINK_COMMAND = \"" plink2cmd "\"\n" ))
(("^GEMMA_COMMAND =.*") (string-append "GEMMA_COMMAND = \"" gemmacmd "\"\n" )))))))))
(home-page "http://genenetwork.org/")
(synopsis "Full genenetwork services")
(description "Genenetwork installation sumo.")
(license license:agpl3+))))
(define-public genenetwork2-stable
(let ((commit "2c122f99098cf84d4b67953f2a3ef05dab762c9c")
(revision "1"))
(package
(inherit genenetwork2)
(name "genenetwork2-stable")
(version (string-append "stable-" (git-version "3.11" revision commit)))
(source
(git-checkout
(url "https://github.com/genenetwork/genenetwork2")
(branch "prod"))))))
(define-public gn-uploader
(let ((commit "a4ed5d821921e43b73ecaf2ef802fab2b74d0b63")
(version "0.0.1"))
(package
(name "gn-uploader")
(version (string-append version "-" (string-take commit 8)))
(source
(origin
(method git-fetch)
(uri (git-reference
(url "https://git.genenetwork.org/gn-uploader")
(commit commit)))
(hash
(content-hash
(base32
"01rlgdvmhxhibdw27rcjmjy0s39mv9y9nmxgn0l5p13vbib03iw5")))))
(build-system python-build-system)
(arguments
(list
#:phases
#~(modify-phases %standard-phases
(replace 'check
(lambda* (#:key tests? #:allow-other-keys)
(when tests?
(invoke "pytest" "-m" "unit_test")))))))
(native-inputs
(list python-mypy
python-pylint
python-pytest
python-hypothesis))
(propagated-inputs
(list gunicorn
python-redis
python-flask
python-pyyaml
python-jsonpickle
python-mysqlclient))
(synopsis "GeneNetwork Quality Control Application")
(description
"gn-uploader is a service allowing upload of new data into GeneNetwork,
that does quality control for the data files that is being uploaded to ensure
it fulfils all conditions before it can be accepted.")
(home-page "https://git.genenetwork.org/gn-uploader")
(license license:agpl3+))))
(define-public gn-auth
(package
(name "gn-auth")
(version "1.0.1")
(source
(origin
(method git-fetch)
(uri (git-reference
(url "https://github.com/genenetwork/gn-auth.git")
(commit "cd6eebd85d32feb289ccecd1aee45fb40b03d77f")))
(hash
(content-hash
(base32
"06slj3z110mbc46qncdvyi29y85zkqxl76n89dxjp5wjfqxw0nsl")))))
(build-system python-build-system)
(arguments
(list
#:phases
#~(modify-phases %standard-phases
(replace 'check
(lambda* (#:key tests? #:allow-other-keys)
(when tests?
(invoke "pytest" "-k" "unit_test")))))))
(native-inputs
(list python-hypothesis
python-mypy
python-mypy-extensions
python-pylint
python-pytest
python-pytest-mock))
(propagated-inputs
(list gunicorn
python-argon2-cffi
python-authlib
python-email-validator
python-flask
python-flask-cors
python-mysqlclient
python-pymonad
python-redis
yoyo-migrations))
(home-page "https://github.com/genenetwork/gn-auth")
(synopsis "Authentication and Authorisation server for GeneNetwork services")
(description "Authentication and Authorisation server for GeneNetwork services.")
(license license:agpl3+)))
;; ./pre-inst-env guix download http://files.genenetwork.org/raw_database/db_webqtl_s.zip
;; 0sscjh0wml2lx0mb43vf4chg9gpbfi7abpjxb34n3kyny9ll557x
(define-public genenetwork2-files-small
(let ((pfff "xx"))
(package
(name "genenetwork2-files-small")
(version "1.0")
(source
(origin
(method url-fetch)
(uri "http://files.genenetwork.org/data_files/gn2_data_s-20160303-C9E672ECED1F51B915DE419B5B2C524E.tar.lz4")
(file-name (string-append name "-" pfff))
(sha256
(base32 "058ymx3af6abdhdxyxj0i9qfvb6v7j091frjpp6jh4ahks7r23lj"))))
(build-system trivial-build-system)
(native-inputs `(("lz4" ,lz4)
("tar" ,tar)
("source" ,source)))
(arguments
`(#:modules ((guix build utils))
#:builder
(let* ((out (assoc-ref %outputs "out"))
(name "gn2_data_s")
(tarfn (string-append name ".tar"))
(targetdir (string-append out "/share/genenetwork2/")))
(begin
(use-modules (guix build utils))
(let ((source (assoc-ref %build-inputs "source"))
(lz4unpack (string-append (assoc-ref %build-inputs "lz4") "/bin/lz4"))
(tar (string-append (assoc-ref %build-inputs "tar") "/bin/tar")))
(and
(zero? (system* lz4unpack source "-d" tarfn))
(zero? (system* tar "xf" tarfn))
(mkdir-p targetdir)
(copy-recursively name targetdir)))))))
(home-page "http://genenetwork.org/")
(synopsis "Small file archive to run on genenetwork")
(description "Genenetwork genotype and mapping files.")
(license license:agpl3+))))
(define-public genenetwork2-database-small
(let ((md5 "93e745e9c"))
(package
(name "genenetwork2-database-small")
(version "1.0")
(source
(origin
(method url-fetch)
(uri "http://files.genenetwork.org/raw_database/db_webqtl_s.zip")
(file-name (string-append name "-" md5))
(sha256
(base32 "0sscjh0wml2lx0mb43vf4chg9gpbfi7abpjxb34n3kyny9ll557x"))))
(build-system trivial-build-system)
(native-inputs `(("unzip" ,unzip)
("source" ,source)))
(arguments
`(#:modules ((guix build utils))
#:builder (begin
(use-modules (guix build utils))
(let ((source (assoc-ref %build-inputs "source"))
(unzip (string-append (assoc-ref %build-inputs "unzip") "/bin/unzip")))
(and (mkdir "db")
(zero? (system* unzip source "-d" "db"))
(chdir "db"))))))
(home-page "http://genenetwork.org/")
(synopsis "Small database to run on genenetwork")
(description "Genenetwork installation + database.")
(license license:agpl3+))))
(define (genenetwork-graph)
(with-imported-modules '((guix build utils))
(gexp->derivation "genenetwork-graph"
#~(begin
(use-modules (guix build utils)
(srfi srfi-1))
(define (python-version package)
(let* ((version (last (string-split
package
#\-)))
(components (string-split version #\.))
(major+minor (take components 2)))
(string-join major+minor ".")))
(let ((html-file (string-append #$output
"/lib/python"
(python-version #$python)
"/site-packages/wqflask"
"/dependency-graph.html")))
(mkdir-p (dirname html-file))
(call-with-output-file html-file
(lambda (port)
(format
port "~a"
#$(call-with-output-string
(lambda (p)
(with-output-to-port p
(lambda ()
(run-with-store
(open-connection)
(export-graph
(list genenetwork2)
p
#:node-type %package-node-type
#:backend %d3js-backend))))))))))))))
;(define (computed-genenetwork-graph)
; (with-imported-modules '((guix build utils))
; (computed-file "genenetwork-graph"
; #~(begin
; (use-modules (guix build utils))
; (call-with-output-file #$output
; (lambda (port)
; (format
; port "~a"
; #$(call-with-output-string
; (lambda (p)
; (with-output-to-port p
; (lambda ()
; (run-with-store
; (open-connection)
; (export-graph
; (list genenetwork1)
; p
; #:node-type %package-node-type
; #:backend %d3js-backend)))))))))))))
(define (dag-svg-file)
(with-imported-modules '((guix build utils))
(gexp->derivation "dag-svg-file"
#~(begin
(use-modules (guix build utils)
(srfi srfi-1))
(define (python-version package)
(let* ((version (last (string-split
package
#\-)))
(components (string-split version #\.))
(major+minor (take components 2)))
(string-join major+minor ".")))
(let* ((dest-dir (string-append #$output
"/lib/python"
(python-version #$python)
"/site-packages/wqflask"))
(dot-file (string-append dest-dir "/dependency-graph.dot"))
(svg-file (string-append dest-dir "/dependency-graph.svg")))
(mkdir-p dest-dir)
(call-with-output-file dot-file
(lambda (port)
(format
port "~a"
#$(call-with-output-string
(lambda (p)
(with-output-to-port p
(lambda ()
(run-with-store
(open-connection)
(export-graph
(list genenetwork2)
p
#:node-type %package-node-type
#:backend %graphviz-backend)))))))))
(invoke #+(file-append graphviz "/bin/dot")
"-Tsvg" "-o" svg-file dot-file))))))
;(define-public genenetwork2-combined
; (directory-union
; "genenetwork2"
; (list genenetwork2 genenetwork-graph dag-svg-file)))
|