gnu: bedtools: Update to 2.24.0.
[guix.git] / gnu / packages / bioinformatics.scm
blob92b93948f4f0ba6f1fd4901fe32a55117f790f1c
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2014, 2015 Ricardo Wurmus <rekado@elephly.net>
3 ;;; Copyright © 2015 Ben Woodcroft <donttrustben@gmail.com>
4 ;;;
5 ;;; This file is part of GNU Guix.
6 ;;;
7 ;;; GNU Guix is free software; you can redistribute it and/or modify it
8 ;;; under the terms of the GNU General Public License as published by
9 ;;; the Free Software Foundation; either version 3 of the License, or (at
10 ;;; your option) any later version.
11 ;;;
12 ;;; GNU Guix is distributed in the hope that it will be useful, but
13 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
14 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 ;;; GNU General Public License for more details.
16 ;;;
17 ;;; You should have received a copy of the GNU General Public License
18 ;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
20 (define-module (gnu packages bioinformatics)
21   #:use-module ((guix licenses) #:prefix license:)
22   #:use-module (guix packages)
23   #:use-module (guix utils)
24   #:use-module (guix download)
25   #:use-module (guix git-download)
26   #:use-module (guix build-system gnu)
27   #:use-module (guix build-system cmake)
28   #:use-module (guix build-system perl)
29   #:use-module (guix build-system python)
30   #:use-module (guix build-system trivial)
31   #:use-module (gnu packages)
32   #:use-module (gnu packages algebra)
33   #:use-module (gnu packages base)
34   #:use-module (gnu packages boost)
35   #:use-module (gnu packages compression)
36   #:use-module (gnu packages cpio)
37   #:use-module (gnu packages file)
38   #:use-module (gnu packages java)
39   #:use-module (gnu packages linux)
40   #:use-module (gnu packages machine-learning)
41   #:use-module (gnu packages maths)
42   #:use-module (gnu packages ncurses)
43   #:use-module (gnu packages perl)
44   #:use-module (gnu packages pkg-config)
45   #:use-module (gnu packages popt)
46   #:use-module (gnu packages protobuf)
47   #:use-module (gnu packages python)
48   #:use-module (gnu packages statistics)
49   #:use-module (gnu packages swig)
50   #:use-module (gnu packages tbb)
51   #:use-module (gnu packages textutils)
52   #:use-module (gnu packages vim)
53   #:use-module (gnu packages web)
54   #:use-module (gnu packages xml)
55   #:use-module (gnu packages zip))
57 (define-public aragorn
58   (package
59     (name "aragorn")
60     (version "1.2.36")
61     (source (origin
62               (method url-fetch)
63               (uri (string-append
64                     "http://mbio-serv2.mbioekol.lu.se/ARAGORN/Downloads/aragorn"
65                     version ".tgz"))
66               (sha256
67                (base32
68                 "1dg7jlz1qpqy88igjxd6ncs11ccsirb36qv1z01a0np4i4jh61mb"))))
69     (build-system gnu-build-system)
70     (arguments
71      `(#:tests? #f ; there are no tests
72        #:phases
73        (modify-phases %standard-phases
74          (delete 'configure)
75          (replace 'build
76                   (lambda _
77                     (zero? (system* "gcc"
78                                     "-O3"
79                                     "-ffast-math"
80                                     "-finline-functions"
81                                     "-o"
82                                     "aragorn"
83                                     (string-append "aragorn" ,version ".c")))))
84          (replace 'install
85                   (lambda* (#:key outputs #:allow-other-keys)
86                     (let* ((out (assoc-ref outputs "out"))
87                            (bin (string-append out "/bin"))
88                            (man (string-append out "/share/man/man1")))
89                       (mkdir-p bin)
90                       (copy-file "aragorn"
91                                  (string-append bin "/aragorn"))
92                       (mkdir-p man)
93                       (copy-file "aragorn.1"
94                                  (string-append man "/aragorn.1")))
95                     #t)))))
96     (home-page "http://mbio-serv2.mbioekol.lu.se/ARAGORN")
97     (synopsis "Detect tRNA, mtRNA and tmRNA genes in nucleotide sequences")
98     (description
99      "Aragorn identifies transfer RNA, mitochondrial RNA and
100 transfer-messenger RNA from nucleotide sequences, based on homology to known
101 tRNA consensus sequences and RNA structure.  It also outputs the secondary
102 structure of the predicted RNA.")
103     (license license:gpl2)))
105 (define-public bamtools
106   (package
107     (name "bamtools")
108     (version "2.3.0")
109     (source (origin
110               (method url-fetch)
111               (uri (string-append
112                     "https://github.com/pezmaster31/bamtools/archive/v"
113                     version ".tar.gz"))
114               (file-name (string-append name "-" version ".tar.gz"))
115               (sha256
116                (base32
117                 "1brry29bw2xr2l9pqn240rkqwayg85b8qq78zk2zs6nlspk4d018"))))
118     (build-system cmake-build-system)
119     (arguments
120      `(#:tests? #f ;no "check" target
121        #:phases
122        (modify-phases %standard-phases
123          (add-before
124           'configure 'set-ldflags
125           (lambda* (#:key outputs #:allow-other-keys)
126             (setenv "LDFLAGS"
127                     (string-append
128                      "-Wl,-rpath="
129                      (assoc-ref outputs "out") "/lib/bamtools")))))))
130     (inputs `(("zlib" ,zlib)))
131     (home-page "https://github.com/pezmaster31/bamtools")
132     (synopsis "C++ API and command-line toolkit for working with BAM data")
133     (description
134      "BamTools provides both a C++ API and a command-line toolkit for handling
135 BAM files.")
136     (license license:expat)))
138 (define-public bedops
139   (package
140     (name "bedops")
141     (version "2.4.14")
142     (source (origin
143               (method url-fetch)
144               (uri (string-append "https://github.com/bedops/bedops/archive/v"
145                                   version ".tar.gz"))
146               (file-name (string-append name "-" version ".tar.gz"))
147               (sha256
148                (base32
149                 "1kqbac547wyqma81cyky9n7mkgikjpsfd3nnmcm6hpqwanqgh10v"))))
150     (build-system gnu-build-system)
151     (arguments
152      '(#:tests? #f
153        #:make-flags (list (string-append "BINDIR=" %output "/bin"))
154        #:phases
155        (alist-cons-after
156          'unpack 'unpack-tarballs
157          (lambda _
158            ;; FIXME: Bedops includes tarballs of minimally patched upstream
159            ;; libraries jansson, zlib, and bzip2.  We cannot just use stock
160            ;; libraries because at least one of the libraries (zlib) is
161            ;; patched to add a C++ function definition (deflateInit2cpp).
162            ;; Until the Bedops developers offer a way to link against system
163            ;; libraries we have to build the in-tree copies of these three
164            ;; libraries.
166            ;; See upstream discussion:
167            ;; https://github.com/bedops/bedops/issues/124
169            ;; Unpack the tarballs to benefit from shebang patching.
170            (with-directory-excursion "third-party"
171              (and (zero? (system* "tar" "xvf" "jansson-2.6.tar.bz2"))
172                   (zero? (system* "tar" "xvf" "zlib-1.2.7.tar.bz2"))
173                   (zero? (system* "tar" "xvf" "bzip2-1.0.6.tar.bz2"))))
174            ;; Disable unpacking of tarballs in Makefile.
175            (substitute* "system.mk/Makefile.linux"
176              (("^\tbzcat .*") "\t@echo \"not unpacking\"\n")
177              (("\\./configure") "CONFIG_SHELL=bash ./configure"))
178            (substitute* "third-party/zlib-1.2.7/Makefile.in"
179              (("^SHELL=.*$") "SHELL=bash\n")))
180          (alist-delete 'configure %standard-phases))))
181     (home-page "https://github.com/bedops/bedops")
182     (synopsis "Tools for high-performance genomic feature operations")
183     (description
184      "BEDOPS is a suite of tools to address common questions raised in genomic
185 studies---mostly with regard to overlap and proximity relationships between
186 data sets.  It aims to be scalable and flexible, facilitating the efficient
187 and accurate analysis and management of large-scale genomic data.
189 BEDOPS provides tools that perform highly efficient and scalable Boolean and
190 other set operations, statistical calculations, archiving, conversion and
191 other management of genomic data of arbitrary scale.  Tasks can be easily
192 split by chromosome for distributing whole-genome analyses across a
193 computational cluster.")
194     (license license:gpl2+)))
196 (define-public bedtools
197   (package
198     (name "bedtools")
199     (version "2.24.0")
200     (source (origin
201               (method url-fetch)
202               (uri (string-append "https://github.com/arq5x/bedtools2/archive/v"
203                                   version ".tar.gz"))
204               (file-name (string-append name "-" version ".tar.gz"))
205               (sha256
206                (base32
207                 "0lnxrjvs3nnmb4bmskag1wg3h2hd80przz5q3xd0bvs7vyxrvpbl"))))
208     (build-system gnu-build-system)
209     (native-inputs `(("python" ,python-2)))
210     (inputs `(("samtools" ,samtools)
211               ("zlib" ,zlib)))
212     (arguments
213      '(#:test-target "test"
214        #:phases
215        (alist-cons-after
216         'unpack 'patch-makefile-SHELL-definition
217         (lambda _
218           ;; patch-makefile-SHELL cannot be used here as it does not
219           ;; yet patch definitions with `:='.  Since changes to
220           ;; patch-makefile-SHELL result in a full rebuild, features
221           ;; of patch-makefile-SHELL are reimplemented here.
222           (substitute* "Makefile"
223             (("^SHELL := .*$") (string-append "SHELL := " (which "bash") " -e \n"))))
224         (alist-delete
225          'configure
226          (alist-replace
227           'install
228           (lambda* (#:key outputs #:allow-other-keys)
229             (let ((bin (string-append (assoc-ref outputs "out") "/bin/")))
230               (mkdir-p bin)
231               (for-each (lambda (file)
232                           (copy-file file (string-append bin (basename file))))
233                         (find-files "bin" ".*"))))
234           %standard-phases)))))
235     (home-page "https://github.com/arq5x/bedtools2")
236     (synopsis "Tools for genome analysis and arithmetic")
237     (description
238      "Collectively, the bedtools utilities are a swiss-army knife of tools for
239 a wide-range of genomics analysis tasks.  The most widely-used tools enable
240 genome arithmetic: that is, set theory on the genome.  For example, bedtools
241 allows one to intersect, merge, count, complement, and shuffle genomic
242 intervals from multiple files in widely-used genomic file formats such as BAM,
243 BED, GFF/GTF, VCF.")
244     (license license:gpl2)))
246 (define-public python2-pybedtools
247   (package
248     (name "python2-pybedtools")
249     (version "0.6.9")
250     (source (origin
251               (method url-fetch)
252               (uri (string-append
253                     "https://pypi.python.org/packages/source/p/pybedtools/pybedtools-"
254                     version ".tar.gz"))
255               (sha256
256                (base32
257                 "1ldzdxw1p4y3g2ignmggsdypvqkcwqwzhdha4rbgpih048z5p4an"))))
258     (build-system python-build-system)
259     (arguments `(#:python ,python-2)) ; no Python 3 support
260     (inputs
261      `(("python-cython" ,python2-cython)
262        ("python-matplotlib" ,python2-matplotlib)))
263     (propagated-inputs
264      `(("bedtools" ,bedtools)
265        ("samtools" ,samtools)))
266     (native-inputs
267      `(("python-pyyaml" ,python2-pyyaml)
268        ("python-nose" ,python2-nose)
269        ("python-setuptools" ,python2-setuptools)))
270     (home-page "https://pythonhosted.org/pybedtools/")
271     (synopsis "Python wrapper for BEDtools programs")
272     (description
273      "pybedtools is a Python wrapper for Aaron Quinlan's BEDtools programs,
274 which are widely used for genomic interval manipulation or \"genome algebra\".
275 pybedtools extends BEDTools by offering feature-level manipulations from with
276 Python.")
277     (license license:gpl2+)))
279 (define-public python-biopython
280   (package
281     (name "python-biopython")
282     (version "1.65")
283     (source (origin
284               (method url-fetch)
285               (uri (string-append
286                     "http://biopython.org/DIST/biopython-"
287                     version ".tar.gz"))
288               (sha256
289                (base32
290                 "13m8s9jkrw40zvdp1rl709n6lmgdh4f52aann7gzr6sfp0fwhg26"))))
291     (build-system python-build-system)
292     (inputs
293      `(("python-numpy" ,python-numpy)))
294     (native-inputs
295      `(("python-setuptools" ,python2-setuptools)))
296     (home-page "http://biopython.org/")
297     (synopsis "Tools for biological computation in Python")
298     (description
299      "Biopython is a set of tools for biological computation including parsers
300 for bioinformatics files into Python data structures; interfaces to common
301 bioinformatics programs; a standard sequence class and tools for performing
302 common operations on them; code to perform data classification; code for
303 dealing with alignments; code making it easy to split up parallelizable tasks
304 into separate processes; and more.")
305     (license (license:non-copyleft "http://www.biopython.org/DIST/LICENSE"))))
307 (define-public python2-biopython
308   (package (inherit (package-with-python2 python-biopython))
309     (inputs
310      `(("python2-numpy" ,python2-numpy)))))
312 (define-public blast+
313   (package
314     (name "blast+")
315     (version "2.2.31")
316     (source (origin
317               (method url-fetch)
318               (uri (string-append
319                     "ftp://ftp.ncbi.nlm.nih.gov/blast/executables/blast+/"
320                     version "/ncbi-blast-" version "+-src.tar.gz"))
321               (sha256
322                (base32
323                 "19gq6as4k1jrgsd26158ads6h7v4jca3h4r5dzg1y0m6ya50x5ph"))
324               (modules '((guix build utils)))
325               (snippet
326                '(begin
327                   ;; Remove bundled bzip2 and zlib
328                   (delete-file-recursively "c++/src/util/compress/bzip2")
329                   (delete-file-recursively "c++/src/util/compress/zlib")
330                   (substitute* "c++/src/util/compress/Makefile.in"
331                     (("bzip2 zlib api") "api"))
332                   ;; Remove useless msbuild directory
333                   (delete-file-recursively
334                    "c++/src/build-system/project_tree_builder/msbuild")
335                   #t))))
336     (build-system gnu-build-system)
337     (arguments
338      `(;; There are three(!) tests for this massive library, and all fail with
339        ;; "unparsable timing stats".
340        ;; ERR [127] --  [util/regexp] test_pcre.sh     (unparsable timing stats)
341        ;; ERR [127] --  [serial/datatool] datatool.sh     (unparsable timing stats)
342        ;; ERR [127] --  [serial/datatool] datatool_xml.sh     (unparsable timing stats)
343        #:tests? #f
344        #:out-of-source? #t
345        #:parallel-build? #f ; not supported
346        #:phases
347        (modify-phases %standard-phases
348          (add-before
349           'configure 'set-HOME
350           ;; $HOME needs to be set at some point during the configure phase
351           (lambda _ (setenv "HOME" "/tmp") #t))
352          (add-after
353           'unpack 'enter-dir
354           (lambda _ (chdir "c++") #t))
355          (add-after
356           'enter-dir 'fix-build-system
357           (lambda _
358             (define (which* cmd)
359               (cond ((string=? cmd "date")
360                      ;; make call to "date" deterministic
361                      "date -d @0")
362                     ((which cmd)
363                      => identity)
364                     (else
365                      (format (current-error-port)
366                              "WARNING: Unable to find absolute path for ~s~%"
367                              cmd)
368                      #f)))
370             ;; Rewrite hardcoded paths to various tools
371             (substitute* (append '("src/build-system/configure.ac"
372                                    "src/build-system/configure"
373                                    "scripts/common/impl/if_diff.sh"
374                                    "scripts/common/impl/run_with_lock.sh"
375                                    "src/build-system/Makefile.configurables.real"
376                                    "src/build-system/Makefile.in.top"
377                                    "src/build-system/Makefile.meta.gmake=no"
378                                    "src/build-system/Makefile.meta.in"
379                                    "src/build-system/Makefile.meta_l"
380                                    "src/build-system/Makefile.meta_p"
381                                    "src/build-system/Makefile.meta_r"
382                                    "src/build-system/Makefile.mk.in"
383                                    "src/build-system/Makefile.requirements"
384                                    "src/build-system/Makefile.rules_with_autodep.in")
385                                  (find-files "scripts/common/check" "\\.sh$"))
386               (("(/usr/bin/|/bin/)([a-z][-_.a-z]*)" all dir cmd)
387                (or (which* cmd) all)))
389             (substitute* (find-files "src/build-system" "^config.*")
390               (("LN_S=/bin/\\$LN_S") (string-append "LN_S=" (which "ln")))
391               (("^PATH=.*") ""))
393             ;; rewrite "/var/tmp" in check script
394             (substitute* "scripts/common/check/check_make_unix.sh"
395               (("/var/tmp") "/tmp"))
397             ;; do not reset PATH
398             (substitute* (find-files "scripts/common/impl/" "\\.sh$")
399               (("^ *PATH=.*") "")
400               (("action=/bin/") "action=")
401               (("export PATH") ":"))
402             #t))
403          (replace
404           'configure
405           (lambda* (#:key inputs outputs #:allow-other-keys)
406             (let ((out     (assoc-ref outputs "out"))
407                   (lib     (string-append (assoc-ref outputs "lib") "/lib"))
408                   (include (string-append (assoc-ref outputs "include")
409                                           "/include/ncbi-tools++")))
410               ;; The 'configure' script doesn't recognize things like
411               ;; '--enable-fast-install'.
412               (zero? (system* "./configure.orig"
413                               (string-append "--with-build-root=" (getcwd) "/build")
414                               (string-append "--prefix=" out)
415                               (string-append "--libdir=" lib)
416                               (string-append "--includedir=" include)
417                               (string-append "--with-bz2="
418                                              (assoc-ref inputs "bzip2"))
419                               (string-append "--with-z="
420                                              (assoc-ref inputs "zlib"))
421                               ;; Each library is built twice by default, once
422                               ;; with "-static" in its name, and again
423                               ;; without.
424                               "--without-static"
425                               "--with-dll"))))))))
426     (outputs '("out"       ;  19 MB
427                "lib"       ; 203 MB
428                "include")) ;  32 MB
429     (inputs
430      `(("bzip2" ,bzip2)
431        ("zlib" ,zlib)))
432     (native-inputs
433      `(("cpio" ,cpio)))
434     (home-page "http://blast.ncbi.nlm.nih.gov")
435     (synopsis "Basic local alignment search tool")
436     (description
437      "BLAST is a popular method of performing a DNA or protein sequence
438 similarity search, using heuristics to produce results quickly.  It also
439 calculates an “expect value” that estimates how many matches would have
440 occurred at a given score by chance, which can aid a user in judging how much
441 confidence to have in an alignment.")
442     ;; Most of the sources are in the public domain, with the following
443     ;; exceptions:
444     ;;   * Expat:
445     ;;     * ./c++/include/util/bitset/
446     ;;     * ./c++/src/html/ncbi_menu*.js
447     ;;   * Boost license:
448     ;;     * ./c++/include/util/impl/floating_point_comparison.hpp
449     ;;   * LGPL 2+:
450     ;;     * ./c++/include/dbapi/driver/odbc/unix_odbc/
451     ;;   * ASL 2.0:
452     ;;     * ./c++/src/corelib/teamcity_*
453     (license (list license:public-domain
454                    license:expat
455                    license:boost1.0
456                    license:lgpl2.0+
457                    license:asl2.0))))
459 (define-public bowtie
460   (package
461     (name "bowtie")
462     (version "2.2.4")
463     (source (origin
464               (method url-fetch)
465               (uri (string-append "https://github.com/BenLangmead/bowtie2/archive/v"
466                                   version ".tar.gz"))
467               (file-name (string-append name "-" version ".tar.gz"))
468               (sha256
469                (base32
470                 "15dnbqippwvhyh9zqjhaxkabk7lm1xbh1nvar1x4b5kwm117zijn"))
471               (modules '((guix build utils)))
472               (snippet
473                '(substitute* "Makefile"
474                   (("^CC = .*$") "CC = gcc")
475                   (("^CPP = .*$") "CPP = g++")
476                   ;; replace BUILD_HOST and BUILD_TIME for deterministic build
477                   (("-DBUILD_HOST=.*") "-DBUILD_HOST=\"\\\"guix\\\"\"")
478                   (("-DBUILD_TIME=.*") "-DBUILD_TIME=\"\\\"0\\\"\"")))
479               (patches (list (search-patch "bowtie-fix-makefile.patch")))))
480     (build-system gnu-build-system)
481     (inputs `(("perl" ,perl)
482               ("perl-clone" ,perl-clone)
483               ("perl-test-deep" ,perl-test-deep)
484               ("perl-test-simple" ,perl-test-simple)
485               ("python" ,python-2)))
486     (arguments
487      '(#:make-flags '("allall")
488        #:phases
489        (alist-delete
490         'configure
491         (alist-replace
492          'install
493          (lambda* (#:key outputs #:allow-other-keys)
494            (let ((bin (string-append (assoc-ref outputs "out") "/bin/")))
495              (mkdir-p bin)
496              (for-each (lambda (file)
497                          (copy-file file (string-append bin file)))
498                        (find-files "." "bowtie2.*"))))
499          (alist-replace
500           'check
501           (lambda* (#:key outputs #:allow-other-keys)
502             (system* "perl"
503                      "scripts/test/simple_tests.pl"
504                      "--bowtie2=./bowtie2"
505                      "--bowtie2-build=./bowtie2-build"))
506           %standard-phases)))))
507     (home-page "http://bowtie-bio.sourceforge.net/bowtie2/index.shtml")
508     (synopsis "Fast and sensitive nucleotide sequence read aligner")
509     (description
510      "Bowtie 2 is a fast and memory-efficient tool for aligning sequencing
511 reads to long reference sequences.  It is particularly good at aligning reads
512 of about 50 up to 100s or 1,000s of characters, and particularly good at
513 aligning to relatively long (e.g. mammalian) genomes.  Bowtie 2 indexes the
514 genome with an FM Index to keep its memory footprint small: for the human
515 genome, its memory footprint is typically around 3.2 GB.  Bowtie 2 supports
516 gapped, local, and paired-end alignment modes.")
517     (supported-systems '("x86_64-linux"))
518     (license license:gpl3+)))
520 (define-public bwa
521   (package
522     (name "bwa")
523     (version "0.7.12")
524     (source (origin
525               (method url-fetch)
526               (uri (string-append "mirror://sourceforge/bio-bwa/bwa-"
527                                   version ".tar.bz2"))
528               (sha256
529                (base32
530                 "1330dpqncv0px3pbhjzz1gwgg39kkcv2r9qp2xs0sixf8z8wl7bh"))))
531     (build-system gnu-build-system)
532     (arguments
533      '(#:tests? #f ;no "check" target
534        #:phases
535        (alist-replace
536         'install
537         (lambda* (#:key outputs #:allow-other-keys)
538           (let ((bin (string-append
539                       (assoc-ref outputs "out") "/bin"))
540                 (doc (string-append
541                       (assoc-ref outputs "out") "/share/doc/bwa"))
542                 (man (string-append
543                       (assoc-ref outputs "out") "/share/man/man1")))
544             (mkdir-p bin)
545             (mkdir-p doc)
546             (mkdir-p man)
547             (copy-file "bwa" (string-append bin "/bwa"))
548             (copy-file "README.md" (string-append doc "/README.md"))
549             (copy-file "bwa.1" (string-append man "/bwa.1"))))
550         ;; no "configure" script
551         (alist-delete 'configure %standard-phases))))
552     (inputs `(("zlib" ,zlib)))
553     (home-page "http://bio-bwa.sourceforge.net/")
554     (synopsis "Burrows-Wheeler sequence aligner")
555     (description
556      "BWA is a software package for mapping low-divergent sequences against a
557 large reference genome, such as the human genome.  It consists of three
558 algorithms: BWA-backtrack, BWA-SW and BWA-MEM.  The first algorithm is
559 designed for Illumina sequence reads up to 100bp, while the rest two for
560 longer sequences ranged from 70bp to 1Mbp.  BWA-MEM and BWA-SW share similar
561 features such as long-read support and split alignment, but BWA-MEM, which is
562 the latest, is generally recommended for high-quality queries as it is faster
563 and more accurate.  BWA-MEM also has better performance than BWA-backtrack for
564 70-100bp Illumina reads.")
565     (license license:gpl3+)))
567 (define-public python2-bx-python
568   (package
569     (name "python2-bx-python")
570     (version "0.7.2")
571     (source (origin
572               (method url-fetch)
573               (uri (string-append
574                     "https://pypi.python.org/packages/source/b/bx-python/bx-python-"
575                     version ".tar.gz"))
576               (sha256
577                (base32
578                 "0ld49idhc5zjdvbhvjq1a2qmpjj7h5v58rqr25dzmfq7g34b50xh"))
579               (modules '((guix build utils)))
580               (snippet
581                '(substitute* "setup.py"
582                   ;; remove dependency on outdated "distribute" module
583                   (("^from distribute_setup import use_setuptools") "")
584                   (("^use_setuptools\\(\\)") "")))))
585     (build-system python-build-system)
586     (arguments
587      `(#:tests? #f ;tests fail because test data are not included
588        #:python ,python-2))
589     (inputs
590      `(("python-numpy" ,python2-numpy)
591        ("zlib" ,zlib)))
592     (native-inputs
593      `(("python-nose" ,python2-nose)
594        ("python-setuptools" ,python2-setuptools)))
595     (home-page "http://bitbucket.org/james_taylor/bx-python/")
596     (synopsis "Tools for manipulating biological data")
597     (description
598      "bx-python provides tools for manipulating biological data, particularly
599 multiple sequence alignments.")
600     (license license:expat)))
602 (define-public clipper
603   (package
604     (name "clipper")
605     (version "0.3.0")
606     (source (origin
607               (method url-fetch)
608               (uri (string-append
609                     "https://github.com/YeoLab/clipper/archive/"
610                     version ".tar.gz"))
611               (sha256
612                (base32
613                 "1q7jpimsqln7ic44i8v2rx2haj5wvik8hc1s2syd31zcn0xk1iyq"))
614               (modules '((guix build utils)))
615               (snippet
616                ;; remove unnecessary setup dependency
617                '(substitute* "setup.py"
618                   (("setup_requires = .*") "")))))
619     (build-system python-build-system)
620     (arguments `(#:python ,python-2)) ; only Python 2 is supported
621     (inputs
622      `(("htseq" ,htseq)
623        ("python-pybedtools" ,python2-pybedtools)
624        ("python-cython" ,python2-cython)
625        ("python-scikit-learn" ,python2-scikit-learn)
626        ("python-matplotlib" ,python2-matplotlib)
627        ("python-pysam" ,python2-pysam)
628        ("python-numpy" ,python2-numpy)
629        ("python-scipy" ,python2-scipy)))
630     (native-inputs
631      `(("python-mock" ,python2-mock) ; for tests
632        ("python-pytz" ,python2-pytz) ; for tests
633        ("python-setuptools" ,python2-setuptools)))
634     (home-page "https://github.com/YeoLab/clipper")
635     (synopsis "CLIP peak enrichment recognition")
636     (description
637      "CLIPper is a tool to define peaks in CLIP-seq datasets.")
638     (license license:gpl2)))
640 (define-public couger
641   (package
642     (name "couger")
643     (version "1.8.2")
644     (source (origin
645               (method url-fetch)
646               (uri (string-append
647                     "http://couger.oit.duke.edu/static/assets/COUGER"
648                     version ".zip"))
649               (sha256
650                (base32
651                 "04p2b14nmhzxw5h72mpzdhalv21bx4w9b87z0wpw0xzxpysyncmq"))))
652     (build-system gnu-build-system)
653     (arguments
654      `(#:tests? #f
655        #:phases
656        (modify-phases %standard-phases
657          (delete 'configure)
658          (delete 'build)
659          (replace
660           'install
661           (lambda* (#:key outputs #:allow-other-keys)
662             (let ((out (assoc-ref outputs "out")))
663               (copy-recursively "src" (string-append out "/src"))
664               (mkdir (string-append out "/bin"))
665               ;; Add "src" directory to module lookup path.
666               (substitute* "couger"
667                 (("from argparse")
668                  (string-append "import sys\nsys.path.append(\""
669                                 out "\")\nfrom argparse")))
670               (copy-file "couger" (string-append out "/bin/couger")))
671             #t))
672          (add-after
673           'install 'wrap-program
674           (lambda* (#:key inputs outputs #:allow-other-keys)
675             ;; Make sure 'couger' runs with the correct PYTHONPATH.
676             (let* ((out (assoc-ref outputs "out"))
677                    (path (getenv "PYTHONPATH")))
678               (wrap-program (string-append out "/bin/couger")
679                 `("PYTHONPATH" ":" prefix (,path))))
680             #t)))))
681     (inputs
682      `(("python" ,python-2)
683        ("python2-pillow" ,python2-pillow)
684        ("python2-numpy" ,python2-numpy)
685        ("python2-scipy" ,python2-scipy)
686        ("python2-matplotlib" ,python2-matplotlib)))
687     (propagated-inputs
688      `(("r" ,r)
689        ("libsvm" ,libsvm)
690        ("randomjungle" ,randomjungle)))
691     (native-inputs
692      `(("unzip" ,unzip)))
693     (home-page "http://couger.oit.duke.edu")
694     (synopsis "Identify co-factors in sets of genomic regions")
695     (description
696      "COUGER can be applied to any two sets of genomic regions bound by
697 paralogous TFs (e.g., regions derived from ChIP-seq experiments) to identify
698 putative co-factors that provide specificity to each TF.  The framework
699 determines the genomic targets uniquely-bound by each TF, and identifies a
700 small set of co-factors that best explain the in vivo binding differences
701 between the two TFs.
703 COUGER uses classification algorithms (support vector machines and random
704 forests) with features that reflect the DNA binding specificities of putative
705 co-factors.  The features are generated either from high-throughput TF-DNA
706 binding data (from protein binding microarray experiments), or from large
707 collections of DNA motifs.")
708     (license license:gpl3+)))
710 (define-public clustal-omega
711   (package
712     (name "clustal-omega")
713     (version "1.2.1")
714     (source (origin
715               (method url-fetch)
716               (uri (string-append
717                     "http://www.clustal.org/omega/clustal-omega-"
718                     version ".tar.gz"))
719               (sha256
720                (base32
721                 "02ibkx0m0iwz8nscg998bh41gg251y56cgh86bvyrii5m8kjgwqf"))))
722     (build-system gnu-build-system)
723     (inputs
724      `(("argtable" ,argtable)))
725     (home-page "http://www.clustal.org/omega/")
726     (synopsis "Multiple sequence aligner for protein and DNA/RNA")
727     (description
728      "Clustal-Omega is a general purpose multiple sequence alignment (MSA)
729 program for protein and DNA/RNA.  It produces high quality MSAs and is capable
730 of handling data-sets of hundreds of thousands of sequences in reasonable
731 time.")
732     (license license:gpl2+)))
734 (define-public crossmap
735   (package
736     (name "crossmap")
737     (version "0.1.6")
738     (source (origin
739               (method url-fetch)
740               (uri (string-append "mirror://sourceforge/crossmap/CrossMap-"
741                                   version ".tar.gz"))
742               (sha256
743                (base32
744                 "163hi5gjgij6cndxlvbkp5jjwr0k4wbm9im6d2210278q7k9kpnp"))
745               ;; patch has been sent upstream already
746               (patches (list
747                         (search-patch "crossmap-allow-system-pysam.patch")))
748               (modules '((guix build utils)))
749               ;; remove bundled copy of pysam
750               (snippet
751                '(delete-file-recursively "lib/pysam"))))
752     (build-system python-build-system)
753     (arguments
754      `(#:python ,python-2
755        #:phases
756        (alist-cons-after
757         'unpack 'set-env
758         (lambda _ (setenv "CROSSMAP_USE_SYSTEM_PYSAM" "1"))
759         %standard-phases)))
760     (inputs
761      `(("python-numpy" ,python2-numpy)
762        ("python-pysam" ,python2-pysam)
763        ("zlib" ,zlib)))
764     (native-inputs
765      `(("python-cython" ,python2-cython)
766        ("python-nose" ,python2-nose)
767        ("python-setuptools" ,python2-setuptools)))
768     (home-page "http://crossmap.sourceforge.net/")
769     (synopsis "Convert genome coordinates between assemblies")
770     (description
771      "CrossMap is a program for conversion of genome coordinates or annotation
772 files between different genome assemblies.  It supports most commonly used
773 file formats including SAM/BAM, Wiggle/BigWig, BED, GFF/GTF, VCF.")
774     (license license:gpl2+)))
776 (define-public cutadapt
777   (package
778     (name "cutadapt")
779     (version "1.8")
780     (source (origin
781               (method url-fetch)
782               (uri (string-append
783                     "https://github.com/marcelm/cutadapt/archive/v"
784                     version ".tar.gz"))
785               (file-name (string-append name "-" version ".tar.gz"))
786               (sha256
787                (base32
788                 "161bp87y6gd6r5bmvjpn2b1k942i3fizfpa139f0jn6jv1wcp5h5"))))
789     (build-system python-build-system)
790     (arguments
791      ;; tests must be run after install
792      `(#:phases (alist-cons-after
793                  'install 'check
794                  (lambda* (#:key inputs outputs #:allow-other-keys)
795                    (setenv "PYTHONPATH"
796                            (string-append
797                             (getenv "PYTHONPATH")
798                             ":" (assoc-ref outputs "out")
799                             "/lib/python"
800                             (string-take (string-take-right
801                                           (assoc-ref inputs "python") 5) 3)
802                             "/site-packages"))
803                    (zero? (system* "nosetests" "-P" "tests")))
804                  (alist-delete 'check %standard-phases))))
805     (native-inputs
806      `(("python-cython" ,python-cython)
807        ("python-nose" ,python-nose)
808        ("python-setuptools" ,python-setuptools)))
809     (home-page "https://code.google.com/p/cutadapt/")
810     (synopsis "Remove adapter sequences from nucleotide sequencing reads")
811     (description
812      "Cutadapt finds and removes adapter sequences, primers, poly-A tails and
813 other types of unwanted sequence from high-throughput sequencing reads.")
814     (license license:expat)))
816 (define-public diamond
817   (package
818     (name "diamond")
819     (version "0.7.9")
820     (source (origin
821               (method url-fetch)
822               (uri (string-append
823                     "https://github.com/bbuchfink/diamond/archive/v"
824                     version ".tar.gz"))
825               (file-name (string-append name "-" version ".tar.gz"))
826               (sha256
827                (base32
828                 "0hfkcfv9f76h5brbyw9fyvmc0l9cmbsxrcdqk0fa9xv82zj47p15"))
829               (snippet '(begin
830                           (delete-file "bin/diamond")
831                           #t))))
832     (build-system gnu-build-system)
833     (arguments
834      '(#:tests? #f  ;no "check" target
835        #:phases
836        (modify-phases %standard-phases
837          (add-after 'unpack 'enter-source-dir
838                     (lambda _
839                       (chdir "src")
840                       #t))
841          (delete 'configure)
842          (replace 'install
843                   (lambda* (#:key outputs #:allow-other-keys)
844                     (let ((bin (string-append (assoc-ref outputs "out")
845                                               "/bin")))
846                       (mkdir-p bin)
847                       (copy-file "../bin/diamond"
848                                  (string-append bin "/diamond"))
849                       #t))))))
850     (native-inputs
851      `(("bc" ,bc)))
852     (inputs
853      `(("boost" ,boost)
854        ("zlib" ,zlib)))
855     (home-page "https://github.com/bbuchfink/diamond")
856     (synopsis "Accelerated BLAST compatible local sequence aligner")
857     (description
858      "DIAMOND is a BLAST-compatible local aligner for mapping protein and
859 translated DNA query sequences against a protein reference database (BLASTP
860 and BLASTX alignment mode).  The speedup over BLAST is up to 20,000 on short
861 reads at a typical sensitivity of 90-99% relative to BLAST depending on the
862 data and settings.")
863     (license (license:non-copyleft "file://src/COPYING"
864                                    "See src/COPYING in the distribution."))))
866 (define-public edirect
867   (package
868     (name "edirect")
869     (version "2.50")
870     (source (origin
871               (method url-fetch)
872               ;; Note: older versions are not retained.
873               (uri "ftp://ftp.ncbi.nlm.nih.gov/entrez/entrezdirect/edirect.zip")
874               (sha256
875                (base32
876                 "08afhz2ph66h8h381hl1mqyxkdi5nbvzsyj9gfw3jfbdijnpi4qj"))))
877     (build-system perl-build-system)
878     (arguments
879      `(#:tests? #f ;no "check" target
880        #:phases
881        (modify-phases %standard-phases
882          (delete 'configure)
883          (delete 'build)
884          (replace 'install
885                   (lambda* (#:key outputs #:allow-other-keys)
886                     (let ((target (string-append (assoc-ref outputs "out")
887                                                  "/bin")))
888                       (mkdir-p target)
889                       (copy-file "edirect.pl"
890                                  (string-append target "/edirect.pl"))
891                       #t)))
892          (add-after
893           'install 'wrap-program
894           (lambda* (#:key inputs outputs #:allow-other-keys)
895             ;; Make sure 'edirect.pl' finds all perl inputs at runtime.
896             (let* ((out (assoc-ref outputs "out"))
897                    (path (getenv "PERL5LIB")))
898               (wrap-program (string-append out "/bin/edirect.pl")
899                 `("PERL5LIB" ":" prefix (,path)))))))))
900     (inputs
901      `(("perl-html-parser" ,perl-html-parser)
902        ("perl-encode-locale" ,perl-encode-locale)
903        ("perl-file-listing" ,perl-file-listing)
904        ("perl-html-tagset" ,perl-html-tagset)
905        ("perl-html-tree" ,perl-html-tree)
906        ("perl-http-cookies" ,perl-http-cookies)
907        ("perl-http-date" ,perl-http-date)
908        ("perl-http-message" ,perl-http-message)
909        ("perl-http-negotiate" ,perl-http-negotiate)
910        ("perl-lwp-mediatypes" ,perl-lwp-mediatypes)
911        ("perl-lwp-protocol-https" ,perl-lwp-protocol-https)
912        ("perl-net-http" ,perl-net-http)
913        ("perl-uri" ,perl-uri)
914        ("perl-www-robotrules" ,perl-www-robotrules)
915        ("perl" ,perl)))
916     (native-inputs
917      `(("unzip" ,unzip)))
918     (home-page "http://www.ncbi.nlm.nih.gov/books/NBK179288")
919     (synopsis "Tools for accessing the NCBI's set of databases")
920     (description
921      "Entrez Direct (EDirect) is a method for accessing the National Center
922 for Biotechnology Information's (NCBI) set of interconnected
923 databases (publication, sequence, structure, gene, variation, expression,
924 etc.) from a terminal.  Functions take search terms from command-line
925 arguments.  Individual operations are combined to build multi-step queries.
926 Record retrieval and formatting normally complete the process.
928 EDirect also provides an argument-driven function that simplifies the
929 extraction of data from document summaries or other results that are returned
930 in structured XML format.  This can eliminate the need for writing custom
931 software to answer ad hoc questions.")
932     (license license:public-domain)))
934 (define-public express
935   (package
936     (name "express")
937     (version "1.5.1")
938     (source (origin
939               (method url-fetch)
940               (uri
941                (string-append
942                 "http://bio.math.berkeley.edu/eXpress/downloads/express-"
943                 version "/express-" version "-src.tgz"))
944               (sha256
945                (base32
946                 "03rczxd0gjp2l1jxcmjfmf5j94j77zqyxa6x063zsc585nj40n0c"))))
947     (build-system cmake-build-system)
948     (arguments
949      `(#:tests? #f ;no "check" target
950        #:phases
951        (alist-cons-after
952         'unpack 'use-shared-boost-libs-and-set-bamtools-paths
953         (lambda* (#:key inputs #:allow-other-keys)
954           (substitute* "CMakeLists.txt"
955             (("set\\(Boost_USE_STATIC_LIBS ON\\)")
956              "set(Boost_USE_STATIC_LIBS OFF)")
957             (("\\$\\{CMAKE_CURRENT_SOURCE_DIR\\}/bamtools/include")
958              (string-append (assoc-ref inputs "bamtools") "/include/bamtools")))
959           (substitute* "src/CMakeLists.txt"
960             (("\\$\\{CMAKE_CURRENT_SOURCE_DIR\\}/\\.\\./bamtools/lib")
961              (string-append (assoc-ref inputs "bamtools") "/lib/bamtools")))
962           #t)
963         %standard-phases)))
964     (inputs
965      `(("boost" ,boost)
966        ("bamtools" ,bamtools)
967        ("protobuf" ,protobuf)
968        ("zlib" ,zlib)))
969     (home-page "http://bio.math.berkeley.edu/eXpress")
970     (synopsis "Streaming quantification for high-throughput genomic sequencing")
971     (description
972      "eXpress is a streaming tool for quantifying the abundances of a set of
973 target sequences from sampled subsequences.  Example applications include
974 transcript-level RNA-Seq quantification, allele-specific/haplotype expression
975 analysis (from RNA-Seq), transcription factor binding quantification in
976 ChIP-Seq, and analysis of metagenomic data.")
977     (license license:artistic2.0)))
979 (define-public fasttree
980   (package
981    (name "fasttree")
982    (version "2.1.8")
983    (source (origin
984              (method url-fetch)
985              (uri (string-append
986                    "http://www.microbesonline.org/fasttree/FastTree-"
987                    version ".c"))
988              (sha256
989               (base32
990                "0dzqc9vr9iiiw21y159xfjl2z90vw0y7r4x6456pcaxiy5hd2wmi"))))
991    (build-system gnu-build-system)
992    (arguments
993     `(#:tests? #f ; no "check" target
994       #:phases
995       (modify-phases %standard-phases
996         (delete 'unpack)
997         (delete 'configure)
998         (replace 'build
999                  (lambda* (#:key source #:allow-other-keys)
1000                    (and (zero? (system* "gcc"
1001                                         "-O3"
1002                                         "-finline-functions"
1003                                         "-funroll-loops"
1004                                         "-Wall"
1005                                         "-o"
1006                                         "FastTree"
1007                                         source
1008                                         "-lm"))
1009                         (zero? (system* "gcc"
1010                                         "-DOPENMP"
1011                                         "-fopenmp"
1012                                         "-O3"
1013                                         "-finline-functions"
1014                                         "-funroll-loops"
1015                                         "-Wall"
1016                                         "-o"
1017                                         "FastTreeMP"
1018                                         source
1019                                         "-lm")))))
1020         (replace 'install
1021                  (lambda* (#:key outputs #:allow-other-keys)
1022                    (let ((bin (string-append (assoc-ref outputs "out")
1023                                              "/bin")))
1024                      (mkdir-p bin)
1025                      (copy-file "FastTree"
1026                                 (string-append bin "/FastTree"))
1027                      (copy-file "FastTreeMP"
1028                                 (string-append bin "/FastTreeMP"))
1029                      #t))))))
1030    (home-page "http://www.microbesonline.org/fasttree")
1031    (synopsis "Infers approximately-maximum-likelihood phylogenetic trees")
1032    (description
1033     "FastTree can handle alignments with up to a million of sequences in a
1034 reasonable amount of time and memory.  For large alignments, FastTree is
1035 100-1,000 times faster than PhyML 3.0 or RAxML 7.")
1036    (license license:gpl2+)))
1038 (define-public fastx-toolkit
1039   (package
1040     (name "fastx-toolkit")
1041     (version "0.0.14")
1042     (source (origin
1043               (method url-fetch)
1044               (uri
1045                (string-append
1046                 "https://github.com/agordon/fastx_toolkit/releases/download/"
1047                 version "/fastx_toolkit-" version ".tar.bz2"))
1048               (sha256
1049                (base32
1050                 "01jqzw386873sr0pjp1wr4rn8fsga2vxs1qfmicvx1pjr72007wy"))))
1051     (build-system gnu-build-system)
1052     (inputs
1053      `(("libgtextutils" ,libgtextutils)))
1054     (native-inputs
1055      `(("pkg-config" ,pkg-config)))
1056     (home-page "http://hannonlab.cshl.edu/fastx_toolkit/")
1057     (synopsis "Tools for FASTA/FASTQ file preprocessing")
1058     (description
1059      "The FASTX-Toolkit is a collection of command line tools for Short-Reads
1060 FASTA/FASTQ files preprocessing.
1062 Next-Generation sequencing machines usually produce FASTA or FASTQ files,
1063 containing multiple short-reads sequences.  The main processing of such
1064 FASTA/FASTQ files is mapping the sequences to reference genomes.  However, it
1065 is sometimes more productive to preprocess the files before mapping the
1066 sequences to the genome---manipulating the sequences to produce better mapping
1067 results.  The FASTX-Toolkit tools perform some of these preprocessing tasks.")
1068     (license license:agpl3+)))
1070 (define-public flexbar
1071   (package
1072     (name "flexbar")
1073     (version "2.5")
1074     (source (origin
1075               (method url-fetch)
1076               (uri
1077                (string-append "mirror://sourceforge/flexbar/"
1078                               version "/flexbar_v" version "_src.tgz"))
1079               (sha256
1080                (base32
1081                 "13jaykc3y1x8y5nn9j8ljnb79s5y51kyxz46hdmvvjj6qhyympmf"))))
1082     (build-system cmake-build-system)
1083     (arguments
1084      `(#:configure-flags (list
1085                           (string-append "-DFLEXBAR_BINARY_DIR="
1086                                          (assoc-ref %outputs "out")
1087                                          "/bin/"))
1088        #:phases
1089        (alist-replace
1090         'check
1091         (lambda* (#:key outputs #:allow-other-keys)
1092           (setenv "PATH" (string-append
1093                           (assoc-ref outputs "out") "/bin:"
1094                           (getenv "PATH")))
1095           (chdir "../flexbar_v2.5_src/test")
1096           (zero? (system* "bash" "flexbar_validate.sh")))
1097         (alist-delete 'install %standard-phases))))
1098     (inputs
1099      `(("tbb" ,tbb)
1100        ("zlib" ,zlib)))
1101     (native-inputs
1102      `(("pkg-config" ,pkg-config)
1103        ("seqan" ,seqan)))
1104     (home-page "http://flexbar.sourceforge.net")
1105     (synopsis "Barcode and adapter removal tool for sequencing platforms")
1106     (description
1107      "Flexbar preprocesses high-throughput nucleotide sequencing data
1108 efficiently.  It demultiplexes barcoded runs and removes adapter sequences.
1109 Moreover, trimming and filtering features are provided.  Flexbar increases
1110 read mapping rates and improves genome and transcriptome assemblies.  It
1111 supports next-generation sequencing data in fasta/q and csfasta/q format from
1112 Illumina, Roche 454, and the SOLiD platform.")
1113     (license license:gpl3)))
1115 (define-public grit
1116   (package
1117     (name "grit")
1118     (version "2.0.2")
1119     (source (origin
1120               (method url-fetch)
1121               (uri (string-append
1122                     "https://github.com/nboley/grit/archive/"
1123                     version ".tar.gz"))
1124               (file-name (string-append name "-" version ".tar.gz"))
1125               (sha256
1126                (base32
1127                 "157in84dj70wimbind3x7sy1whs3h57qfgcnj2s6lrd38fbrb7mj"))))
1128     (build-system python-build-system)
1129     (arguments
1130      `(#:python ,python-2
1131        #:phases
1132        (alist-cons-after
1133         'unpack 'generate-from-cython-sources
1134         (lambda* (#:key inputs outputs #:allow-other-keys)
1135           ;; Delete these C files to force fresh generation from pyx sources.
1136           (delete-file "grit/sparsify_support_fns.c")
1137           (delete-file "grit/call_peaks_support_fns.c")
1138           (substitute* "setup.py"
1139             (("Cython.Setup") "Cython.Build")
1140             ;; Add numpy include path to fix compilation
1141             (("pyx\", \\]")
1142              (string-append "pyx\", ], include_dirs = ['"
1143                             (assoc-ref inputs "python-numpy")
1144                             "/lib/python2.7/site-packages/numpy/core/include/"
1145                             "']"))) #t)
1146         %standard-phases)))
1147     (inputs
1148      `(("python-scipy" ,python2-scipy)
1149        ("python-numpy" ,python2-numpy)
1150        ("python-pysam" ,python2-pysam)
1151        ("python-networkx" ,python2-networkx)))
1152     (native-inputs
1153      `(("python-cython" ,python2-cython)
1154        ("python-setuptools" ,python2-setuptools)))
1155     (home-page "http://grit-bio.org")
1156     (synopsis "Tool for integrative analysis of RNA-seq type assays")
1157     (description
1158      "GRIT is designed to use RNA-seq, TES, and TSS data to build and quantify
1159 full length transcript models.  When none of these data sources are available,
1160 GRIT can be run by providing a candidate set of TES or TSS sites.  In
1161 addition, GRIT can merge in reference junctions and gene boundaries.  GRIT can
1162 also be run in quantification mode, where it uses a provided GTF file and just
1163 estimates transcript expression.")
1164     (license license:gpl3+)))
1166 (define-public hisat
1167   (package
1168     (name "hisat")
1169     (version "0.1.4")
1170     (source (origin
1171               (method url-fetch)
1172               (uri (string-append
1173                     "http://ccb.jhu.edu/software/hisat/downloads/hisat-"
1174                     version "-beta-source.zip"))
1175               (sha256
1176                (base32
1177                 "1k381ydranqxp09yf2y7w1d0chz5d59vb6jchi89hbb0prq19lk5"))))
1178     (build-system gnu-build-system)
1179     (arguments
1180      `(#:tests? #f ;no check target
1181        #:make-flags '("allall"
1182                       ;; Disable unsupported `popcnt' instructions on
1183                       ;; architectures other than x86_64
1184                       ,@(if (string-prefix? "x86_64"
1185                                             (or (%current-target-system)
1186                                                 (%current-system)))
1187                             '()
1188                             '("POPCNT_CAPABILITY=0")))
1189        #:phases
1190        (alist-cons-after
1191         'unpack 'patch-sources
1192         (lambda _
1193           ;; XXX Cannot use snippet because zip files are not supported
1194           (substitute* "Makefile"
1195             (("^CC = .*$") "CC = gcc")
1196             (("^CPP = .*$") "CPP = g++")
1197             ;; replace BUILD_HOST and BUILD_TIME for deterministic build
1198             (("-DBUILD_HOST=.*") "-DBUILD_HOST=\"\\\"guix\\\"\"")
1199             (("-DBUILD_TIME=.*") "-DBUILD_TIME=\"\\\"0\\\"\""))
1200           (substitute* '("hisat-build" "hisat-inspect")
1201             (("/usr/bin/env") (which "env"))))
1202         (alist-replace
1203          'install
1204          (lambda* (#:key outputs #:allow-other-keys)
1205            (let ((bin (string-append (assoc-ref outputs "out") "/bin/")))
1206              (mkdir-p bin)
1207              (for-each
1208               (lambda (file)
1209                 (copy-file file (string-append bin file)))
1210               (find-files
1211                "."
1212                "hisat(-(build|align|inspect)(-(s|l)(-debug)*)*)*$"))))
1213          (alist-delete 'configure %standard-phases)))))
1214     (native-inputs
1215      `(("unzip" ,unzip)))
1216     (inputs
1217      `(("perl" ,perl)
1218        ("python" ,python)
1219        ("zlib" ,zlib)))
1220     (home-page "http://ccb.jhu.edu/software/hisat/index.shtml")
1221     (synopsis "Hierarchical indexing for spliced alignment of transcripts")
1222     (description
1223      "HISAT is a fast and sensitive spliced alignment program for mapping
1224 RNA-seq reads.  In addition to one global FM index that represents a whole
1225 genome, HISAT uses a large set of small FM indexes that collectively cover the
1226 whole genome.  These small indexes (called local indexes) combined with
1227 several alignment strategies enable effective alignment of RNA-seq reads, in
1228 particular, reads spanning multiple exons.")
1229     (license license:gpl3+)))
1231 (define-public hmmer
1232   (package
1233     (name "hmmer")
1234     (version "3.1b2")
1235     (source (origin
1236               (method url-fetch)
1237               (uri (string-append
1238                     "http://selab.janelia.org/software/hmmer"
1239                     (version-prefix version 1) "/"
1240                     version "/hmmer-" version ".tar.gz"))
1241               (sha256
1242                (base32
1243                 "0djmgc0pfli0jilfx8hql1axhwhqxqb8rxg2r5rg07aw73sfs5nx"))))
1244     (build-system gnu-build-system)
1245     (native-inputs `(("perl", perl)))
1246     (home-page "http://hmmer.janelia.org")
1247     (synopsis "Biosequence analysis using profile hidden Markov models")
1248     (description
1249      "HMMER is used for searching sequence databases for homologs of protein
1250 sequences, and for making protein sequence alignments.  It implements methods
1251 using probabilistic models called profile hidden Markov models (profile
1252 HMMs).")
1253     (license (list license:gpl3+
1254                    ;; The bundled library 'easel' is distributed
1255                    ;; under The Janelia Farm Software License.
1256                    (license:non-copyleft
1257                     "file://easel/LICENSE"
1258                     "See easel/LICENSE in the distribution.")))))
1260 (define-public htseq
1261   (package
1262     (name "htseq")
1263     (version "0.6.1")
1264     (source (origin
1265               (method url-fetch)
1266               (uri (string-append
1267                     "https://pypi.python.org/packages/source/H/HTSeq/HTSeq-"
1268                     version ".tar.gz"))
1269               (sha256
1270                (base32
1271                 "1i85ppf2j2lj12m0x690qq5nn17xxk23pbbx2c83r8ayb5wngzwv"))))
1272     (build-system python-build-system)
1273     (arguments `(#:python ,python-2)) ; only Python 2 is supported
1274     (inputs
1275      `(("python-numpy" ,python2-numpy)
1276        ("python-setuptools" ,python2-setuptools)))
1277     (home-page "http://www-huber.embl.de/users/anders/HTSeq/")
1278     (synopsis "Analysing high-throughput sequencing data with Python")
1279     (description
1280      "HTSeq is a Python package that provides infrastructure to process data
1281 from high-throughput sequencing assays.")
1282     (license license:gpl3+)))
1284 (define-public htsjdk
1285   (package
1286     (name "htsjdk")
1287     (version "1.129")
1288     (source (origin
1289               (method url-fetch)
1290               (uri (string-append
1291                     "https://github.com/samtools/htsjdk/archive/"
1292                     version ".tar.gz"))
1293               (file-name (string-append name "-" version ".tar.gz"))
1294               (sha256
1295                (base32
1296                 "0asdk9b8jx2ij7yd6apg9qx03li8q7z3ml0qy2r2qczkra79y6fw"))
1297               (modules '((guix build utils)))
1298               ;; remove build dependency on git
1299               (snippet '(substitute* "build.xml"
1300                           (("failifexecutionfails=\"true\"")
1301                            "failifexecutionfails=\"false\"")))))
1302     (build-system gnu-build-system)
1303     (arguments
1304      `(#:modules ((srfi srfi-1)
1305                   (guix build gnu-build-system)
1306                   (guix build utils))
1307        #:phases (alist-replace
1308                  'build
1309                  (lambda _
1310                    (setenv "JAVA_HOME" (assoc-ref %build-inputs "jdk"))
1311                    (zero? (system* "ant" "all"
1312                                    (string-append "-Ddist="
1313                                                   (assoc-ref %outputs "out")
1314                                                   "/share/java/htsjdk/"))))
1315                  (fold alist-delete %standard-phases
1316                        '(configure install check)))))
1317     (native-inputs
1318      `(("ant" ,ant)
1319        ("jdk" ,icedtea6 "jdk")))
1320     (home-page "http://samtools.github.io/htsjdk/")
1321     (synopsis "Java API for high-throughput sequencing data (HTS) formats")
1322     (description
1323      "HTSJDK is an implementation of a unified Java library for accessing
1324 common file formats, such as SAM and VCF, used for high-throughput
1325 sequencing (HTS) data.  There are also an number of useful utilities for
1326 manipulating HTS data.")
1327     (license license:expat)))
1329 (define-public htslib
1330   (package
1331     (name "htslib")
1332     (version "1.2.1")
1333     (source (origin
1334               (method url-fetch)
1335               (uri (string-append
1336                     "https://github.com/samtools/htslib/releases/download/"
1337                     version "/htslib-" version ".tar.bz2"))
1338               (sha256
1339                (base32
1340                 "1c32ssscbnjwfw3dra140fq7riarp2x990qxybh34nr1p5r17nxx"))))
1341     (build-system gnu-build-system)
1342     (arguments
1343      `(#:phases
1344        (modify-phases %standard-phases
1345          (add-after
1346           'unpack 'patch-tests
1347           (lambda _
1348             (substitute* "test/test.pl"
1349               (("/bin/bash") (which "bash")))
1350             #t)))))
1351     (inputs
1352      `(("zlib" ,zlib)))
1353     (native-inputs
1354      `(("perl" ,perl)))
1355     (home-page "http://www.htslib.org")
1356     (synopsis "C library for reading/writing high-throughput sequencing data")
1357     (description
1358      "HTSlib is a C library for reading/writing high-throughput sequencing
1359 data.  It also provides the bgzip, htsfile, and tabix utilities.")
1360     ;; Files under cram/ are released under the modified BSD license;
1361     ;; the rest is released under the Expat license
1362     (license (list license:expat license:bsd-3))))
1364 (define-public idr
1365   (package
1366     (name "idr")
1367     (version "2.0.0")
1368     (source (origin
1369               (method url-fetch)
1370               (uri (string-append
1371                     "https://github.com/nboley/idr/archive/"
1372                     version ".tar.gz"))
1373               (file-name (string-append name "-" version ".tar.gz"))
1374               (sha256
1375                (base32
1376                 "1k3x44biak00aiv3hpm1yd6nn4hhp7n0qnbs3zh2q9sw7qr1qj5r"))))
1377     (build-system python-build-system)
1378     (arguments
1379      `(#:phases
1380        (modify-phases %standard-phases
1381          (add-after
1382           'install 'wrap-program
1383           (lambda* (#:key inputs outputs #:allow-other-keys)
1384             (let* ((out (assoc-ref outputs "out"))
1385                    (python-version (string-take (string-take-right
1386                                                  (assoc-ref inputs "python") 5) 3))
1387                    (path (string-join
1388                           (map (lambda (name)
1389                                  (string-append (assoc-ref inputs name)
1390                                                 "/lib/python" python-version
1391                                                 "/site-packages"))
1392                                '("python-scipy"
1393                                  "python-numpy"
1394                                  "python-matplotlib"))
1395                           ":")))
1396               (wrap-program (string-append out "/bin/idr")
1397                 `("PYTHONPATH" ":" prefix (,path))))
1398             #t)))))
1399     (inputs
1400      `(("python-scipy" ,python-scipy)
1401        ("python-numpy" ,python-numpy)
1402        ("python-matplotlib" ,python-matplotlib)))
1403     (native-inputs
1404      `(("python-cython" ,python-cython)
1405        ("python-setuptools" ,python-setuptools)))
1406     (home-page "https://github.com/nboley/idr")
1407     (synopsis "Tool to measure the irreproducible discovery rate (IDR)")
1408     (description
1409      "The IDR (Irreproducible Discovery Rate) framework is a unified approach
1410 to measure the reproducibility of findings identified from replicate
1411 experiments and provide highly stable thresholds based on reproducibility.")
1412     (license license:gpl3+)))
1414 (define-public macs
1415   (package
1416     (name "macs")
1417     (version "2.1.0.20140616")
1418     (source (origin
1419               (method url-fetch)
1420               (uri (string-append
1421                     "https://pypi.python.org/packages/source/M/MACS2/MACS2-"
1422                     version ".tar.gz"))
1423               (sha256
1424                (base32
1425                 "11lmiw6avqhwn75sn59g4lfkrr2kk20r3rgfbx9xfqb8rg9mi2n6"))))
1426     (build-system python-build-system)
1427     (arguments
1428      `(#:python ,python-2 ; only compatible with Python 2.7
1429        #:tests? #f)) ; no test target
1430     (inputs
1431      `(("python-numpy" ,python2-numpy)))
1432     (native-inputs
1433      `(("python-setuptools" ,python2-setuptools)))
1434     (home-page "http://github.com/taoliu/MACS/")
1435     (synopsis "Model based analysis for ChIP-Seq data")
1436     (description
1437      "MACS is an implementation of a ChIP-Seq analysis algorithm for
1438 identifying transcript factor binding sites named Model-based Analysis of
1439 ChIP-Seq (MACS).  MACS captures the influence of genome complexity to evaluate
1440 the significance of enriched ChIP regions and it improves the spatial
1441 resolution of binding sites through combining the information of both
1442 sequencing tag position and orientation.")
1443     (license license:bsd-3)))
1446 (define-public metabat
1447   (package
1448     (name "metabat")
1449     (version "0.26.1")
1450     (source (origin
1451               (method url-fetch)
1452               (uri (string-append
1453                     "https://bitbucket.org/berkeleylab/metabat/get/"
1454                     version ".tar.bz2"))
1455               (file-name (string-append name "-" version ".tar.bz2"))
1456               (sha256
1457                (base32
1458                 "0vgrhbaxg4dkxyax2kbigak7w0arhqvw0szwp6gd9wmyilc44kfa"))))
1459     (build-system gnu-build-system)
1460     (arguments
1461      `(#:phases
1462        (modify-phases %standard-phases
1463          (add-after 'unpack 'fix-includes
1464                     (lambda _
1465                       (substitute* "SConstruct"
1466                         (("/include/bam/bam.h")
1467                          "/include/samtools/bam.h"))
1468                       (substitute* "src/BamUtils.h"
1469                         (("^#include \"bam/bam\\.h\"")
1470                          "#include \"samtools/bam.h\"")
1471                         (("^#include \"bam/sam\\.h\"")
1472                          "#include \"samtools/sam.h\""))
1473                       (substitute* "src/KseqReader.h"
1474                         (("^#include \"bam/kseq\\.h\"")
1475                          "#include \"samtools/kseq.h\""))
1476                       #t))
1477          (add-after 'unpack 'fix-scons
1478                     (lambda _
1479                       (substitute* "SConstruct" ; Do not distribute README
1480                         (("^env\\.Install\\(idir_prefix, 'README\\.md'\\)")
1481                          ""))
1482                       #t))
1483          (delete 'configure)
1484          (replace 'build
1485                   (lambda* (#:key inputs outputs #:allow-other-keys)
1486                     (mkdir (assoc-ref outputs "out"))
1487                     (zero? (system* "scons"
1488                                     (string-append
1489                                      "PREFIX="
1490                                      (assoc-ref outputs "out"))
1491                                     (string-append
1492                                      "HTSLIB_DIR="
1493                                      (assoc-ref inputs "htslib"))
1494                                     (string-append
1495                                      "SAMTOOLS_DIR="
1496                                      (assoc-ref inputs "samtools"))
1497                                     (string-append
1498                                      "BOOST_ROOT="
1499                                      (assoc-ref inputs "boost"))
1500                                     "install"))))
1501          ;; check and install carried out during build phase
1502          (delete 'check)
1503          (delete 'install))))
1504     (inputs
1505      `(("zlib" ,zlib)
1506        ("perl" ,perl)
1507        ("samtools" ,samtools)
1508        ("htslib" ,htslib)
1509        ("boost" ,boost)))
1510     (native-inputs
1511      `(("scons" ,scons)))
1512     (home-page "https://bitbucket.org/berkeleylab/metabat")
1513     (synopsis
1514      "Reconstruction of single genomes from complex microbial communities")
1515     (description
1516      "Grouping large genomic fragments assembled from shotgun metagenomic
1517 sequences to deconvolute complex microbial communities, or metagenome binning,
1518 enables the study of individual organisms and their interactions.  MetaBAT is
1519 an automated metagenome binning software, which integrates empirical
1520 probabilistic distances of genome abundance and tetranucleotide frequency.")
1521    (license (license:non-copyleft "file://license.txt"
1522                                   "See license.txt in the distribution."))))
1524 (define-public miso
1525   (package
1526     (name "miso")
1527     (version "0.5.3")
1528     (source (origin
1529               (method url-fetch)
1530               (uri (string-append
1531                     "https://pypi.python.org/packages/source/m/misopy/misopy-"
1532                     version ".tar.gz"))
1533               (sha256
1534                (base32
1535                 "0x446867az8ir0z8c1vjqffkp0ma37wm4sylixnkhgawllzx8v5w"))
1536               (modules '((guix build utils)))
1537               (snippet
1538                '(substitute* "setup.py"
1539                   ;; Use setuptools, or else the executables are not
1540                   ;; installed.
1541                   (("distutils.core") "setuptools")
1542                   ;; use "gcc" instead of "cc" for compilation
1543                   (("^defines")
1544                    "cc.set_executables(
1545 compiler='gcc',
1546 compiler_so='gcc',
1547 linker_exe='gcc',
1548 linker_so='gcc -shared'); defines")))))
1549     (build-system python-build-system)
1550     (arguments
1551      `(#:python ,python-2 ; only Python 2 is supported
1552        #:tests? #f)) ; no "test" target
1553     (inputs
1554      `(("samtools" ,samtools)
1555        ("python-numpy" ,python2-numpy)
1556        ("python-pysam" ,python2-pysam)
1557        ("python-scipy" ,python2-scipy)
1558        ("python-matplotlib" ,python2-matplotlib)))
1559     (native-inputs
1560      `(("python-mock" ,python2-mock) ;for tests
1561        ("python-pytz" ,python2-pytz) ;for tests
1562        ("python-setuptools" ,python2-setuptools)))
1563     (home-page "http://genes.mit.edu/burgelab/miso/index.html")
1564     (synopsis "Mixture of Isoforms model for RNA-Seq isoform quantitation")
1565     (description
1566      "MISO (Mixture-of-Isoforms) is a probabilistic framework that quantitates
1567 the expression level of alternatively spliced genes from RNA-Seq data, and
1568 identifies differentially regulated isoforms or exons across samples.  By
1569 modeling the generative process by which reads are produced from isoforms in
1570 RNA-Seq, the MISO model uses Bayesian inference to compute the probability
1571 that a read originated from a particular isoform.")
1572     (license license:gpl2)))
1574 (define-public orfm
1575   (package
1576     (name "orfm")
1577     (version "0.4.1")
1578     (source (origin
1579               (method url-fetch)
1580               (uri (string-append
1581                     "https://github.com/wwood/OrfM/releases/download/v"
1582                     version "/orfm-" version ".tar.gz"))
1583               (sha256
1584                (base32
1585                 "05fmw145snk646ly076zby0fjav0k7ysbclck5d4s9pmgcfpijc2"))))
1586     (build-system gnu-build-system)
1587     (inputs `(("zlib" ,zlib)))
1588     (synopsis "Simple and not slow open reading frame (ORF) caller")
1589     (description
1590      "An ORF caller finds stretches of DNA that when translated are not
1591 interrupted by stop codons.  OrfM finds and prints these ORFs.")
1592     (home-page "https://github.com/wwood/OrfM")
1593     (license license:lgpl3+)))
1595 (define-public python2-pbcore
1596   (package
1597     (name "python2-pbcore")
1598     (version "0.9.3")
1599     (source (origin
1600               (method url-fetch)
1601               (uri (string-append
1602                     "https://github.com/PacificBiosciences/pbcore/archive/"
1603                     version ".tar.gz"))
1604               (file-name (string-append name "-" version ".tar.gz"))
1605               (sha256
1606                (base32
1607                 "1z46rwjac93jm87cbj2zgjg6qvsgs65140wkbbxsvxps7ai4pm09"))))
1608     (build-system python-build-system)
1609     (arguments `(#:python ,python-2)) ; pbcore requires Python 2.7
1610     (inputs
1611      `(("python-cython" ,python2-cython)
1612        ("python-numpy" ,python2-numpy)
1613        ("python-pysam" ,python2-pysam)
1614        ("python-h5py" ,python2-h5py)))
1615     (native-inputs
1616      `(("python-setuptools" ,python2-setuptools)))
1617     (home-page "http://pacificbiosciences.github.io/pbcore/")
1618     (synopsis "Library for reading and writing PacBio data files")
1619     (description
1620      "The pbcore package provides Python APIs for interacting with PacBio data
1621 files and writing bioinformatics applications.")
1622     (license license:bsd-3)))
1624 (define-public python2-warpedlmm
1625   (package
1626     (name "python2-warpedlmm")
1627     (version "0.21")
1628     (source
1629      (origin
1630        (method url-fetch)
1631        (uri (string-append
1632              "https://pypi.python.org/packages/source/W/WarpedLMM/WarpedLMM-"
1633              version ".zip"))
1634        (sha256
1635         (base32
1636          "1agfz6zqa8nc6cw47yh0s3y14gkpa9wqazwcj7mwwj3ffnw39p3j"))))
1637     (build-system python-build-system)
1638     (arguments
1639      `(#:python ,python-2  ; requires Python 2.7
1640        #:phases
1641        (modify-phases %standard-phases
1642          (add-after
1643           'install 'remove-bin-directory
1644           (lambda* (#:key outputs #:allow-other-keys)
1645             ;; The "bin" directory only contains wrappers for running
1646             ;; the module tests.  They are not needed after the
1647             ;; "check" phase.
1648             (delete-file-recursively
1649              (string-append (assoc-ref outputs "out") "/bin"))
1650             #t)))))
1651     (propagated-inputs
1652      `(("python-scipy" ,python2-scipy)
1653        ("python-numpy" ,python2-numpy)
1654        ("python-matplotlib" ,python2-matplotlib)
1655        ("python-fastlmm" ,python2-fastlmm)
1656        ("python-pandas" ,python2-pandas)
1657        ("python-pysnptools" ,python2-pysnptools)))
1658     (native-inputs
1659      `(("python-setuptools" ,python2-setuptools)
1660        ("python-mock" ,python2-mock)
1661        ("python-nose" ,python2-nose)
1662        ("unzip" ,unzip)))
1663     (home-page "https://github.com/PMBio/warpedLMM")
1664     (synopsis "Implementation of warped linear mixed models")
1665     (description
1666      "WarpedLMM is a Python implementation of the warped linear mixed model,
1667 which automatically learns an optimal warping function (or transformation) for
1668 the phenotype as it models the data.")
1669     (license license:asl2.0)))
1671 (define-public pbtranscript-tofu
1672   (let ((commit "c7bbd5472"))
1673     (package
1674       (name "pbtranscript-tofu")
1675       (version (string-append "0.4.1." commit))
1676       (source (origin
1677                 (method git-fetch)
1678                 (uri (git-reference
1679                       (url "https://github.com/PacificBiosciences/cDNA_primer.git")
1680                       (commit commit)))
1681                 (file-name (string-append name "-" version ".tar.gz"))
1682                 (sha256
1683                  (base32
1684                   "148xkzi689c49g6fdhckp6mnmj2qhjdf1j4wifm6ja7ij95d7fxx"))))
1685       (build-system python-build-system)
1686       (arguments
1687        `(#:python ,python-2
1688          ;; With standard flags, the install phase attempts to create a zip'd
1689          ;; egg file, and fails with an error: 'ZIP does not support timestamps
1690          ;; before 1980'
1691          #:configure-flags '("--single-version-externally-managed"
1692                              "--record=pbtranscript-tofu.txt")
1693          #:phases
1694          (alist-cons-after
1695           'unpack 'enter-directory-and-clean-up
1696           (lambda _
1697             (chdir "pbtranscript-tofu/pbtranscript/")
1698             ;; Delete clutter
1699             (delete-file-recursively "dist/")
1700             (delete-file-recursively "build/")
1701             (delete-file-recursively "setuptools_cython-0.2.1-py2.6.egg/")
1702             (delete-file-recursively "pbtools.pbtranscript.egg-info")
1703             (delete-file "Cython-0.20.1.tar.gz")
1704             (delete-file "setuptools_cython-0.2.1-py2.7.egg")
1705             (delete-file "setuptools_cython-0.2.1.tar.gz")
1706             (delete-file "setup.cfg")
1707             (for-each delete-file
1708                       (find-files "." "\\.so$"))
1709             ;; files should be writable for install phase
1710             (for-each (lambda (f) (chmod f #o755))
1711                       (find-files "." "\\.py$")))
1712           %standard-phases)))
1713       (inputs
1714        `(("python-cython" ,python2-cython)
1715          ("python-numpy" ,python2-numpy)
1716          ("python-bx-python" ,python2-bx-python)
1717          ("python-networkx" ,python2-networkx)
1718          ("python-scipy" ,python2-scipy)
1719          ("python-pbcore" ,python2-pbcore)))
1720       (native-inputs
1721        `(("python-nose" ,python2-nose)
1722          ("python-setuptools" ,python2-setuptools)))
1723       (home-page "https://github.com/PacificBiosciences/cDNA_primer")
1724       (synopsis "Analyze transcriptome data generated with the Iso-Seq protocol")
1725       (description
1726        "pbtranscript-tofu contains scripts to analyze transcriptome data
1727 generated using the PacBio Iso-Seq protocol.")
1728       (license license:bsd-3))))
1730 (define-public prodigal
1731   (package
1732     (name "prodigal")
1733     (version "2.6.2")
1734     (source (origin
1735               (method url-fetch)
1736               (uri (string-append
1737                     "https://github.com/hyattpd/Prodigal/archive/v"
1738                     version ".tar.gz"))
1739               (file-name (string-append name "-" version ".tar.gz"))
1740               (sha256
1741                (base32
1742                 "0m8sb0fg6lmxrlpzna0am6svbnlmd3dckrhgzxxgb3gxr5fyj284"))))
1743     (build-system gnu-build-system)
1744     (arguments
1745      `(#:tests? #f ;no check target
1746        #:make-flags (list (string-append "INSTALLDIR="
1747                                          (assoc-ref %outputs "out")
1748                                          "/bin"))
1749        #:phases
1750        (modify-phases %standard-phases
1751          (delete 'configure))))
1752     (home-page "http://prodigal.ornl.gov")
1753     (synopsis "Protein-coding gene prediction for Archaea and Bacteria")
1754     (description
1755      "Prodigal runs smoothly on finished genomes, draft genomes, and
1756 metagenomes, providing gene predictions in GFF3, Genbank, or Sequin table
1757 format.  It runs quickly, in an unsupervised fashion, handles gaps, handles
1758 partial genes, and identifies translation initiation sites.")
1759     (license license:gpl3+)))
1761 (define-public rsem
1762   (package
1763     (name "rsem")
1764     (version "1.2.20")
1765     (source
1766      (origin
1767        (method url-fetch)
1768        (uri
1769         (string-append "http://deweylab.biostat.wisc.edu/rsem/src/rsem-"
1770                        version ".tar.gz"))
1771        (sha256
1772         (base32 "0nzdc0j0hjllhsd5f2xli95dafm3nawskigs140xzvjk67xh0r9q"))
1773        (patches (list (search-patch "rsem-makefile.patch")))
1774        (modules '((guix build utils)))
1775        (snippet
1776         '(begin
1777            ;; remove bundled copy of boost
1778            (delete-file-recursively "boost")
1779            #t))))
1780     (build-system gnu-build-system)
1781     (arguments
1782      `(#:tests? #f ;no "check" target
1783        #:phases
1784        (modify-phases %standard-phases
1785          ;; No "configure" script.
1786          ;; Do not build bundled samtools library.
1787          (replace 'configure
1788                   (lambda _
1789                     (substitute* "Makefile"
1790                       (("^all : sam/libbam.a") "all : "))
1791                     #t))
1792          (replace 'install
1793                   (lambda* (#:key outputs #:allow-other-keys)
1794                     (let* ((out (string-append (assoc-ref outputs "out")))
1795                            (bin (string-append out "/bin/"))
1796                            (perl (string-append out "/lib/perl5/site_perl")))
1797                       (mkdir-p bin)
1798                       (mkdir-p perl)
1799                       (for-each (lambda (file)
1800                                   (copy-file file
1801                                              (string-append bin (basename file))))
1802                                 (find-files "." "rsem-.*"))
1803                       (copy-file "rsem_perl_utils.pm"
1804                                  (string-append perl "/rsem_perl_utils.pm")))
1805                     #t))
1806          (add-after
1807           'install 'wrap-program
1808           (lambda* (#:key outputs #:allow-other-keys)
1809             (let ((out (assoc-ref outputs "out")))
1810               (for-each (lambda (prog)
1811                           (wrap-program (string-append out "/bin/" prog)
1812                             `("PERL5LIB" ":" prefix
1813                               (,(string-append out "/lib/perl5/site_perl")))))
1814                         '("rsem-plot-transcript-wiggles"
1815                           "rsem-calculate-expression"
1816                           "rsem-generate-ngvector"
1817                           "rsem-run-ebseq"
1818                           "rsem-prepare-reference")))
1819             #t)))))
1820     (inputs
1821      `(("boost" ,boost)
1822        ("ncurses" ,ncurses)
1823        ("r" ,r)
1824        ("perl" ,perl)
1825        ("samtools" ,samtools-0.1)
1826        ("zlib" ,zlib)))
1827     (home-page "http://deweylab.biostat.wisc.edu/rsem/")
1828     (synopsis "Estimate gene expression levels from RNA-Seq data")
1829     (description
1830      "RSEM is a software package for estimating gene and isoform expression
1831 levels from RNA-Seq data.  The RSEM package provides a user-friendly
1832 interface, supports threads for parallel computation of the EM algorithm,
1833 single-end and paired-end read data, quality scores, variable-length reads and
1834 RSPD estimation.  In addition, it provides posterior mean and 95% credibility
1835 interval estimates for expression levels.  For visualization, it can generate
1836 BAM and Wiggle files in both transcript-coordinate and genomic-coordinate.")
1837     (license license:gpl3+)))
1839 (define-public rseqc
1840   (package
1841     (name "rseqc")
1842     (version "2.6.1")
1843     (source
1844      (origin
1845        (method url-fetch)
1846        (uri
1847         (string-append "mirror://sourceforge/rseqc/"
1848                        version "/RSeQC-" version ".tar.gz"))
1849        (sha256
1850         (base32 "15ly0254yi032qzkdplg00q144qfdsd986gh62829rl5bkxhj330"))
1851        (modules '((guix build utils)))
1852        (snippet
1853         '(begin
1854            ;; remove bundled copy of pysam
1855            (delete-file-recursively "lib/pysam")
1856            (substitute* "setup.py"
1857              ;; remove dependency on outdated "distribute" module
1858              (("^from distribute_setup import use_setuptools") "")
1859              (("^use_setuptools\\(\\)") "")
1860              ;; do not use bundled copy of pysam
1861              (("^have_pysam = False") "have_pysam = True"))))))
1862     (build-system python-build-system)
1863     (arguments `(#:python ,python-2))
1864     (inputs
1865      `(("python-cython" ,python2-cython)
1866        ("python-pysam" ,python2-pysam)
1867        ("python-numpy" ,python2-numpy)
1868        ("python-setuptools" ,python2-setuptools)
1869        ("zlib" ,zlib)))
1870     (native-inputs
1871      `(("python-nose" ,python2-nose)))
1872     (home-page "http://rseqc.sourceforge.net/")
1873     (synopsis "RNA-seq quality control package")
1874     (description
1875      "RSeQC provides a number of modules that can comprehensively evaluate
1876 high throughput sequence data, especially RNA-seq data.  Some basic modules
1877 inspect sequence quality, nucleotide composition bias, PCR bias and GC bias,
1878 while RNA-seq specific modules evaluate sequencing saturation, mapped reads
1879 distribution, coverage uniformity, strand specificity, etc.")
1880     (license license:gpl3+)))
1882 (define-public samtools
1883   (package
1884     (name "samtools")
1885     (version "1.2")
1886     (source
1887      (origin
1888        (method url-fetch)
1889        (uri
1890         (string-append "mirror://sourceforge/samtools/"
1891                        version "/samtools-" version ".tar.bz2"))
1892        (sha256
1893         (base32
1894          "1akdqb685pk9xk1nb6sa9aq8xssjjhvvc06kp4cpdqvz2157l3j2"))))
1895     (build-system gnu-build-system)
1896     (arguments
1897      `(;; There are 87 test failures when building on non-64-bit architectures
1898        ;; due to invalid test data.  This has since been fixed upstream (see
1899        ;; <https://github.com/samtools/samtools/pull/307>), but as there has
1900        ;; not been a new release we disable the tests for all non-64-bit
1901        ;; systems.
1902        #:tests? ,(string=? (or (%current-system) (%current-target-system))
1903                            "x86_64-linux")
1904        #:modules ((ice-9 ftw)
1905                   (ice-9 regex)
1906                   (guix build gnu-build-system)
1907                   (guix build utils))
1908        #:make-flags (list "LIBCURSES=-lncurses"
1909                           (string-append "prefix=" (assoc-ref %outputs "out")))
1910        #:phases
1911        (alist-cons-after
1912         'unpack
1913         'patch-tests
1914         (lambda* (#:key inputs #:allow-other-keys)
1915           (let ((bash (assoc-ref inputs "bash")))
1916             (substitute* "test/test.pl"
1917               ;; The test script calls out to /bin/bash
1918               (("/bin/bash")
1919                (string-append bash "/bin/bash"))
1920               ;; There are two failing tests upstream relating to the "stats"
1921               ;; subcommand in test_usage_subcommand ("did not have Usage"
1922               ;; and "usage did not mention samtools stats"), so we disable
1923               ;; them.
1924               (("(test_usage_subcommand\\(.*\\);)" cmd)
1925                (string-append "unless ($subcommand eq 'stats') {" cmd "};")))))
1926         (alist-cons-after
1927          'install 'install-library
1928          (lambda* (#:key outputs #:allow-other-keys)
1929            (let ((lib (string-append (assoc-ref outputs "out") "/lib")))
1930              (mkdir-p lib)
1931              (copy-file "libbam.a" (string-append lib "/libbam.a"))))
1932          (alist-cons-after
1933           'install 'install-headers
1934           (lambda* (#:key outputs #:allow-other-keys)
1935             (let ((include (string-append (assoc-ref outputs "out")
1936                                           "/include/samtools/")))
1937               (mkdir-p include)
1938               (for-each (lambda (file)
1939                           (copy-file file (string-append include
1940                                                          (basename file))))
1941                         (scandir "." (lambda (name) (string-match "\\.h$" name))))
1942               #t))
1943           (alist-delete 'configure %standard-phases))))))
1944     (native-inputs `(("pkg-config" ,pkg-config)))
1945     (inputs `(("ncurses" ,ncurses)
1946               ("perl" ,perl)
1947               ("python" ,python)
1948               ("zlib" ,zlib)))
1949     (home-page "http://samtools.sourceforge.net")
1950     (synopsis "Utilities to efficiently manipulate nucleotide sequence alignments")
1951     (description
1952      "Samtools implements various utilities for post-processing nucleotide
1953 sequence alignments in the SAM, BAM, and CRAM formats, including indexing,
1954 variant calling (in conjunction with bcftools), and a simple alignment
1955 viewer.")
1956     (license license:expat)))
1958 (define-public samtools-0.1
1959   ;; This is the most recent version of the 0.1 line of samtools.  The input
1960   ;; and output formats differ greatly from that used and produced by samtools
1961   ;; 1.x and is still used in many bioinformatics pipelines.
1962   (package (inherit samtools)
1963     (version "0.1.19")
1964     (source
1965      (origin
1966        (method url-fetch)
1967        (uri
1968         (string-append "mirror://sourceforge/samtools/"
1969                        version "/samtools-" version ".tar.bz2"))
1970        (sha256
1971         (base32 "1m33xsfwz0s8qi45lylagfllqg7fphf4dr0780rsvw75av9wk06h"))))
1972     (arguments
1973      (substitute-keyword-arguments (package-arguments samtools)
1974        ((#:tests? tests) #f) ;no "check" target
1975        ((#:phases phases)
1976         `(modify-phases ,phases
1977            (replace 'install
1978                     (lambda* (#:key outputs #:allow-other-keys)
1979                       (let ((bin (string-append
1980                                   (assoc-ref outputs "out") "/bin")))
1981                         (mkdir-p bin)
1982                         (copy-file "samtools"
1983                                    (string-append bin "/samtools")))))
1984            (delete 'patch-tests)))))))
1986 (define-public ngs-sdk
1987   (package
1988     (name "ngs-sdk")
1989     (version "1.1.1")
1990     (source
1991      (origin
1992        (method url-fetch)
1993        (uri
1994         (string-append "https://github.com/ncbi/ngs/archive/"
1995                        version ".tar.gz"))
1996        (file-name (string-append name "-" version ".tar.gz"))
1997        (sha256
1998         (base32
1999          "1x58gpm574n0xmk2a98gmikbgycq78ia0bvnb42k5ck34fmd5v8y"))))
2000     (build-system gnu-build-system)
2001     (arguments
2002      `(#:parallel-build? #f ; not supported
2003        #:tests? #f ; no "check" target
2004        #:phases
2005        (alist-replace
2006         'configure
2007         (lambda* (#:key outputs #:allow-other-keys)
2008           (let ((out (assoc-ref outputs "out")))
2009             ;; The 'configure' script doesn't recognize things like
2010             ;; '--enable-fast-install'.
2011             (zero? (system* "./configure"
2012                             (string-append "--build-prefix=" (getcwd) "/build")
2013                             (string-append "--prefix=" out)))))
2014         (alist-cons-after
2015          'unpack 'enter-dir
2016          (lambda _ (chdir "ngs-sdk") #t)
2017          %standard-phases))))
2018     (native-inputs `(("perl" ,perl)))
2019     (home-page "https://github.com/ncbi/ngs")
2020     (synopsis "API for accessing Next Generation Sequencing data")
2021     (description
2022      "NGS is a domain-specific API for accessing reads, alignments and pileups
2023 produced from Next Generation Sequencing.  The API itself is independent from
2024 any particular back-end implementation, and supports use of multiple back-ends
2025 simultaneously.")
2026     (license license:public-domain)))
2028 (define-public ngs-java
2029   (package (inherit ngs-sdk)
2030     (name "ngs-java")
2031     (arguments
2032      `(,@(substitute-keyword-arguments
2033              `(#:modules ((guix build gnu-build-system)
2034                           (guix build utils)
2035                           (srfi srfi-1)
2036                           (srfi srfi-26))
2037                          ,@(package-arguments ngs-sdk))
2038            ((#:phases phases)
2039             `(alist-cons-after
2040               'enter-dir 'fix-java-symlink-installation
2041               (lambda _
2042                 ;; Only replace the version suffix, not the version number in
2043                 ;; the directory name.  Reported here:
2044                 ;; https://github.com/ncbi/ngs/pull/4
2045                 (substitute* "Makefile.java"
2046                   (((string-append "\\$\\(subst "
2047                                    "(\\$\\(VERSION[^\\)]*\\)),"
2048                                    "(\\$\\([^\\)]+\\)),"
2049                                    "(\\$\\([^\\)]+\\)|\\$\\@)"
2050                                    "\\)")
2051                     _ pattern replacement target)
2052                    (string-append "$(patsubst "
2053                                   "%" pattern ","
2054                                   "%" replacement ","
2055                                   target ")"))))
2056               (alist-replace
2057                'enter-dir (lambda _ (chdir "ngs-java") #t)
2058                ,phases))))))
2059     (inputs
2060      `(("jdk" ,icedtea6 "jdk")
2061        ("ngs-sdk" ,ngs-sdk)))
2062     (synopsis "Java bindings for NGS SDK")))
2064 (define-public ncbi-vdb
2065   (package
2066     (name "ncbi-vdb")
2067     (version "2.4.5-5")
2068     (source
2069      (origin
2070        (method url-fetch)
2071        (uri
2072         (string-append "https://github.com/ncbi/ncbi-vdb/archive/"
2073                        version ".tar.gz"))
2074        (file-name (string-append name "-" version ".tar.gz"))
2075        (sha256
2076         (base32
2077          "1cj8nk6if8sqagv20vx36v566fdvhcaadf0x1ycnbgql6chbs6vy"))))
2078     (build-system gnu-build-system)
2079     (arguments
2080      `(#:parallel-build? #f ; not supported
2081        #:tests? #f ; no "check" target
2082        #:phases
2083        (alist-replace
2084         'configure
2085         (lambda* (#:key inputs outputs #:allow-other-keys)
2086           (let ((out (assoc-ref outputs "out")))
2087             ;; Only replace the version suffix, not the version number in the
2088             ;; directory name; fixed in commit 4dbba5c6a809 (no release yet).
2089             (substitute* "setup/konfigure.perl"
2090               (((string-append "\\$\\(subst "
2091                                "(\\$\\(VERSION[^\\)]*\\)),"
2092                                "(\\$\\([^\\)]+\\)),"
2093                                "(\\$\\([^\\)]+\\)|\\$\\@)"
2094                                "\\)")
2095                 _ pattern replacement target)
2096                (string-append "$(patsubst "
2097                               "%" pattern ","
2098                               "%" replacement ","
2099                               target ")")))
2101             ;; Override include path for libmagic
2102             (substitute* "setup/package.prl"
2103               (("name => 'magic', Include => '/usr/include'")
2104                (string-append "name=> 'magic', Include => '"
2105                               (assoc-ref inputs "libmagic")
2106                               "/include" "'")))
2108             ;; Install kdf5 library (needed by sra-tools)
2109             (substitute* "build/Makefile.install"
2110               (("LIBRARIES_TO_INSTALL =")
2111                "LIBRARIES_TO_INSTALL = kdf5.$(VERSION_LIBX) kdf5.$(VERSION_SHLX)"))
2113             ;; The 'configure' script doesn't recognize things like
2114             ;; '--enable-fast-install'.
2115             (zero? (system*
2116                     "./configure"
2117                     (string-append "--build-prefix=" (getcwd) "/build")
2118                     (string-append "--prefix=" (assoc-ref outputs "out"))
2119                     (string-append "--debug")
2120                     (string-append "--with-xml2-prefix="
2121                                    (assoc-ref inputs "libxml2"))
2122                     (string-append "--with-ngs-sdk-prefix="
2123                                    (assoc-ref inputs "ngs-sdk"))
2124                     (string-append "--with-ngs-java-prefix="
2125                                    (assoc-ref inputs "ngs-java"))
2126                     (string-append "--with-hdf5-prefix="
2127                                    (assoc-ref inputs "hdf5"))))))
2128         (alist-cons-after
2129          'install 'install-interfaces
2130          (lambda* (#:key outputs #:allow-other-keys)
2131            ;; Install interface libraries.  On i686 the interface libraries
2132            ;; are installed to "linux/gcc/i386", so we need to use the Linux
2133            ;; architecture name ("i386") instead of the target system prefix
2134            ;; ("i686").
2135            (mkdir (string-append (assoc-ref outputs "out") "/ilib"))
2136            (copy-recursively (string-append "build/ncbi-vdb/linux/gcc/"
2137                                             ,(system->linux-architecture
2138                                               (or (%current-target-system)
2139                                                   (%current-system)))
2140                                             "/rel/ilib")
2141                              (string-append (assoc-ref outputs "out")
2142                                             "/ilib"))
2143            ;; Install interface headers
2144            (copy-recursively "interfaces"
2145                              (string-append (assoc-ref outputs "out")
2146                                             "/include")))
2147          %standard-phases))))
2148     (inputs
2149      `(("libxml2" ,libxml2)
2150        ("ngs-sdk" ,ngs-sdk)
2151        ("ngs-java" ,ngs-java)
2152        ("libmagic" ,file)
2153        ("hdf5" ,hdf5)))
2154     (native-inputs `(("perl" ,perl)))
2155     (home-page "https://github.com/ncbi/ncbi-vdb")
2156     (synopsis "Database engine for genetic information")
2157     (description
2158      "The NCBI-VDB library implements a highly compressed columnar data
2159 warehousing engine that is most often used to store genetic information.
2160 Databases are stored in a portable image within the file system, and can be
2161 accessed/downloaded on demand across HTTP.")
2162     (license license:public-domain)))
2164 (define-public plink
2165   (package
2166     (name "plink")
2167     (version "1.07")
2168     (source
2169      (origin
2170        (method url-fetch)
2171        (uri (string-append
2172              "http://pngu.mgh.harvard.edu/~purcell/plink/dist/plink-"
2173              version "-src.zip"))
2174        (sha256
2175         (base32 "0as8gxm4pjyc8dxmm1sl873rrd7wn5qs0l29nqfnl31x8i467xaa"))
2176        (patches (list (search-patch "plink-1.07-unclobber-i.patch")))))
2177     (build-system gnu-build-system)
2178     (arguments
2179      '(#:tests? #f ;no "check" target
2180        #:make-flags (list (string-append "LIB_LAPACK="
2181                                          (assoc-ref %build-inputs "lapack")
2182                                          "/lib/liblapack.so")
2183                           "WITH_LAPACK=1"
2184                           "FORCE_DYNAMIC=1"
2185                           ;; disable phoning home
2186                           "WITH_WEBCHECK=")
2187        #:phases
2188        (modify-phases %standard-phases
2189          ;; no "configure" script
2190          (delete 'configure)
2191          (replace 'install
2192                   (lambda* (#:key outputs #:allow-other-keys)
2193                     (let ((bin (string-append (assoc-ref outputs "out")
2194                                               "/bin/")))
2195                       (mkdir-p bin)
2196                       (copy-file "plink" (string-append bin "plink"))
2197                       #t))))))
2198     (inputs
2199      `(("zlib" ,zlib)
2200        ("lapack" ,lapack)))
2201     (native-inputs
2202      `(("unzip" ,unzip)))
2203     (home-page "http://pngu.mgh.harvard.edu/~purcell/plink/")
2204     (synopsis "Whole genome association analysis toolset")
2205     (description
2206      "PLINK is a whole genome association analysis toolset, designed to
2207 perform a range of basic, large-scale analyses in a computationally efficient
2208 manner.  The focus of PLINK is purely on analysis of genotype/phenotype data,
2209 so there is no support for steps prior to this (e.g. study design and
2210 planning, generating genotype or CNV calls from raw data).  Through
2211 integration with gPLINK and Haploview, there is some support for the
2212 subsequent visualization, annotation and storage of results.")
2213     ;; Code is released under GPLv2, except for fisher.h, which is under
2214     ;; LGPLv2.1+
2215     (license (list license:gpl2 license:lgpl2.1+))))
2217 (define-public preseq
2218   (package
2219     (name "preseq")
2220     (version "1.0.2")
2221     (source (origin
2222               (method url-fetch)
2223               (uri
2224                (string-append "http://smithlabresearch.org/downloads/preseq-"
2225                               version ".tar.bz2"))
2226               (sha256
2227                (base32 "0r7sw07p6nv8ygvc17gd78lisbw5336v3vhs86b5wv8mw3pwqksc"))
2228               (patches (list (search-patch "preseq-1.0.2-install-to-PREFIX.patch")
2229                              (search-patch "preseq-1.0.2-link-with-libbam.patch")))
2230               (modules '((guix build utils)))
2231               (snippet
2232                ;; Remove bundled samtools.
2233                '(delete-file-recursively "preseq-master/samtools"))))
2234     (build-system gnu-build-system)
2235     (arguments
2236      `(#:tests? #f ;no "check" target
2237        #:phases
2238        (modify-phases %standard-phases
2239          (add-after
2240           'unpack 'enter-dir
2241           (lambda _
2242             (chdir "preseq-master")
2243             #t))
2244          (add-after
2245           'enter-dir 'use-samtools-headers
2246           (lambda _
2247             (substitute* '("smithlab_cpp/SAM.cpp"
2248                            "smithlab_cpp/SAM.hpp")
2249               (("sam.h") "samtools/sam.h"))
2250             #t))
2251          (delete 'configure))
2252        #:make-flags (list (string-append "PREFIX="
2253                                          (assoc-ref %outputs "out"))
2254                           (string-append "LIBBAM="
2255                                          (assoc-ref %build-inputs "samtools")
2256                                          "/lib/libbam.a"))))
2257     (inputs
2258      `(("gsl" ,gsl)
2259        ("samtools" ,samtools-0.1)
2260        ("zlib" ,zlib)))
2261     (home-page "http://smithlabresearch.org/software/preseq/")
2262     (synopsis "Program for analyzing library complexity")
2263     (description
2264      "The preseq package is aimed at predicting and estimating the complexity
2265 of a genomic sequencing library, equivalent to predicting and estimating the
2266 number of redundant reads from a given sequencing depth and how many will be
2267 expected from additional sequencing using an initial sequencing experiment.
2268 The estimates can then be used to examine the utility of further sequencing,
2269 optimize the sequencing depth, or to screen multiple libraries to avoid low
2270 complexity samples.")
2271     (license license:gpl3+)))
2273 (define-public sra-tools
2274   (package
2275     (name "sra-tools")
2276     (version "2.4.5-5")
2277     (source
2278      (origin
2279        (method url-fetch)
2280        (uri
2281         (string-append "https://github.com/ncbi/sra-tools/archive/"
2282                        version ".tar.gz"))
2283        (file-name (string-append name "-" version ".tar.gz"))
2284        (sha256
2285         (base32
2286          "11nrnvz7a012f4iryf0wiwrid0h111grsfxbxa9j51h3f2xbvgns"))))
2287     (build-system gnu-build-system)
2288     (arguments
2289      `(#:parallel-build? #f ; not supported
2290        #:tests? #f ; no "check" target
2291        #:phases
2292        (alist-replace
2293         'configure
2294         (lambda* (#:key inputs outputs #:allow-other-keys)
2295           ;; The build system expects a directory containing the sources and
2296           ;; raw build output of ncbi-vdb, including files that are not
2297           ;; installed.  Since we are building against an installed version of
2298           ;; ncbi-vdb, the following modifications are needed.
2299           (substitute* "setup/konfigure.perl"
2300             ;; Make the configure script look for the "ilib" directory of
2301             ;; "ncbi-vdb" without first checking for the existence of a
2302             ;; matching library in its "lib" directory.
2303             (("^            my \\$f = File::Spec->catdir\\(\\$libdir, \\$lib\\);")
2304              "my $f = File::Spec->catdir($ilibdir, $ilib);")
2305             ;; Look for interface libraries in ncbi-vdb's "ilib" directory.
2306             (("my \\$ilibdir = File::Spec->catdir\\(\\$builddir, 'ilib'\\);")
2307              "my $ilibdir = File::Spec->catdir($dir, 'ilib');"))
2309           ;; The 'configure' script doesn't recognize things like
2310           ;; '--enable-fast-install'.
2311           (zero? (system*
2312                   "./configure"
2313                   (string-append "--build-prefix=" (getcwd) "/build")
2314                   (string-append "--prefix=" (assoc-ref outputs "out"))
2315                   (string-append "--debug")
2316                   (string-append "--with-fuse-prefix="
2317                                  (assoc-ref inputs "fuse"))
2318                   (string-append "--with-magic-prefix="
2319                                  (assoc-ref inputs "libmagic"))
2320                   ;; TODO: building with libxml2 fails with linker errors
2321                   ;; (string-append "--with-xml2-prefix="
2322                   ;;                (assoc-ref inputs "libxml2"))
2323                   (string-append "--with-ncbi-vdb-sources="
2324                                  (assoc-ref inputs "ncbi-vdb"))
2325                   (string-append "--with-ncbi-vdb-build="
2326                                  (assoc-ref inputs "ncbi-vdb"))
2327                   (string-append "--with-ngs-sdk-prefix="
2328                                  (assoc-ref inputs "ngs-sdk"))
2329                   (string-append "--with-hdf5-prefix="
2330                                  (assoc-ref inputs "hdf5")))))
2331         %standard-phases)))
2332     (native-inputs `(("perl" ,perl)))
2333     (inputs
2334      `(("ngs-sdk" ,ngs-sdk)
2335        ("ncbi-vdb" ,ncbi-vdb)
2336        ("libmagic" ,file)
2337        ("fuse" ,fuse)
2338        ("hdf5" ,hdf5)
2339        ("zlib" ,zlib)))
2340     (home-page "http://www.ncbi.nlm.nih.gov/Traces/sra/sra.cgi?view=software")
2341     (synopsis "Tools and libraries for reading and writing sequencing data")
2342     (description
2343      "The SRA Toolkit from NCBI is a collection of tools and libraries for
2344 reading of sequencing files from the Sequence Read Archive (SRA) database and
2345 writing files into the .sra format.")
2346     (license license:public-domain)))
2348 (define-public seqan
2349   (package
2350     (name "seqan")
2351     (version "1.4.2")
2352     (source (origin
2353               (method url-fetch)
2354               (uri (string-append "http://packages.seqan.de/seqan-library/"
2355                                   "seqan-library-" version ".tar.bz2"))
2356               (sha256
2357                (base32
2358                 "05s3wrrwn50f81aklfm65i4a749zag1vr8z03k21xm0pdxy47yvp"))))
2359     ;; The documentation is 7.8MB and the includes are 3.6MB heavy, so it
2360     ;; makes sense to split the outputs.
2361     (outputs '("out" "doc"))
2362     (build-system trivial-build-system)
2363     (arguments
2364      `(#:modules ((guix build utils))
2365        #:builder
2366        (begin
2367          (use-modules (guix build utils))
2368          (let ((tar  (assoc-ref %build-inputs "tar"))
2369                (bzip (assoc-ref %build-inputs "bzip2"))
2370                (out  (assoc-ref %outputs "out"))
2371                (doc  (assoc-ref %outputs "doc")))
2372            (setenv "PATH" (string-append tar "/bin:" bzip "/bin"))
2373            (system* "tar" "xvf" (assoc-ref %build-inputs "source"))
2374            (chdir (string-append "seqan-library-" ,version))
2375            (copy-recursively "include" (string-append out "/include"))
2376            (copy-recursively "share"  (string-append doc "/share"))))))
2377     (native-inputs
2378      `(("source" ,source)
2379        ("tar" ,tar)
2380        ("bzip2" ,bzip2)))
2381     (home-page "http://www.seqan.de")
2382     (synopsis "Library for nucleotide sequence analysis")
2383     (description
2384      "SeqAn is a C++ library of efficient algorithms and data structures for
2385 the analysis of sequences with the focus on biological data.  It contains
2386 algorithms and data structures for string representation and their
2387 manipulation, online and indexed string search, efficient I/O of
2388 bioinformatics file formats, sequence alignment, and more.")
2389     (license license:bsd-3)))
2391 (define-public star
2392   (package
2393     (name "star")
2394     (version "2.4.2a")
2395     (source (origin
2396               (method url-fetch)
2397               (uri (string-append
2398                     "https://github.com/alexdobin/STAR/archive/STAR_"
2399                     version ".tar.gz"))
2400               (sha256
2401                (base32
2402                 "1c3rnm7r5l0kl3d04gl1g7938xqf1c2l0mla87rlplqg1hcns5mc"))
2403               (modules '((guix build utils)))
2404               (snippet
2405                '(substitute* "source/Makefile"
2406                   (("/bin/rm") "rm")))))
2407     (build-system gnu-build-system)
2408     (arguments
2409      '(#:tests? #f ;no check target
2410        #:make-flags '("STAR")
2411        #:phases
2412        (alist-cons-after
2413         'unpack 'enter-source-dir (lambda _ (chdir "source"))
2414         (alist-replace
2415          'install
2416          (lambda* (#:key outputs #:allow-other-keys)
2417            (let ((bin (string-append (assoc-ref outputs "out") "/bin/")))
2418              (mkdir-p bin)
2419              (copy-file "STAR" (string-append bin "STAR"))))
2420          (alist-delete
2421           'configure %standard-phases)))))
2422     (native-inputs
2423      `(("vim" ,vim))) ; for xxd
2424     (inputs
2425      `(("zlib" ,zlib)))
2426     (home-page "https://github.com/alexdobin/STAR")
2427     (synopsis "Universal RNA-seq aligner")
2428     (description
2429      "The Spliced Transcripts Alignment to a Reference (STAR) software is
2430 based on a previously undescribed RNA-seq alignment algorithm that uses
2431 sequential maximum mappable seed search in uncompressed suffix arrays followed
2432 by seed clustering and stitching procedure.  In addition to unbiased de novo
2433 detection of canonical junctions, STAR can discover non-canonical splices and
2434 chimeric (fusion) transcripts, and is also capable of mapping full-length RNA
2435 sequences.")
2436     ;; STAR is licensed under GPLv3 or later; htslib is MIT-licensed.
2437     (license license:gpl3+)))
2439 (define-public subread
2440   (package
2441     (name "subread")
2442     (version "1.4.6-p2")
2443     (source (origin
2444               (method url-fetch)
2445               (uri (string-append
2446                     "mirror://sourceforge/subread/subread-"
2447                     version "-source.tar.gz"))
2448               (sha256
2449                (base32
2450                 "06sv9mpcsdj6p68y15d6gi70lca3lxmzk0dn61hg0kfsa7rxmsr3"))))
2451     (build-system gnu-build-system)
2452     (arguments
2453      `(#:tests? #f ;no "check" target
2454        #:make-flags '("-f" "Makefile.Linux")
2455        #:phases
2456        (alist-cons-after
2457         'unpack 'enter-dir
2458         (lambda _ (chdir "src") #t)
2459         (alist-replace
2460          'install
2461          (lambda* (#:key outputs #:allow-other-keys)
2462            (let ((bin (string-append (assoc-ref outputs "out") "/bin/")))
2463              (mkdir-p bin)
2464              (copy-recursively "../bin" bin)))
2465          ;; no "configure" script
2466          (alist-delete 'configure %standard-phases)))))
2467     (inputs `(("zlib" ,zlib)))
2468     (home-page "http://bioinf.wehi.edu.au/subread-package/")
2469     (synopsis "Tool kit for processing next-gen sequencing data")
2470     (description
2471      "The subread package contains the following tools: subread aligner, a
2472 general-purpose read aligner; subjunc aligner: detecting exon-exon junctions
2473 and mapping RNA-seq reads; featureCounts: counting mapped reads for genomic
2474 features; exactSNP: a SNP caller that discovers SNPs by testing signals
2475 against local background noises.")
2476     (license license:gpl3+)))
2478 (define-public shogun
2479   (package
2480     (name "shogun")
2481     (version "4.0.0")
2482     (source
2483      (origin
2484        (method url-fetch)
2485        (uri (string-append
2486              "ftp://shogun-toolbox.org/shogun/releases/"
2487              (version-major+minor version)
2488              "/sources/shogun-" version ".tar.bz2"))
2489        (sha256
2490         (base32
2491          "159nlijnb7mnrv9za80wnm1shwvy45hgrqzn51hxy7gw4z6d6fdb"))
2492        (modules '((guix build utils)
2493                   (ice-9 rdelim)))
2494        (snippet
2495         '(begin
2496            ;; Remove non-free sources and files referencing them
2497            (for-each delete-file
2498                      (find-files "src/shogun/classifier/svm/"
2499                                  "SVMLight\\.(cpp|h)"))
2500            (for-each delete-file
2501                      (find-files "examples/undocumented/libshogun/"
2502                                  (string-append
2503                                   "(classifier_.*svmlight.*|"
2504                                   "evaluation_cross_validation_locked_comparison).cpp")))
2505            ;; Remove non-free functions.
2506            (define (delete-ifdefs file)
2507              (with-atomic-file-replacement file
2508                (lambda (in out)
2509                  (let loop ((line (read-line in 'concat))
2510                             (skipping? #f))
2511                    (if (eof-object? line)
2512                        #t
2513                        (let ((skip-next?
2514                               (or (and skipping?
2515                                        (not (string-prefix?
2516                                              "#endif //USE_SVMLIGHT" line)))
2517                                   (string-prefix?
2518                                    "#ifdef USE_SVMLIGHT" line))))
2519                          (when (or (not skipping?)
2520                                    (and skipping? (not skip-next?)))
2521                            (display line out))
2522                          (loop (read-line in 'concat) skip-next?)))))))
2523            (for-each delete-ifdefs (find-files "src/shogun/kernel/"
2524                                                "^Kernel\\.(cpp|h)"))))))
2525     (build-system cmake-build-system)
2526     (arguments
2527      '(#:tests? #f ;no check target
2528        #:phases
2529        (alist-cons-after
2530         'unpack 'delete-broken-symlinks
2531         (lambda _
2532           (for-each delete-file '("applications/arts/data"
2533                                   "applications/asp/data"
2534                                   "applications/easysvm/data"
2535                                   "applications/msplicer/data"
2536                                   "applications/ocr/data"
2537                                   "examples/documented/data"
2538                                   "examples/documented/matlab_static"
2539                                   "examples/documented/octave_static"
2540                                   "examples/undocumented/data"
2541                                   "examples/undocumented/matlab_static"
2542                                   "examples/undocumented/octave_static"
2543                                   "tests/integration/data"
2544                                   "tests/integration/matlab_static"
2545                                   "tests/integration/octave_static"
2546                                   "tests/integration/python_modular/tests"))
2547           #t)
2548         (alist-cons-after
2549          'unpack 'change-R-target-path
2550          (lambda* (#:key outputs #:allow-other-keys)
2551            (substitute* '("src/interfaces/r_modular/CMakeLists.txt"
2552                           "src/interfaces/r_static/CMakeLists.txt"
2553                           "examples/undocumented/r_modular/CMakeLists.txt")
2554              (("\\$\\{R_COMPONENT_LIB_PATH\\}")
2555               (string-append (assoc-ref outputs "out")
2556                              "/lib/R/library/")))
2557            #t)
2558          (alist-cons-after
2559           'unpack 'fix-octave-modules
2560           (lambda* (#:key outputs #:allow-other-keys)
2561             (substitute* '("src/interfaces/octave_modular/CMakeLists.txt"
2562                            "src/interfaces/octave_static/CMakeLists.txt")
2563               (("^include_directories\\(\\$\\{OCTAVE_INCLUDE_DIRS\\}")
2564                "include_directories(${OCTAVE_INCLUDE_DIRS} ${OCTAVE_INCLUDE_DIRS}/octave"))
2566             ;; change target directory
2567             (substitute* "src/interfaces/octave_modular/CMakeLists.txt"
2568               (("\\$\\{OCTAVE_OCT_LOCAL_API_FILE_DIR\\}")
2569                (string-append (assoc-ref outputs "out")
2570                               "/share/octave/packages")))
2571             #t)
2572           (alist-cons-before
2573            'build 'set-HOME
2574            ;; $HOME needs to be set at some point during the build phase
2575            (lambda _ (setenv "HOME" "/tmp") #t)
2576            %standard-phases))))
2577        #:configure-flags
2578        (list "-DCMAKE_BUILD_WITH_INSTALL_RPATH=TRUE"
2579              "-DUSE_SVMLIGHT=OFF" ;disable proprietary SVMLIGHT
2580              ;;"-DJavaModular=ON" ;requires unpackaged jblas
2581              ;;"-DRubyModular=ON" ;requires unpackaged ruby-narray
2582              ;;"-DPerlModular=ON" ;"FindPerlLibs" does not exist
2583              ;;"-DLuaModular=ON"  ;fails because lua doesn't build pkgconfig file
2584              "-DOctaveModular=ON"
2585              "-DOctaveStatic=ON"
2586              "-DPythonModular=ON"
2587              "-DPythonStatic=ON"
2588              "-DRModular=ON"
2589              "-DRStatic=ON"
2590              "-DCmdLineStatic=ON")))
2591     (inputs
2592      `(("python" ,python)
2593        ("numpy" ,python-numpy)
2594        ("r" ,r)
2595        ("octave" ,octave)
2596        ("swig" ,swig)
2597        ("hdf5" ,hdf5)
2598        ("atlas" ,atlas)
2599        ("arpack" ,arpack-ng)
2600        ("lapack" ,lapack)
2601        ("glpk" ,glpk)
2602        ("libxml2" ,libxml2)
2603        ("lzo" ,lzo)
2604        ("zlib" ,zlib)))
2605     (native-inputs
2606      `(("pkg-config" ,pkg-config)))
2607     (home-page "http://shogun-toolbox.org/")
2608     (synopsis "Machine learning toolbox")
2609     (description
2610      "The Shogun Machine learning toolbox provides a wide range of unified and
2611 efficient Machine Learning (ML) methods.  The toolbox seamlessly allows to
2612 combine multiple data representations, algorithm classes, and general purpose
2613 tools.  This enables both rapid prototyping of data pipelines and extensibility
2614 in terms of new algorithms.")
2615     (license license:gpl3+)))
2617 (define-public vcftools
2618   (package
2619     (name "vcftools")
2620     (version "0.1.12b")
2621     (source (origin
2622               (method url-fetch)
2623               (uri (string-append
2624                     "mirror://sourceforge/vcftools/vcftools_"
2625                      version ".tar.gz"))
2626               (sha256
2627                (base32
2628                 "148al9h7f8g8my2qdnpax51kdd2yjrivlx6frvakf4lz5r8j88wx"))))
2629     (build-system gnu-build-system)
2630     (arguments
2631      `(#:tests? #f ; no "check" target
2632        #:make-flags (list
2633                      "CFLAGS=-O2" ; override "-m64" flag
2634                      (string-append "PREFIX=" (assoc-ref %outputs "out"))
2635                      (string-append "MANDIR=" (assoc-ref %outputs "out")
2636                                     "/share/man/man1"))
2637        #:phases
2638        (alist-cons-after
2639         'unpack 'patch-manpage-install
2640         (lambda _
2641           (substitute* "Makefile"
2642             (("cp \\$\\{PREFIX\\}/cpp/vcftools.1") "cp ./cpp/vcftools.1")))
2643         (alist-delete 'configure %standard-phases))))
2644     (inputs
2645      `(("perl" ,perl)
2646        ("zlib" ,zlib)))
2647     (home-page "http://vcftools.sourceforge.net/")
2648     (synopsis "Tools for working with VCF files")
2649     (description
2650      "VCFtools is a program package designed for working with VCF files, such
2651 as those generated by the 1000 Genomes Project.  The aim of VCFtools is to
2652 provide easily accessible methods for working with complex genetic variation
2653 data in the form of VCF files.")
2654     ;; The license is declared as LGPLv3 in the README and
2655     ;; at http://vcftools.sourceforge.net/license.html
2656     (license license:lgpl3)))