aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gn/packages/bioinformatics.scm57
-rw-r--r--gn/services/genome-browser.scm92
2 files changed, 98 insertions, 51 deletions
diff --git a/gn/packages/bioinformatics.scm b/gn/packages/bioinformatics.scm
index b836ff0..3785b0f 100644
--- a/gn/packages/bioinformatics.scm
+++ b/gn/packages/bioinformatics.scm
@@ -54,6 +54,7 @@
#:use-module (gnu packages ruby)
#:use-module (gnu packages shells)
#:use-module (gnu packages statistics)
+ #:use-module (gnu packages tcl)
#:use-module (gnu packages time)
#:use-module (gnu packages tls)
#:use-module (gnu packages vim)
@@ -1601,13 +1602,25 @@ multiple sequence alignment.")
(setenv "DOCUMENTROOT_USER" (string-append out "/html"))
(setenv "BINDIR" (string-append out "/bin"))
- ;; Now let's fix some errors
+ ;; Now let's fix some errors:
(mkdir-p (string-append out "/cgi-bin"))
(substitute* "inc/cgi_build_rules.mk"
(("rm -f.*") ""))
(substitute* (cons* "inc/cgi_build_rules.mk"
(find-files "." "makefile"))
(("CGI_BIN\\}-\\$\\{USER") "CGI_BIN_USER"))
+ ;; Force linking with freetype.
+ (substitute* "inc/common.mk"
+ (("libpng-config --ldflags") "pkg-config --libs libpng freetype2")
+ (("libpng-config --I_opts") "pkg-config --cflags-only-I libpng freetype2"))
+ ;; Force the trash location.
+ (substitute* (cons*
+ "utils/qa/showTracks"
+ "webBlat/webBlat.cfg"
+ "hg/js/hgTracks.js"
+ (find-files "." "\\.c$"))
+ ;; This line is specifically needed as-is.
+ (("\\.\\./trash") "/var/www/html/trash"))
#t)))
;; Install happens during the 'build phase.
@@ -1617,33 +1630,28 @@ multiple sequence alignment.")
(lambda _
(invoke "make" "doc-install")
#t))
- ;; TODO: Figure out how to make this configurable in the service.
(add-after 'install 'create-hg-conf
(lambda* (#:key outputs #:allow-other-keys)
(let ((out (assoc-ref outputs "out")))
(with-output-to-file (string-append out "/cgi-bin/hg.conf")
(lambda ()
(display
- (string-append
- "browser.documentRoot=" out "/html\n"
- "db.host=gbdb\n"
- "db.user=admin\n"
- "db.password=admin\n"
- "db.trackDb=trackDb\n"
- "defaultGenome=Human\n"
- "central.db=hgcentral\n"
- "central.host=gbdb\n"
- "central.user=admin\n"
- "central.password=admin\n"
- "central.domain=\n"
- "backupcentral.db=hgcentral\n"
- "backupcentral.host=gbdb\n"
- "backupcentral.user=admin\n"
- "backupcentral.password=admin\n"
- "backupcentral.domain=\n"))))
- #t))))))
+ "include /var/lib/genome/hg.conf\n")))
+ #t)))
+ (add-after 'install 'create-symlink
+ (lambda* (#:key outputs #:allow-other-keys)
+ (let ((out (assoc-ref outputs "out")))
+ ;; Some trash locations are hardcoded as "../trash"
+ ;(symlink "/var/www/html/trash"
+ ; (string-append out "/trash"))
+ (symlink "../html"
+ (string-append out "/htdocs"))
+ #t)))
+ )))
(inputs
- `(("libpng" ,libpng)
+ `(
+ ("freetype" ,freetype)
+ ("libpng" ,libpng)
("mysql:dev" ,mariadb "dev")
("mysql:lib" ,mariadb "lib")
("openssl" ,openssl)
@@ -1651,10 +1659,11 @@ multiple sequence alignment.")
("python2" ,python-2)
("zlib" ,zlib)))
(native-inputs
- `(;("python" ,python)
+ `(("pkg-config" ,pkg-config)
+ ("python" ,python)
("rsync" ,rsync) ; For installing js files from the source checkout
- ;("tcl" ,tcl)
- ;("tcsh" ,tcsh)
+ ("tcl" ,tcl)
+ ("tcsh" ,tcsh)
("util-linux:lib" ,util-linux "lib")
("which" ,(@ (gnu packages base) which))))
(home-page "https://www.genome.ucsc.edu/")
diff --git a/gn/services/genome-browser.scm b/gn/services/genome-browser.scm
index 58c8e4a..7f7ffc0 100644
--- a/gn/services/genome-browser.scm
+++ b/gn/services/genome-browser.scm
@@ -1,30 +1,59 @@
;; See dockerfile for some clarification about choices:
;; https://github.com/icebert/docker_ucsc_genome_browser/blob/master/Dockerfile
+;; http://genome.ucsc.edu/goldenPath/help/mirrorManual.html
(define-module (gn services genome-browser))
(use-modules (gnu)
- (gn packages bioinformatics)
- )
-(use-service-modules web)
+ (guix packages)
+ (gn packages bioinformatics))
+(use-service-modules
+ databases
+ web)
+(use-package-modules
+ bash
+ databases
+ ghostscript
+ wget)
(define %hg.conf
(mixed-text-file "hg.conf"
"browser.documentRoot=" ucsc-genome-browser "/html\n"
- "db.host=gbdb\n"
- "db.user=admin\n"
- "db.password=admin\n"
+ "db.host=localhost\n"
+ "db.user=readonly\n"
+ "db.password=access\n"
"db.trackDb=trackDb\n"
- "defaultGenome=Human\n"
+ "gbdbLoc1=/gbdb/\n"
+ "gbdbLoc2=http://hgdownload.soe.ucsc.edu/gbdb/\n"
+ ;# To disable on-the-fly loading of mysql data, comment out these lines.
+ "slow-db.host=genome-mysql.soe.ucsc.edu\n"
+ "slow-db.user=genomep\n"
+ "slow-db.password=password\n"
+ "defaultGenome=Mouse\n"
"central.db=hgcentral\n"
- "central.host=gbdb\n"
- "central.user=admin\n"
- "central.password=admin\n"
+ "central.host=localhost\n"
+ "central.socket=/run/mysqld/mysqld.sock\n" ; default for mysql service
+ "central.user=readwrite\n"
+ "central.password=update\n"
"central.domain=\n"
"backupcentral.db=hgcentral\n"
- "backupcentral.host=gbdb\n"
- "backupcentral.user=admin\n"
- "backupcentral.password=admin\n"
- "backupcentral.domain=\n"))
+ "backupcentral.host=localhost\n"
+ "backupcentral.user=readwrite\n"
+ "backupcentral.password=update\n"
+ "backupcentral.domain=\n"
+ "freeType=on\n"
+ "freeTypeDir=" gs-fonts "/share/fonts/type1/ghostscript\n"
+ "hgc.ghostscriptPath=" ghostscript "/bin/gs\n" ; needed?
+ ))
+
+(define %startup-script
+ (mixed-text-file "create_databases.sh"
+ wget "/bin/wget http://hgdownload.soe.ucsc.edu/admin/hgcentral.sql\n"
+ bash-minimal "/bin/sh " (package-source ucsc-genome-browser) "/src/product/ex.MySQLUserPerms.sh\n"
+ mariadb "/bin/mysql -e \"create database hgcentral;\" mysql\n"
+ mariadb "/bin/mysql hgcentral < hgcentral.sql\n"
+ coreutils-minimal "/bin/mkdir -p /var/www/html/trash\n"
+ coreutils-minimal "/bin/chown -R httpd:httpd /var/www\n"
+ ))
;; TODO: create 'daily clean' mcron scripts.
;; /var/www/html/trash needs to be created and owned by httpd:httpd
@@ -42,13 +71,19 @@
(file-systems %base-file-systems)
;; No firmware for VMs
(firmware '())
- (packages (cons* %base-packages))
+ (packages (cons* mariadb ; for create-db script
+ %base-packages))
(services
- (list (service httpd-service-type
+ (list (service mysql-service-type)
+ (service special-files-service-type
+ `(("/root/create_hgcentral" ,%startup-script)
+ ("/var/lib/genome/hg.conf" ,%hg.conf)))
+ (service httpd-service-type
(httpd-configuration
(config
(httpd-config-file
(document-root (file-append ucsc-genome-browser "/html"))
+ (server-name "Genome_Browser")
(listen (list (number->string ucsc-genome-browser-port)))
(modules
(cons*
@@ -68,22 +103,25 @@ ScriptSock /var/run/cgid.sock
XBitHack On
DocumentRoot " ucsc-genome-browser "/html
Alias /bin " ucsc-genome-browser "/bin
- Alias /cgi-bin " ucsc-genome-browser "/cgi-bin
- #Alias /cgi-bin/hg.conf " %hg.conf " # this doesn't seem to work
+ #Alias /cgi-bin " ucsc-genome-browser "/cgi-bin # causes cgi scripts to fail to render
Alias /htdocs " ucsc-genome-browser "/htdocs
<Directory " ucsc-genome-browser "/html>
- Options +Includes
- SSILegacyExprParser on
+ Options +Includes +FollowSymLinks +Indexes
+ AllowOverride None
+ <IfModule mod_authz_host.c>
+ Require all granted
+ SSILegacyExprParser on
+ </IfModule>
</Directory>
- ScriptAlias /cgi-bin/ " ucsc-genome-browser "/cgi-bin/
+ ScriptAlias /cgi-bin " ucsc-genome-browser "/cgi-bin
<Directory " ucsc-genome-browser "/cgi-bin>
AllowOverride None
- Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
- #Order allow,deny
- #Allow from all
- SetHandler cgi-script
+ Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch +Includes +FollowSymlinks
+ Order allow,deny
+ #SetHandler cgi-script
Require all granted
+ Allow from all
</Directory>
<Directory /var/www/html/trash>
@@ -94,6 +132,6 @@ ScriptSock /var/run/cgid.sock
</Directory>
</VirtualHost>")))))))))
-;; guix system container -L /path/to/guix-past/modules/ -L /path/to/guix-bioinformatics/ /path/to/guix-bioinformatics/gn/services/genome-browser.scm --network
-;; ALSO need to share in the external database
+;; guix system container -L /path/to/guix-past/modules/ -L /path/to/guix-bioinformatics/ /path/to/guix-bioinformatics/gn/services/genome-browser.scm --network ;--expose=/path/to/gbdb=/gbdb
+;; ALSO need to share in the external database?
;; xdg-open http://localhost:4321