summary refs log tree commit diff
path: root/gnu
diff options
context:
space:
mode:
authorBen Woodcroft <donttrustben@gmail.com>2016-04-25 13:03:17 +1000
committerBen Woodcroft <donttrustben@gmail.com>2016-05-18 22:21:52 +1000
commitbd9fe0f03b461bf33852d4cdb654459d5587aca0 (patch)
treefdf6598f1f7a9d9389ebd10b734e6d7ae062d4de /gnu
parent0affdfb80554833648efab5f9e348c4a9698955b (diff)
downloadguix-bd9fe0f03b461bf33852d4cdb654459d5587aca0.tar.gz
gnu: Add krona-tools.
* gnu/packages/web.scm (krona-tools): New variable.
Diffstat (limited to 'gnu')
-rw-r--r--gnu/packages/web.scm96
1 files changed, 96 insertions, 0 deletions
diff --git a/gnu/packages/web.scm b/gnu/packages/web.scm
index 5df4765d3c..bd30da2533 100644
--- a/gnu/packages/web.scm
+++ b/gnu/packages/web.scm
@@ -11,6 +11,7 @@
 ;;; Copyright © 2016 Jelle Licht <jlicht@fsfe.org>
 ;;; Copyright © 2016 Efraim Flashner <efraim@flashner.co.il>
 ;;; Copyright © 2016 Rene Saavedra <rennes@openmailbox.org>
+;;; Copyright © 2016 Ben Woodcroft <donttrustben@gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -56,6 +57,7 @@
   #:use-module (gnu packages icu4c)
   #:use-module (gnu packages lua)
   #:use-module (gnu packages base)
+  #:use-module (gnu packages perl)
   #:use-module (gnu packages python)
   #:use-module (gnu packages pcre)
   #:use-module (gnu packages pkg-config)
@@ -274,6 +276,100 @@ easily construct JSON objects in C, output them as JSON formatted strings and
 parse JSON formatted strings back into the C representation of JSON objects.")
     (license l:x11)))
 
+(define-public krona-tools
+  (package
+   (name "krona-tools")
+   (version "2.6.1")
+   (source (origin
+             (method url-fetch)
+             (uri (string-append
+                   "https://github.com/marbl/Krona/releases/download/v"
+                   version "/KronaTools-" version ".tar"))
+             (sha256
+              (base32
+               "1fj5mf6wbwz7v74n2safbw7fpw32fik19vf0wdbc2srn82i8fiwz"))))
+   (build-system perl-build-system)
+   (arguments
+     `(#:tests? #f ; no tests
+       #:phases
+       (modify-phases %standard-phases
+         ;; There is no configure or build steps.
+         (delete 'configure)
+         (replace 'build
+           ;; Remove 'use lib' statements from scripts as PERL5LIB is set
+           ;; correctly during installation.
+           (lambda _
+             (for-each
+              (lambda (executable)
+                (display executable)(display "\n")
+                (substitute* executable
+                  (("use lib \\(`ktGetLibPath`\\);") "")))
+              (find-files "scripts/" ".*"))
+             #t))
+         ;; Install script "install.pl" expects the build directory to remain
+         ;; after installation, creating symlinks etc., so re-implement it
+         ;; here.
+         (replace 'install
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let ((bin   (string-append (assoc-ref outputs "out") "/bin"))
+                   (perl  (string-append (assoc-ref outputs "out")
+                                         "/lib/perl5/site_perl"))
+                   (share (string-append
+                           (assoc-ref outputs "out") "/share/krona-tools")))
+               (mkdir-p bin)
+               (for-each
+                (lambda (script)
+                  (let* ((executable (string-append "scripts/" script ".pl")))
+                    ;; Prefix executables with 'kt' as install script does.
+                    (copy-file executable (string-append bin "/kt" script))))
+                '("ClassifyBLAST"
+                  "GetContigMagnitudes"
+                  "GetTaxIDFromGI"
+                  "ImportBLAST"
+                  "ImportDiskUsage"
+                  "ImportEC"
+                  "ImportFCP"
+                  "ImportGalaxy"
+                  "ImportKrona"
+                  "ImportMETAREP-BLAST"
+                  "ImportMETAREP-EC"
+                  "ImportMGRAST"
+                  "ImportPhymmBL"
+                  "ImportRDP"
+                  "ImportRDPComparison"
+                  "ImportTaxonomy"
+                  "ImportText"
+                  "ImportXML"))
+               (mkdir-p share)
+               (copy-recursively "data" (string-append share "/data"))
+               (copy-recursively "img" (string-append share "/img"))
+               (copy-recursively "taxonomy" (string-append share "/taxonomy"))
+               (substitute* '("lib/KronaTools.pm")
+                 (("taxonomyDir = \".libPath/../taxonomy\"")
+                  (string-append "taxonomyDir = \"" share "/taxonomy\"")))
+               (install-file "lib/KronaTools.pm" perl))))
+         (add-after 'install 'wrap-program
+           (lambda* (#:key inputs outputs #:allow-other-keys)
+             (let* ((out (assoc-ref outputs "out"))
+                    (path (getenv "PERL5LIB")))
+               (for-each
+                (lambda (executable)
+                  (wrap-program executable
+                    `("PERL5LIB" ":" prefix
+                      (,(string-append out "/lib/perl5/site_perl")))))
+                (find-files (string-append out "/bin/") ".*"))))))))
+   (inputs
+    `(("perl" ,perl)))
+   (home-page "https://github.com/marbl/Krona/wiki")
+   (synopsis "Hierarchical data exploration with zoomable HTML5 pie charts")
+   (description
+    "Krona is a flexible tool for exploring the relative proportions of
+hierarchical data, such as metagenomic classifications, using a radial,
+space-filling display.  It is implemented using HTML5 and JavaScript, allowing
+charts to be explored locally or served over the Internet, requiring only a
+current version of any major web browser.")
+   (license l:bsd-3)))
+
 (define-public rapidjson
   (package
     (name "rapidjson")