about summary refs log tree commit diff
diff options
context:
space:
mode:
authorArun Isaac2026-02-25 01:19:32 +0000
committerArun Isaac2026-02-25 01:19:32 +0000
commitd12eacf9b03827ce2618bdc9eadb03a6cba909fb (patch)
treeeb376c2b4ff1f8c86542dc9d15546f21af61ce23
parentce37b792008c6d373279eecb62c8a2961f19f5d7 (diff)
downloadguix-bioinformatics-d12eacf9b03827ce2618bdc9eadb03a6cba909fb.tar.gz
Add vcflib.
Guix upstream removed vcflib. This package is still broken.
Nevertheless, we add it to prevent the channel from breaking.
-rw-r--r--gn/packages/bioinformatics.scm132
1 files changed, 132 insertions, 0 deletions
diff --git a/gn/packages/bioinformatics.scm b/gn/packages/bioinformatics.scm
index 5b76ee4..af7bfe7 100644
--- a/gn/packages/bioinformatics.scm
+++ b/gn/packages/bioinformatics.scm
@@ -2318,6 +2318,138 @@ in-memory footprint at the cost of packing and unpacking.")
                             odgi-x86-64-v4)))
     (properties `((tunable? . #f)))))
 
+(define-public vcflib
+  (package
+    (name "vcflib")
+    (version "1.0.12")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/vcflib/vcflib")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "1llqnbgx4ybb77cp5k3cs0y7n4p8ma6b3sj10iarpg5r6a5gps5a"))
+       (modules '((guix build utils)))
+       (snippet
+        #~(begin
+            (substitute* "CMakeLists.txt"
+              ((".*fastahack.*") "")
+              ((".*smithwaterman.*") "")
+              (("(pkg_check_modules\\(TABIXPP)" text)
+               (string-append
+                "pkg_check_modules(WFA2 REQUIRED libwfa2)\n"
+                "pkg_check_modules(FASTAHACK REQUIRED fastahack)\n"
+                "pkg_check_modules(SMITHWATERMAN REQUIRED smithwaterman)\n"
+                text))
+              (("\\$\\{TABIXPP_LIBRARIES\\}" text)
+               (string-append "${FASTAHACK_LIBRARIES} "
+                              "${WFA2_LIBRARIES} "
+                              "${SMITHWATERMAN_LIBRARIES} "
+                              text))
+              (("install\\(TARGETS \\$\\{WFALIB\\}.*") ""))
+            (substitute* (find-files "." "\\.(h|c)(pp)?$")
+              (("SmithWatermanGotoh.h") "smithwaterman/SmithWatermanGotoh.h")
+              (("\"convert.h\"") "<smithwaterman/convert.h>")
+              (("\"disorder.h\"") "<smithwaterman/disorder.h>")
+              (("\"wavefront/wfa.hpp\"") "<wavefront/wfa.hpp>")
+              (("Fasta.h") "fastahack/Fasta.h"))))))
+    (build-system cmake-build-system)
+    (inputs
+     (list bzip2
+           curl
+           htslib
+           fastahack
+           perl
+           python
+           pybind11
+           smithwaterman
+           tabixpp
+           xz
+           zlib))
+    (propagated-inputs
+     (list wfa2-lib))
+    (native-inputs
+     `(("pkg-config" ,pkg-config)
+       ;; Submodules.
+       ;; This package builds against the .o files so we need to extract the source.
+       ("filevercmp-src" ,(package-source filevercmp))
+       ("fsom-src" ,(package-source fsom))
+       ("intervaltree-src" ,(package-source intervaltree))))
+    (arguments
+     (list
+      #:configure-flags
+      #~(list "-DZIG=OFF"
+              "-DTABIXPP_LOCAL=OFF"
+              "-DTABIX_FOUND=ON"
+              "-DWFA_GITMODULE=OFF")
+      #:tests? #f                       ; no tests
+      #:phases
+      #~(modify-phases %standard-phases
+          (add-after 'unpack 'find-wfa2lib-headers
+            (lambda _
+              (setenv "CPLUS_INCLUDE_PATH"
+                      (string-append
+                       #$(this-package-input "wfa2-lib")
+                       "/include/wfa2lib:"
+                       (or (getenv "CPLUS_INCLUDE_PATH") "")))))
+          (add-after 'unpack 'build-shared-library
+            (lambda _
+              (substitute* "CMakeLists.txt"
+                (("vcflib STATIC") "vcflib SHARED"))))
+          (add-after 'unpack 'unpack-submodule-sources
+            (lambda* (#:key inputs native-inputs #:allow-other-keys)
+              (let ((unpack (lambda (source target)
+                              (mkdir-p target)
+                              (with-directory-excursion target
+                                (let ((source (or (assoc-ref inputs source)
+                                                  (assoc-ref native-inputs source))))
+                                  (if (file-is-directory? source)
+                                      (copy-recursively source ".")
+                                      (invoke "tar" "xvf"
+                                              source
+                                              "--strip-components=1")))))))
+                (and
+                 (unpack "filevercmp-src" "contrib/filevercmp")
+                 (unpack "fsom-src" "contrib/fsom")
+                 (unpack "intervaltree-src" "contrib/intervaltree"))
+
+                ;; This is needed for downstream packages to allow building
+                ;; with GCC 11+.
+                (substitute* "contrib/intervaltree/IntervalTree.h"
+                  (("#include <vector>" m)
+                   (string-append m "
+#include <limits> /* std::numeric_limits */"))))))
+          ;; This pkg-config file is provided by other distributions.
+          (add-after 'install 'install-pkg-config-file
+            (lambda _
+              (let ((pkgconfig (string-append #$output "/lib/pkgconfig")))
+                (mkdir-p pkgconfig)
+                (with-output-to-file (string-append pkgconfig "/vcflib.pc")
+                  (lambda _
+                    (format #t "\
+prefix=~a~@
+exec_prefix=${prefix}~@
+libdir=${exec_prefix}/lib~@
+includedir=${prefix}/include~@
+~@
+Name: vcflib~@
+Version: ~a~@
+Requires: libwfa2, smithwaterman, fastahack, tabixpp~@
+Description: C++ library for parsing and manipulating VCF files~@
+Libs: -L${libdir} -lvcflib~@
+Cflags: -I${includedir}~%"
+                            #$output #$version)))))))))
+    (home-page "https://github.com/vcflib/vcflib/")
+    (synopsis "Library for parsing and manipulating VCF files")
+    (description "Vcflib provides methods to manipulate and interpret
+sequence variation as it can be described by VCF.  It is both an API for parsing
+and operating on records of genomic variation as it can be described by the VCF
+format, and a collection of command-line utilities for executing complex
+manipulations on VCF files.")
+    (license license:expat)))
+
 (define-public vg
   (package
     (name "vg")