From 91f6f758f40f3eeba656aa5fb7e9c1f67d38978f Mon Sep 17 00:00:00 2001 From: Roel Janssen Date: Tue, 23 Feb 2016 23:31:57 +0100 Subject: Latest Sambamba. Link failure. --- gn/packages/bioinformatics.scm | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/gn/packages/bioinformatics.scm b/gn/packages/bioinformatics.scm index 3363ea2..90da815 100644 --- a/gn/packages/bioinformatics.scm +++ b/gn/packages/bioinformatics.scm @@ -310,7 +310,9 @@ minimize the amount of work necessary. Unlike make, rdmd tracks dependencies and freshness without requiring additional information from the user.") (license license:boost1.0)))) + (define-public sambamba + ;;(let ((commit "8fe1bda92423c7c97a52ef81c6871fd6569fd1da")) (let ((commit "2ca5a2dbac5ab90c3b4c588519edc3edcb71df84")) (package (name "sambamba") @@ -319,11 +321,14 @@ and freshness without requiring additional information from the user.") (method git-fetch) (uri (git-reference (url "https://github.com/pjotrp/sambamba.git") + ;;(url "https://github.com/roelj/sambamba.git") (commit commit))) (file-name (string-append name "-" version "-checkout")) (sha256 (base32 - "1f14wn9aaxwjkmla6pzq3s28741carbr2v0fd2v2mm1dcpwnrqz5")))) + "1f14wn9aaxwjkmla6pzq3s28741carbr2v0fd2v2mm1dcpwnrqz5" + ;;"14gx0hhn039xhgkf5hbvffn9d0ld4zn9ka2zvvdi16k441sc8wjh" + )))) (build-system gnu-build-system) ;; (inputs ;; `(("ldc" ,ldc) @@ -395,7 +400,10 @@ and freshness without requiring additional information from the user.") (replace 'build (lambda* (#:key inputs make-flags #:allow-other-keys) - (zero? (system* "make" "-f" "Makefile.guix" "CC=gcc" "D_COMPILER=ldc2"))))))) + (zero? (system* "make" "-f" "Makefile.guix" "CC=gcc" + "D_COMPILER=ldc2" + (string-append "LDC_LIB_PATH=" + (assoc-ref inputs "ldc") "/lib")))))))) (home-page "https://github.com/lomereiter/sambamba") (synopsis "A tool for working with SAM and BAM files written in D.") (description -- cgit v1.2.3 From 1f1521af21ccdad98ad60d3d7e60c0ba4f5eb1dd Mon Sep 17 00:00:00 2001 From: Roel Janssen Date: Wed, 24 Feb 2016 12:50:24 +0100 Subject: A working version for Sambamba. --- gn/packages/bioinformatics.scm | 69 ++++++++++++++---------------------------- htslib-add-cram_to_bam.patch | 27 +++++++++++++++++ 2 files changed, 50 insertions(+), 46 deletions(-) create mode 100644 htslib-add-cram_to_bam.patch diff --git a/gn/packages/bioinformatics.scm b/gn/packages/bioinformatics.scm index 90da815..bf39935 100644 --- a/gn/packages/bioinformatics.scm +++ b/gn/packages/bioinformatics.scm @@ -310,9 +310,7 @@ minimize the amount of work necessary. Unlike make, rdmd tracks dependencies and freshness without requiring additional information from the user.") (license license:boost1.0)))) - (define-public sambamba - ;;(let ((commit "8fe1bda92423c7c97a52ef81c6871fd6569fd1da")) (let ((commit "2ca5a2dbac5ab90c3b4c588519edc3edcb71df84")) (package (name "sambamba") @@ -321,48 +319,29 @@ and freshness without requiring additional information from the user.") (method git-fetch) (uri (git-reference (url "https://github.com/pjotrp/sambamba.git") - ;;(url "https://github.com/roelj/sambamba.git") (commit commit))) (file-name (string-append name "-" version "-checkout")) (sha256 (base32 - "1f14wn9aaxwjkmla6pzq3s28741carbr2v0fd2v2mm1dcpwnrqz5" - ;;"14gx0hhn039xhgkf5hbvffn9d0ld4zn9ka2zvvdi16k441sc8wjh" - )))) + "1f14wn9aaxwjkmla6pzq3s28741carbr2v0fd2v2mm1dcpwnrqz5")))) (build-system gnu-build-system) - ;; (inputs - ;; `(("ldc" ,ldc) - ;; ;; These are currently included in "ldc". - ;; ;;("druntime-ldc" ,druntime-ldc) - ;; ;;("phobos2-ldc" ,phobos2-ldc) - ;; ("lz4" ,lz4))) (native-inputs `(("ldc" ,ldc) - ;;("druntime-ldc" ,druntime-ldc) - ;;("phobos2-ldc" ,phobos2-ldc) ("lz4" ,lz4) ("rdmd" ,rdmd) ("zlib" ,zlib) - ("perl" ,perl) ; Needed for htslib - ("ruby" ,ruby) ; Needed for htslib - ("python" ,python) ; Needed for htslib + ("perl" ,perl) ; Needed for htslib tests? + ("ruby" ,ruby) ; Needed for htslib tests? + ("python" ,python) ; Needed for htslib tests? ("gcc" ,gcc) - ("lz4-src" - ,(origin - (method url-fetch) - (uri (string-append - "https://github.com/Cyan4973/lz4/archive/r131.tar.gz")) - (file-name "lz4-r131.tar.gz") - (sha256 - (base32 "1vfg305zvj50hwscad24wan9jar6nqj14gdk2hqyr7bb9mhh0kcx")))) ("htslib-src" ,(origin (method url-fetch) - (uri (string-append - "https://github.com/lomereiter/htslib/archive/0.2.0-rc10.tar.gz")) - (file-name "htslib-0.2.0-rc10.tar.gz") + (uri "https://github.com/samtools/htslib/archive/1.3.tar.gz") + (file-name "htslib-1.3.tar.gz") (sha256 - (base32 "1k6dlf6m8yayhcp7b4yisgw1xqdy1xg2xyrllss6ld0wg00hfcbs")))) + (base32 "1bqkif7yrqmiqak5yb74kgpb2lsdlg7y344qa1xkdg7k1l4m86i9")) + (patches (list (search-patch "htslib-add-cram_to_bam.patch"))))) ("biod-src" ,(origin (method git-fetch) @@ -374,36 +353,34 @@ and freshness without requiring additional information from the user.") (base32 "09icc2bjsg9y4hxjim4ql275izadf0kh1nnmapg8manyz6bc8svf")))))) (arguments `(#:tests? #f - ;;#:make-flags + #:make-flags (list "-f" "Makefile.guix") #:phases (modify-phases %standard-phases (delete 'configure) (delete 'check) (add-after 'unpack 'unpack-htslib-sources (lambda* (#:key inputs #:allow-other-keys) - ;; Unfortunately, the current build compiles htslib statically - ;; into the executable. Instead of patching the build files - ;; for Guix, this should be resolved on Sambamba upstream. For - ;; now, just extract the source code to the desired directory. + ;; The current build compiles htslib statically into the + ;; executable. On top of that, we need to patch the latest + ;; version of htslib to have it working with Sambamba. (and (with-directory-excursion "htslib" (zero? (system* "tar" "xvf" (assoc-ref inputs "htslib-src") "--strip-components=1"))) - (with-directory-excursion "lz4" - (zero? (system* "tar" "xvf" (assoc-ref inputs "lz4-src") - "--strip-components=1"))) - (and (zero? (system* "rm" "-r" "BioD")) - (zero? (system* "ln" "--symbolic" "--no-target-directory" - (assoc-ref inputs "biod-src") "BioD")))))) - ;; Building a production-quality executable is done with a - ;; non-default make target. Adding it with #:make-flags breaks - ;; building tests. Therefore, the default make got replaced by this. + (zero? (system* "rm" "-r" "BioD")) + (zero? (system* "ln" "--symbolic" "--no-target-directory" + (assoc-ref inputs "biod-src") "BioD"))))) (replace 'build (lambda* (#:key inputs make-flags #:allow-other-keys) - (zero? (system* "make" "-f" "Makefile.guix" "CC=gcc" - "D_COMPILER=ldc2" + (zero? (system* "make" "-f" "Makefile.guix" (string-append "LDC_LIB_PATH=" - (assoc-ref inputs "ldc") "/lib")))))))) + (assoc-ref inputs "ldc") + "/lib"))))) + (replace + 'install + (lambda* (#:key outputs #:allow-other-keys) + (let ((bin (string-append (assoc-ref outputs "out") "/bin"))) + (install-file "build/sambamba" bin))))))) (home-page "https://github.com/lomereiter/sambamba") (synopsis "A tool for working with SAM and BAM files written in D.") (description diff --git a/htslib-add-cram_to_bam.patch b/htslib-add-cram_to_bam.patch new file mode 100644 index 0000000..8c43497 --- /dev/null +++ b/htslib-add-cram_to_bam.patch @@ -0,0 +1,27 @@ +This patch adds the cram_to_bam function to the public interface of htslib, +because it is used by code in Sambamba. + +by Roel Janssen +--- a/cram/cram_decode.c 2015-12-15 17:34:33.000000000 +0100 ++++ b/cram/cram_decode.c 2016-02-24 11:16:10.491808702 +0100 +@@ -2730,7 +2730,7 @@ + * Returns the used size of the bam record on success + * -1 on failure. + */ +-static int cram_to_bam(SAM_hdr *bfd, cram_fd *fd, cram_slice *s, ++int cram_to_bam(SAM_hdr *bfd, cram_fd *fd, cram_slice *s, + cram_record *cr, int rec, bam_seq_t **bam) { + int bam_idx, rg_len; + char name_a[1024], *name; +diff -Naur htslib-1.3/cram/cram_decode.h htslib-1.3-patched/cram/cram_decode.h +--- htslib-1.3/cram/cram_decode.h 2015-12-15 17:34:33.000000000 +0100 ++++ htslib-1.3-patched/cram/cram_decode.h 2016-02-24 11:15:04.556809864 +0100 +@@ -104,6 +104,8 @@ + int cram_decode_slice(cram_fd *fd, cram_container *c, cram_slice *s, + SAM_hdr *hdr); + ++int cram_to_bam(SAM_hdr *bfd, cram_fd *fd, cram_slice *s, ++ cram_record *cr, int rec, bam_seq_t **bam); + + #ifdef __cplusplus + } -- cgit v1.2.3 From c594b866b37fc38d33a87395ca8b1ef7615e2702 Mon Sep 17 00:00:00 2001 From: Roel Janssen Date: Wed, 24 Feb 2016 12:53:01 +0100 Subject: Cleaner patch file. --- htslib-add-cram_to_bam.patch | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htslib-add-cram_to_bam.patch b/htslib-add-cram_to_bam.patch index 8c43497..c90f7aa 100644 --- a/htslib-add-cram_to_bam.patch +++ b/htslib-add-cram_to_bam.patch @@ -14,8 +14,8 @@ by Roel Janssen int bam_idx, rg_len; char name_a[1024], *name; diff -Naur htslib-1.3/cram/cram_decode.h htslib-1.3-patched/cram/cram_decode.h ---- htslib-1.3/cram/cram_decode.h 2015-12-15 17:34:33.000000000 +0100 -+++ htslib-1.3-patched/cram/cram_decode.h 2016-02-24 11:15:04.556809864 +0100 +--- a/cram/cram_decode.h 2015-12-15 17:34:33.000000000 +0100 ++++ b/cram/cram_decode.h 2016-02-24 11:15:04.556809864 +0100 @@ -104,6 +104,8 @@ int cram_decode_slice(cram_fd *fd, cram_container *c, cram_slice *s, SAM_hdr *hdr); -- cgit v1.2.3