guix-play/gnu/packages/bioinformatics.scm

141 lines
5.7 KiB
Scheme
Raw Normal View History

;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2014 Ricardo Wurmus <rekado@elephly.net>
;;;
;;; This file is part of GNU Guix.
;;;
;;; GNU Guix is free software; you can redistribute it and/or modify it
;;; under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 3 of the License, or (at
;;; your option) any later version.
;;;
;;; GNU Guix is distributed in the hope that it will be useful, but
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
(define-module (gnu packages bioinformatics)
#:use-module ((guix licenses) #:prefix license:)
#:use-module (guix packages)
#:use-module (guix download)
#:use-module (guix build-system gnu)
#:use-module (gnu packages)
#:use-module (gnu packages compression)
#:use-module (gnu packages ncurses)
#:use-module (gnu packages perl)
#:use-module (gnu packages pkg-config)
#:use-module (gnu packages python))
(define-public bedtools
(package
(name "bedtools")
(version "2.22.0")
(source (origin
(method url-fetch)
(uri (string-append "https://github.com/arq5x/bedtools2/archive/v"
version ".tar.gz"))
(sha256
(base32
"16aq0w3dmbd0853j32xk9jin4vb6v6fgakfyvrsmsjizzbn3fpfl"))))
(build-system gnu-build-system)
(native-inputs `(("python" ,python-2)))
(inputs `(("samtools" ,samtools)
("zlib" ,zlib)))
(arguments
'(#:test-target "test"
#:phases
(alist-cons-after
'unpack 'patch-makefile-SHELL-definition
(lambda _
;; patch-makefile-SHELL cannot be used here as it does not
;; yet patch definitions with `:='. Since changes to
;; patch-makefile-SHELL result in a full rebuild, features
;; of patch-makefile-SHELL are reimplemented here.
(substitute* "Makefile"
(("^SHELL := .*$") (string-append "SHELL := " (which "bash") " -e \n"))))
(alist-delete
'configure
(alist-replace
'install
(lambda* (#:key outputs #:allow-other-keys)
(let ((bin (string-append (assoc-ref outputs "out") "/bin/")))
(mkdir-p bin)
(for-each (lambda (file)
(copy-file file (string-append bin (basename file))))
(find-files "bin" ".*"))))
%standard-phases)))))
(home-page "https://github.com/arq5x/bedtools2")
(synopsis "Tools for genome analysis and arithmetic")
(description
"Collectively, the bedtools utilities are a swiss-army knife of tools for
a wide-range of genomics analysis tasks. The most widely-used tools enable
genome arithmetic: that is, set theory on the genome. For example, bedtools
allows one to intersect, merge, count, complement, and shuffle genomic
intervals from multiple files in widely-used genomic file formats such as BAM,
BED, GFF/GTF, VCF.")
(license license:gpl2)))
(define-public samtools
(package
(name "samtools")
(version "1.1")
(source
(origin
(method url-fetch)
(uri
(string-append "mirror://sourceforge/samtools/"
version "/samtools-" version ".tar.bz2"))
(sha256
(base32
"1y5p2hs4gif891b4ik20275a8xf3qrr1zh9wpysp4g8m0g1jckf2"))))
(build-system gnu-build-system)
(arguments
`(;; There are 87 test failures when building on non-64-bit architectures
;; due to invalid test data. This has since been fixed upstream (see
;; <https://github.com/samtools/samtools/pull/307>), but as there has
;; not been a new release we disable the tests for all non-64-bit
;; systems.
#:tests? ,(string=? (or (%current-system) (%current-target-system))
"x86_64-linux")
#:make-flags (list (string-append "prefix=" (assoc-ref %outputs "out")))
#:phases
(alist-cons-after
'unpack
'patch-makefile-curses
(lambda _
(substitute* "Makefile"
(("-lcurses") "-lncurses")))
(alist-cons-after
'unpack
'patch-tests
(lambda* (#:key inputs #:allow-other-keys)
(let ((bash (assoc-ref inputs "bash")))
(substitute* "test/test.pl"
;; The test script calls out to /bin/bash
(("/bin/bash")
(string-append bash "/bin/bash"))
;; There are two failing tests upstream relating to the "stats"
;; subcommand in test_usage_subcommand ("did not have Usage"
;; and "usage did not mention samtools stats"), so we disable
;; them.
(("(test_usage_subcommand\\(.*\\);)" cmd)
(string-append "unless ($subcommand eq 'stats') {" cmd "};")))))
(alist-delete
'configure
%standard-phases)))))
(native-inputs `(("pkg-config" ,pkg-config)))
(inputs `(("ncurses" ,ncurses)
("perl" ,perl)
("python" ,python)
("zlib" ,zlib)))
(home-page "http://samtools.sourceforge.net")
(synopsis "Utilities to efficiently manipulate nucleotide sequence alignments")
(description
"Samtools implements various utilities for post-processing nucleotide
sequence alignments in the SAM, BAM, and CRAM formats, including indexing,
variant calling (in conjunction with bcftools), and a simple alignment
viewer.")
(license license:expat)))