From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ricardo Wurmus Subject: Re: [PATCH] Add preseq. Date: Tue, 7 Jul 2015 14:45:29 +0200 Message-ID: References: <87r3osronp.fsf@gnu.org> <87egkrq5xa.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:40902) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZCSFq-0006MB-OE for guix-devel@gnu.org; Tue, 07 Jul 2015 08:45:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZCSFn-0008NX-FJ for guix-devel@gnu.org; Tue, 07 Jul 2015 08:45:42 -0400 In-Reply-To: <87egkrq5xa.fsf@gnu.org> List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org To: Ludovic =?utf-8?Q?Court=C3=A8s?= Cc: guix-devel --=-=-= Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable >>> Why leave the headers? Isn=E2=80=99t it risky to leave headers that = may be >>> different from the Samtools that we=E2=80=99re actually linking again= st? >> >> The problem is with our Samtools package(s). They don't install >> headers. I'd better update them to install the headers; then I could >> just delete the complete "samtools" directory. > > Yes that would be best, if that=E2=80=99s fine with you. Attached is a patch to add a build phase to samtools to install the headers into $out/include/samtools/. The second patch is just the updated patch for adding preseq. --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename="0001-gnu-samtools-Install-headers.patch" >From b1ba27153faca9bdf46d42046c43f8c60f945368 Mon Sep 17 00:00:00 2001 From: Ricardo Wurmus Date: Thu, 2 Jul 2015 15:53:47 +0200 Subject: [PATCH 1/2] gnu: samtools: Install headers. * gnu/packages/bioinformatics.scm (samtools)[arguments]: Add phase "install-headers" to install header files. --- gnu/packages/bioinformatics.scm | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/gnu/packages/bioinformatics.scm b/gnu/packages/bioinformatics.scm index 4a1804a..ce2f55b 100644 --- a/gnu/packages/bioinformatics.scm +++ b/gnu/packages/bioinformatics.scm @@ -1824,6 +1824,10 @@ distribution, coverage uniformity, strand specificity, etc.") ;; systems. #:tests? ,(string=? (or (%current-system) (%current-target-system)) "x86_64-linux") + #:modules ((ice-9 ftw) + (ice-9 regex) + (guix build gnu-build-system) + (guix build utils)) #:make-flags (list "LIBCURSES=-lncurses" (string-append "prefix=" (assoc-ref %outputs "out"))) #:phases @@ -1848,7 +1852,18 @@ distribution, coverage uniformity, strand specificity, etc.") (let ((lib (string-append (assoc-ref outputs "out") "/lib"))) (mkdir-p lib) (copy-file "libbam.a" (string-append lib "/libbam.a")))) - (alist-delete 'configure %standard-phases))))) + (alist-cons-after + 'install 'install-headers + (lambda* (#:key outputs #:allow-other-keys) + (let ((include (string-append (assoc-ref outputs "out") + "/include/samtools/"))) + (mkdir-p include) + (for-each (lambda (file) + (copy-file file (string-append include + (basename file)))) + (scandir "." (lambda (name) (string-match "\\.h$" name)))) + #t)) + (alist-delete 'configure %standard-phases)))))) (native-inputs `(("pkg-config" ,pkg-config))) (inputs `(("ncurses" ,ncurses) ("perl" ,perl) -- 2.1.0 --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename="0002-gnu-Add-preseq.patch" >From e3bd0a861121c441b44d77d30f2aaddb766b49c2 Mon Sep 17 00:00:00 2001 From: Ricardo Wurmus Date: Tue, 23 Jun 2015 10:54:00 +0200 Subject: [PATCH 2/2] gnu: Add preseq. * gnu/packages/bioinformatics.scm (preseq): New variable. --- gnu/packages/bioinformatics.scm | 56 ++++++++++++++++++++++ .../patches/preseq-1.0.2-install-to-PREFIX.patch | 37 ++++++++++++++ .../patches/preseq-1.0.2-link-with-libbam.patch | 33 +++++++++++++ 3 files changed, 126 insertions(+) create mode 100644 gnu/packages/patches/preseq-1.0.2-install-to-PREFIX.patch create mode 100644 gnu/packages/patches/preseq-1.0.2-link-with-libbam.patch diff --git a/gnu/packages/bioinformatics.scm b/gnu/packages/bioinformatics.scm index ce2f55b..27b847e 100644 --- a/gnu/packages/bioinformatics.scm +++ b/gnu/packages/bioinformatics.scm @@ -2137,6 +2137,62 @@ subsequent visualization, annotation and storage of results.") ;; LGPLv2.1+ (license (list license:gpl2 license:lgpl2.1+)))) +(define-public preseq + (package + (name "preseq") + (version "1.0.2") + (source (origin + (method url-fetch) + (uri + (string-append "http://smithlabresearch.org/downloads/preseq-" + version ".tar.bz2")) + (sha256 + (base32 "0r7sw07p6nv8ygvc17gd78lisbw5336v3vhs86b5wv8mw3pwqksc")) + (patches (list (search-patch "preseq-1.0.2-install-to-PREFIX.patch") + (search-patch "preseq-1.0.2-link-with-libbam.patch"))) + (modules '((guix build utils))) + (snippet + ;; Remove bundled samtools. + '(delete-file-recursively "preseq-master/samtools")))) + (build-system gnu-build-system) + (arguments + `(#:tests? #f ;no "check" target + #:phases + (modify-phases %standard-phases + (add-after + 'unpack 'enter-dir + (lambda _ + (chdir "preseq-master") + #t)) + (add-after + 'unpack 'use-samtools-headers + (lambda _ + (substitute* '("smithlab_cpp/SAM.cpp" + "smithlab_cpp/SAM.hpp") + (("sam.h") "samtools/sam.h")) + #t)) + (delete 'configure)) + #:make-flags (list (string-append "PREFIX=" + (assoc-ref %outputs "out")) + (string-append "LIBBAM=" + (assoc-ref %build-inputs "samtools") + "/lib/libbam.a")))) + (inputs + `(("gsl" ,gsl) + ("samtools" ,samtools-0.1) + ("zlib" ,zlib))) + (home-page "http://smithlabresearch.org/software/preseq/") + (synopsis "Program for analyzing library complexity") + (description + "The preseq package is aimed at predicting and estimating the complexity +of a genomic sequencing library, equivalent to predicting and estimating the +number of redundant reads from a given sequencing depth and how many will be +expected from additional sequencing using an initial sequencing experiment. +The estimates can then be used to examine the utility of further sequencing, +optimize the sequencing depth, or to screen multiple libraries to avoid low +complexity samples.") + (license license:gpl3+))) + (define-public sra-tools (package (name "sra-tools") diff --git a/gnu/packages/patches/preseq-1.0.2-install-to-PREFIX.patch b/gnu/packages/patches/preseq-1.0.2-install-to-PREFIX.patch new file mode 100644 index 0000000..f8318ae --- /dev/null +++ b/gnu/packages/patches/preseq-1.0.2-install-to-PREFIX.patch @@ -0,0 +1,37 @@ +This patch has been submitted upstream: https://github.com/smithlabcode/preseq/pull/15 + +From 65387b0d766e6c06a15cf8d8f9183d9a4ba644bb Mon Sep 17 00:00:00 2001 +From: Ricardo Wurmus +Date: Thu, 25 Jun 2015 15:01:53 +0200 +Subject: [PATCH] Install to PREFIX + +--- + Makefile | 8 ++++++-- + 1 file changed, 6 insertions(+), 2 deletions(-) + +diff --git a/Makefile b/Makefile +index 4d0367a..e334f2f 100644 +--- a/preseq-master/Makefile ++++ b/preseq-master/Makefile +@@ -22,6 +22,10 @@ ifndef ROOT + ROOT = $(shell pwd) + endif + ++ifndef PREFIX ++PREFIX = $(ROOT) ++endif ++ + ifndef SMITHLAB_CPP + SMITHLAB_CPP=$(ROOT)/smithlab_cpp/ + endif +@@ -91,8 +95,8 @@ endif + $(CXX) $(CXXFLAGS) -o $@ $^ $(INCLUDEARGS) $(LIBS) + + install: $(PROGS) +- @mkdir -p $(ROOT)/bin +- @install -m 755 $(PROGS) $(ROOT)/bin ++ @mkdir -p $(PREFIX)/bin ++ @install -m 755 $(PROGS) $(PREFIX)/bin + + clean: + @-rm -f $(PROGS) *.o *~ diff --git a/gnu/packages/patches/preseq-1.0.2-link-with-libbam.patch b/gnu/packages/patches/preseq-1.0.2-link-with-libbam.patch new file mode 100644 index 0000000..035a3b1 --- /dev/null +++ b/gnu/packages/patches/preseq-1.0.2-link-with-libbam.patch @@ -0,0 +1,33 @@ +This patch has been submitted upstream: https://github.com/smithlabcode/preseq/pull/15 + +From a937a54d56e8a6ff06237471e568154d1fa5f267 Mon Sep 17 00:00:00 2001 +From: Ricardo Wurmus +Date: Thu, 25 Jun 2015 15:02:35 +0200 +Subject: [PATCH] Link with libbam.a if provided via LIBBAM + +--- + Makefile | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/Makefile b/Makefile +index e334f2f..de310e4 100644 +--- a/preseq-master/Makefile ++++ b/preseq-master/Makefile +@@ -83,10 +83,17 @@ $(PROGS): $(addprefix $(SMITHLAB_CPP)/, \ + preseq: continued_fraction.o load_data_for_complexity.o moment_sequence.o + + ifdef SAMTOOLS_DIR ++ifdef LIBBAM ++LIBS += -pthread ++bam2mr preseq: $(addprefix $(SMITHLAB_CPP)/, SAM.o) \ ++ $(LIBBAM) ++else + bam2mr preseq: $(addprefix $(SMITHLAB_CPP)/, SAM.o) \ + $(addprefix $(SAMTOOLS_DIR)/, sam.o bam.o bam_import.o bam_pileup.o \ + faidx.o bam_aux.o kstring.o knetfile.o sam_header.o razf.o bgzf.o) + endif ++endif # SAMTOOLS_DIR ++ + + %.o: %.cpp %.hpp + $(CXX) $(CXXFLAGS) -c -o $@ $< $(INCLUDEARGS) -- 2.1.0 --=-=-=--